@llblab/pi-kit 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +35 -0
- package/BACKLOG.md +3 -0
- package/CHANGELOG.md +9 -0
- package/LICENSE +21 -0
- package/README.md +43 -0
- package/node_modules/@llblab/pi-actors/AGENTS.md +150 -0
- package/node_modules/@llblab/pi-actors/BACKLOG.md +6 -0
- package/node_modules/@llblab/pi-actors/CHANGELOG.md +865 -0
- package/node_modules/@llblab/pi-actors/README.md +231 -0
- package/node_modules/@llblab/pi-actors/banner.jpg +0 -0
- package/node_modules/@llblab/pi-actors/dist/fixtures/protocol/artifact-manifest.json +9 -0
- package/node_modules/@llblab/pi-actors/dist/fixtures/protocol/control-endpoint.json +6 -0
- package/node_modules/@llblab/pi-actors/dist/fixtures/protocol/control-record.json +9 -0
- package/node_modules/@llblab/pi-actors/dist/fixtures/protocol/recipe-summary.json +8 -0
- package/node_modules/@llblab/pi-actors/dist/fixtures/protocol/run-state.json +10 -0
- package/node_modules/@llblab/pi-actors/dist/fixtures/protocol/trace-event.json +9 -0
- package/node_modules/@llblab/pi-actors/dist/index.d.ts +7 -0
- package/node_modules/@llblab/pi-actors/dist/index.js +17 -0
- package/node_modules/@llblab/pi-actors/dist/lib/async-runs.d.ts +146 -0
- package/node_modules/@llblab/pi-actors/dist/lib/async-runs.js +800 -0
- package/node_modules/@llblab/pi-actors/dist/lib/automatic-review-runtime.d.ts +20 -0
- package/node_modules/@llblab/pi-actors/dist/lib/automatic-review-runtime.js +103 -0
- package/node_modules/@llblab/pi-actors/dist/lib/command-templates.d.ts +85 -0
- package/node_modules/@llblab/pi-actors/dist/lib/command-templates.js +804 -0
- package/node_modules/@llblab/pi-actors/dist/lib/config.d.ts +34 -0
- package/node_modules/@llblab/pi-actors/dist/lib/config.js +216 -0
- package/node_modules/@llblab/pi-actors/dist/lib/control-projection.d.ts +20 -0
- package/node_modules/@llblab/pi-actors/dist/lib/control-projection.js +66 -0
- package/node_modules/@llblab/pi-actors/dist/lib/control.d.ts +15 -0
- package/node_modules/@llblab/pi-actors/dist/lib/control.js +97 -0
- package/node_modules/@llblab/pi-actors/dist/lib/draft-consolidation-transaction.d.ts +65 -0
- package/node_modules/@llblab/pi-actors/dist/lib/draft-consolidation-transaction.js +610 -0
- package/node_modules/@llblab/pi-actors/dist/lib/draft-consolidation.d.ts +35 -0
- package/node_modules/@llblab/pi-actors/dist/lib/draft-consolidation.js +126 -0
- package/node_modules/@llblab/pi-actors/dist/lib/draft-review.d.ts +56 -0
- package/node_modules/@llblab/pi-actors/dist/lib/draft-review.js +254 -0
- package/node_modules/@llblab/pi-actors/dist/lib/draft-sleep.d.ts +65 -0
- package/node_modules/@llblab/pi-actors/dist/lib/draft-sleep.js +467 -0
- package/node_modules/@llblab/pi-actors/dist/lib/execution-output.d.ts +25 -0
- package/node_modules/@llblab/pi-actors/dist/lib/execution-output.js +88 -0
- package/node_modules/@llblab/pi-actors/dist/lib/execution-sessions.d.ts +17 -0
- package/node_modules/@llblab/pi-actors/dist/lib/execution-sessions.js +85 -0
- package/node_modules/@llblab/pi-actors/dist/lib/execution.d.ts +99 -0
- package/node_modules/@llblab/pi-actors/dist/lib/execution.js +725 -0
- package/node_modules/@llblab/pi-actors/dist/lib/extension-runtime.d.ts +21 -0
- package/node_modules/@llblab/pi-actors/dist/lib/extension-runtime.js +141 -0
- package/node_modules/@llblab/pi-actors/dist/lib/file-state.d.ts +18 -0
- package/node_modules/@llblab/pi-actors/dist/lib/file-state.js +310 -0
- package/node_modules/@llblab/pi-actors/dist/lib/identity.d.ts +9 -0
- package/node_modules/@llblab/pi-actors/dist/lib/identity.js +27 -0
- package/node_modules/@llblab/pi-actors/dist/lib/inspector-actions.d.ts +16 -0
- package/node_modules/@llblab/pi-actors/dist/lib/inspector-actions.js +57 -0
- package/node_modules/@llblab/pi-actors/dist/lib/inspector-command.d.ts +7 -0
- package/node_modules/@llblab/pi-actors/dist/lib/inspector-command.js +37 -0
- package/node_modules/@llblab/pi-actors/dist/lib/inspector-overlay.d.ts +100 -0
- package/node_modules/@llblab/pi-actors/dist/lib/inspector-overlay.js +824 -0
- package/node_modules/@llblab/pi-actors/dist/lib/inspector.d.ts +20 -0
- package/node_modules/@llblab/pi-actors/dist/lib/inspector.js +136 -0
- package/node_modules/@llblab/pi-actors/dist/lib/limits.d.ts +28 -0
- package/node_modules/@llblab/pi-actors/dist/lib/limits.js +28 -0
- package/node_modules/@llblab/pi-actors/dist/lib/model-context.d.ts +56 -0
- package/node_modules/@llblab/pi-actors/dist/lib/model-context.js +220 -0
- package/node_modules/@llblab/pi-actors/dist/lib/observability.d.ts +186 -0
- package/node_modules/@llblab/pi-actors/dist/lib/observability.js +951 -0
- package/node_modules/@llblab/pi-actors/dist/lib/paths.d.ts +27 -0
- package/node_modules/@llblab/pi-actors/dist/lib/paths.js +72 -0
- package/node_modules/@llblab/pi-actors/dist/lib/pi.d.ts +19 -0
- package/node_modules/@llblab/pi-actors/dist/lib/pi.js +21 -0
- package/node_modules/@llblab/pi-actors/dist/lib/preflight-diagnostics.d.ts +27 -0
- package/node_modules/@llblab/pi-actors/dist/lib/preflight-diagnostics.js +86 -0
- package/node_modules/@llblab/pi-actors/dist/lib/prompts.d.ts +24 -0
- package/node_modules/@llblab/pi-actors/dist/lib/prompts.js +49 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipe-control.d.ts +7 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipe-control.js +43 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipes-context.d.ts +36 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipes-context.js +197 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipes-discovery.d.ts +77 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipes-discovery.js +783 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipes-references.d.ts +113 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipes-references.js +1108 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipes-usage.d.ts +21 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipes-usage.js +494 -0
- package/node_modules/@llblab/pi-actors/dist/lib/registry.d.ts +67 -0
- package/node_modules/@llblab/pi-actors/dist/lib/registry.js +504 -0
- package/node_modules/@llblab/pi-actors/dist/lib/review-control.d.ts +14 -0
- package/node_modules/@llblab/pi-actors/dist/lib/review-control.js +110 -0
- package/node_modules/@llblab/pi-actors/dist/lib/review-diagnostics.d.ts +11 -0
- package/node_modules/@llblab/pi-actors/dist/lib/review-diagnostics.js +148 -0
- package/node_modules/@llblab/pi-actors/dist/lib/review-projection.d.ts +14 -0
- package/node_modules/@llblab/pi-actors/dist/lib/review-projection.js +166 -0
- package/node_modules/@llblab/pi-actors/dist/lib/run-evidence-policy.d.ts +95 -0
- package/node_modules/@llblab/pi-actors/dist/lib/run-evidence-policy.js +177 -0
- package/node_modules/@llblab/pi-actors/dist/lib/run-ui-runtime.d.ts +18 -0
- package/node_modules/@llblab/pi-actors/dist/lib/run-ui-runtime.js +125 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-artifacts.d.ts +21 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-artifacts.js +68 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-control-delivery.d.ts +28 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-control-delivery.js +150 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-control.d.ts +21 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-control.js +89 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-controls.d.ts +39 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-controls.js +283 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-identity.d.ts +5 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-identity.js +11 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-index.d.ts +27 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-index.js +142 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-ownership.d.ts +7 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-ownership.js +96 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-parent-teardown.d.ts +51 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-parent-teardown.js +172 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-process.d.ts +22 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-process.js +125 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-retention.d.ts +18 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-retention.js +108 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-start.d.ts +12 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-start.js +68 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-status.d.ts +10 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-status.js +68 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-trace.d.ts +48 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-trace.js +491 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runtime-identity.d.ts +7 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runtime-identity.js +35 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runtime-triage.d.ts +29 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runtime-triage.js +60 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runtime.d.ts +69 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runtime.js +339 -0
- package/node_modules/@llblab/pi-actors/dist/lib/schema.d.ts +60 -0
- package/node_modules/@llblab/pi-actors/dist/lib/schema.js +428 -0
- package/node_modules/@llblab/pi-actors/dist/lib/session-evidence.d.ts +45 -0
- package/node_modules/@llblab/pi-actors/dist/lib/session-evidence.js +204 -0
- package/node_modules/@llblab/pi-actors/dist/lib/state-readers.d.ts +21 -0
- package/node_modules/@llblab/pi-actors/dist/lib/state-readers.js +74 -0
- package/node_modules/@llblab/pi-actors/dist/lib/temp.d.ts +10 -0
- package/node_modules/@llblab/pi-actors/dist/lib/temp.js +90 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tool-review-lineage-transaction.d.ts +27 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tool-review-lineage-transaction.js +597 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tool-review-lineage.d.ts +24 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tool-review-lineage.js +98 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tool-review-scheduler.d.ts +80 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tool-review-scheduler.js +494 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tool-review-transaction.d.ts +50 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tool-review-transaction.js +362 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tool-review.d.ts +56 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tool-review.js +197 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-access.d.ts +19 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-access.js +44 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-inspect.d.ts +15 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-inspect.js +532 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-local.d.ts +17 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-local.js +191 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-message.d.ts +9 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-message.js +139 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-register.d.ts +18 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-register.js +41 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-response.d.ts +20 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-response.js +243 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-spawn.d.ts +15 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-spawn.js +133 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools.d.ts +28 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools.js +49 -0
- package/node_modules/@llblab/pi-actors/dist/lib/trace-projection.d.ts +22 -0
- package/node_modules/@llblab/pi-actors/dist/lib/trace-projection.js +231 -0
- package/node_modules/@llblab/pi-actors/dist/pi-actors/index.js +1 -0
- package/node_modules/@llblab/pi-actors/dist/scripts/async-runner.mjs +555 -0
- package/node_modules/@llblab/pi-actors/dist/scripts/build-dist.mjs +60 -0
- package/node_modules/@llblab/pi-actors/dist/scripts/conformance.mjs +63 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/SKILL.md +126 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/recipes/command-validate.json +13 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/recipes/jsonl-tail.json +10 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/recipes/recipe-validate.json +11 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/recipes/resource-locker-snapshot.json +11 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/recipes/resource-locker.json +25 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/recipes/run-ops-snapshot.json +15 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/recipes/run-state-files.json +13 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/recipes/run-summary.json +9 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/references/diagnostics.md +44 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/references/persistent-tools.md +76 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/references/recipes.md +51 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/references/runs.md +41 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/scripts/resource-locker.mjs +425 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/scripts/run-utils.mjs +164 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/scripts/validate-recipe.mjs +370 -0
- package/node_modules/@llblab/pi-actors/dist/skills/artifacts/SKILL.md +33 -0
- package/node_modules/@llblab/pi-actors/dist/skills/artifacts/recipes/bundle.json +77 -0
- package/node_modules/@llblab/pi-actors/dist/skills/artifacts/recipes/file-write.json +14 -0
- package/node_modules/@llblab/pi-actors/dist/skills/artifacts/recipes/manifest.json +14 -0
- package/node_modules/@llblab/pi-actors/dist/skills/artifacts/recipes/report.json +39 -0
- package/node_modules/@llblab/pi-actors/dist/skills/artifacts/recipes/write.json +53 -0
- package/node_modules/@llblab/pi-actors/dist/skills/artifacts/scripts/artifact-utils.mjs +63 -0
- package/node_modules/@llblab/pi-actors/dist/skills/music-player/SKILL.md +57 -0
- package/node_modules/@llblab/pi-actors/dist/skills/music-player/genapps/music-player.mjs +360 -0
- package/node_modules/@llblab/pi-actors/dist/skills/music-player/recipes/playback.json +29 -0
- package/node_modules/@llblab/pi-actors/dist/skills/music-player/scripts/playback-client.mjs +143 -0
- package/node_modules/@llblab/pi-actors/dist/skills/music-player/scripts/playback.mjs +1446 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/SKILL.md +37 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/changelog-head.json +11 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/changelog-section.json +11 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/docs-maintenance.json +66 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/git-log.json +11 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/git-status.json +9 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/markdown-index.json +14 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/package-summary.json +9 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/release-readiness.json +115 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/release-summary.json +74 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/repo-health.json +75 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/run-ops.json +56 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/skill-summary.json +11 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/scripts/project-utils.mjs +89 -0
- package/node_modules/@llblab/pi-actors/dist/skills/recipe-memory/SKILL.md +36 -0
- package/node_modules/@llblab/pi-actors/dist/skills/recipe-memory/recipes/draft-review.json +14 -0
- package/node_modules/@llblab/pi-actors/dist/skills/recipe-memory/recipes/tool-review.json +14 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/SKILL.md +84 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/architect.json +82 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/checkpoint-continuation.json +51 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/development-tasking.json +67 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/lens-review.json +63 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/quorum-review.json +65 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/research-synthesis.json +81 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/review-readiness.json +59 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-artifact.json +21 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-checkpoint.json +21 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-conflict-report.json +19 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-contradiction-map.json +20 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-critic.json +22 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-evidence-map.json +20 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-followup.json +21 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-judge.json +22 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-merge.json +24 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-normalize.json +20 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-plan.json +20 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-preflight.json +18 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-prompt.json +16 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-prompts.json +39 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-quorum.json +31 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-review-coordinator.json +170 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-review.json +26 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-task-card.json +22 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-tools.json +15 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-verify.json +23 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/references/development-swarm.md +189 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/references/review-swarms.md +115 -0
- package/node_modules/@llblab/pi-actors/docs/README.md +20 -0
- package/node_modules/@llblab/pi-actors/docs/actor-inspector.md +50 -0
- package/node_modules/@llblab/pi-actors/docs/async-runs.md +141 -0
- package/node_modules/@llblab/pi-actors/docs/command-templates.md +321 -0
- package/node_modules/@llblab/pi-actors/docs/recipe-library.md +89 -0
- package/node_modules/@llblab/pi-actors/docs/releasing.md +28 -0
- package/node_modules/@llblab/pi-actors/docs/template-recipes.md +175 -0
- package/node_modules/@llblab/pi-actors/docs/tool-registry.md +90 -0
- package/node_modules/@llblab/pi-actors/fixtures/protocol/artifact-manifest.json +9 -0
- package/node_modules/@llblab/pi-actors/fixtures/protocol/control-endpoint.json +6 -0
- package/node_modules/@llblab/pi-actors/fixtures/protocol/control-record.json +9 -0
- package/node_modules/@llblab/pi-actors/fixtures/protocol/recipe-summary.json +8 -0
- package/node_modules/@llblab/pi-actors/fixtures/protocol/run-state.json +10 -0
- package/node_modules/@llblab/pi-actors/fixtures/protocol/trace-event.json +9 -0
- package/node_modules/@llblab/pi-actors/index.ts +30 -0
- package/node_modules/@llblab/pi-actors/lib/async-runs.ts +1245 -0
- package/node_modules/@llblab/pi-actors/lib/automatic-review-runtime.ts +148 -0
- package/node_modules/@llblab/pi-actors/lib/command-templates.ts +1116 -0
- package/node_modules/@llblab/pi-actors/lib/config.ts +261 -0
- package/node_modules/@llblab/pi-actors/lib/control-projection.ts +105 -0
- package/node_modules/@llblab/pi-actors/lib/control.ts +117 -0
- package/node_modules/@llblab/pi-actors/lib/draft-consolidation-transaction.ts +821 -0
- package/node_modules/@llblab/pi-actors/lib/draft-consolidation.ts +181 -0
- package/node_modules/@llblab/pi-actors/lib/draft-review.ts +325 -0
- package/node_modules/@llblab/pi-actors/lib/draft-sleep.ts +575 -0
- package/node_modules/@llblab/pi-actors/lib/execution-output.ts +123 -0
- package/node_modules/@llblab/pi-actors/lib/execution-sessions.ts +111 -0
- package/node_modules/@llblab/pi-actors/lib/execution.ts +1153 -0
- package/node_modules/@llblab/pi-actors/lib/extension-runtime.ts +181 -0
- package/node_modules/@llblab/pi-actors/lib/file-state.ts +306 -0
- package/node_modules/@llblab/pi-actors/lib/identity.ts +29 -0
- package/node_modules/@llblab/pi-actors/lib/inspector-actions.ts +79 -0
- package/node_modules/@llblab/pi-actors/lib/inspector-command.ts +54 -0
- package/node_modules/@llblab/pi-actors/lib/inspector-overlay.ts +901 -0
- package/node_modules/@llblab/pi-actors/lib/inspector.ts +204 -0
- package/node_modules/@llblab/pi-actors/lib/limits.ts +29 -0
- package/node_modules/@llblab/pi-actors/lib/model-context.ts +359 -0
- package/node_modules/@llblab/pi-actors/lib/observability.ts +1337 -0
- package/node_modules/@llblab/pi-actors/lib/paths.ts +111 -0
- package/node_modules/@llblab/pi-actors/lib/pi.ts +47 -0
- package/node_modules/@llblab/pi-actors/lib/preflight-diagnostics.ts +132 -0
- package/node_modules/@llblab/pi-actors/lib/prompts.ts +69 -0
- package/node_modules/@llblab/pi-actors/lib/recipe-control.ts +52 -0
- package/node_modules/@llblab/pi-actors/lib/recipes-context.ts +268 -0
- package/node_modules/@llblab/pi-actors/lib/recipes-discovery.ts +1060 -0
- package/node_modules/@llblab/pi-actors/lib/recipes-references.ts +1598 -0
- package/node_modules/@llblab/pi-actors/lib/recipes-usage.ts +638 -0
- package/node_modules/@llblab/pi-actors/lib/registry.ts +806 -0
- package/node_modules/@llblab/pi-actors/lib/review-control.ts +136 -0
- package/node_modules/@llblab/pi-actors/lib/review-diagnostics.ts +164 -0
- package/node_modules/@llblab/pi-actors/lib/review-projection.ts +196 -0
- package/node_modules/@llblab/pi-actors/lib/run-evidence-policy.ts +242 -0
- package/node_modules/@llblab/pi-actors/lib/run-ui-runtime.ts +155 -0
- package/node_modules/@llblab/pi-actors/lib/runs-artifacts.ts +96 -0
- package/node_modules/@llblab/pi-actors/lib/runs-control-delivery.ts +209 -0
- package/node_modules/@llblab/pi-actors/lib/runs-control.ts +148 -0
- package/node_modules/@llblab/pi-actors/lib/runs-controls.ts +282 -0
- package/node_modules/@llblab/pi-actors/lib/runs-identity.ts +14 -0
- package/node_modules/@llblab/pi-actors/lib/runs-index.ts +192 -0
- package/node_modules/@llblab/pi-actors/lib/runs-ownership.ts +136 -0
- package/node_modules/@llblab/pi-actors/lib/runs-parent-teardown.ts +257 -0
- package/node_modules/@llblab/pi-actors/lib/runs-process.ts +174 -0
- package/node_modules/@llblab/pi-actors/lib/runs-retention.ts +140 -0
- package/node_modules/@llblab/pi-actors/lib/runs-start.ts +113 -0
- package/node_modules/@llblab/pi-actors/lib/runs-status.ts +101 -0
- package/node_modules/@llblab/pi-actors/lib/runs-trace.ts +611 -0
- package/node_modules/@llblab/pi-actors/lib/runtime-identity.ts +39 -0
- package/node_modules/@llblab/pi-actors/lib/runtime-triage.ts +106 -0
- package/node_modules/@llblab/pi-actors/lib/runtime.ts +430 -0
- package/node_modules/@llblab/pi-actors/lib/schema.ts +525 -0
- package/node_modules/@llblab/pi-actors/lib/session-evidence.ts +302 -0
- package/node_modules/@llblab/pi-actors/lib/state-readers.ts +93 -0
- package/node_modules/@llblab/pi-actors/lib/temp.ts +99 -0
- package/node_modules/@llblab/pi-actors/lib/tool-review-lineage-transaction.ts +881 -0
- package/node_modules/@llblab/pi-actors/lib/tool-review-lineage.ts +145 -0
- package/node_modules/@llblab/pi-actors/lib/tool-review-scheduler.ts +635 -0
- package/node_modules/@llblab/pi-actors/lib/tool-review-transaction.ts +563 -0
- package/node_modules/@llblab/pi-actors/lib/tool-review.ts +270 -0
- package/node_modules/@llblab/pi-actors/lib/tools-access.ts +68 -0
- package/node_modules/@llblab/pi-actors/lib/tools-inspect.ts +673 -0
- package/node_modules/@llblab/pi-actors/lib/tools-local.ts +303 -0
- package/node_modules/@llblab/pi-actors/lib/tools-message.ts +176 -0
- package/node_modules/@llblab/pi-actors/lib/tools-register.ts +63 -0
- package/node_modules/@llblab/pi-actors/lib/tools-response.ts +285 -0
- package/node_modules/@llblab/pi-actors/lib/tools-spawn.ts +212 -0
- package/node_modules/@llblab/pi-actors/lib/tools.ts +88 -0
- package/node_modules/@llblab/pi-actors/lib/trace-projection.ts +306 -0
- package/node_modules/@llblab/pi-actors/package.json +76 -0
- package/node_modules/@llblab/pi-actors/scripts/async-runner.mjs +555 -0
- package/node_modules/@llblab/pi-actors/scripts/build-dist.mjs +60 -0
- package/node_modules/@llblab/pi-actors/scripts/conformance.mjs +63 -0
- package/node_modules/@llblab/pi-actors/skills/actors/SKILL.md +126 -0
- package/node_modules/@llblab/pi-actors/skills/actors/recipes/command-validate.json +13 -0
- package/node_modules/@llblab/pi-actors/skills/actors/recipes/jsonl-tail.json +10 -0
- package/node_modules/@llblab/pi-actors/skills/actors/recipes/recipe-validate.json +11 -0
- package/node_modules/@llblab/pi-actors/skills/actors/recipes/resource-locker-snapshot.json +11 -0
- package/node_modules/@llblab/pi-actors/skills/actors/recipes/resource-locker.json +25 -0
- package/node_modules/@llblab/pi-actors/skills/actors/recipes/run-ops-snapshot.json +15 -0
- package/node_modules/@llblab/pi-actors/skills/actors/recipes/run-state-files.json +13 -0
- package/node_modules/@llblab/pi-actors/skills/actors/recipes/run-summary.json +9 -0
- package/node_modules/@llblab/pi-actors/skills/actors/references/diagnostics.md +44 -0
- package/node_modules/@llblab/pi-actors/skills/actors/references/persistent-tools.md +76 -0
- package/node_modules/@llblab/pi-actors/skills/actors/references/recipes.md +51 -0
- package/node_modules/@llblab/pi-actors/skills/actors/references/runs.md +41 -0
- package/node_modules/@llblab/pi-actors/skills/actors/scripts/resource-locker.mjs +425 -0
- package/node_modules/@llblab/pi-actors/skills/actors/scripts/run-utils.mjs +164 -0
- package/node_modules/@llblab/pi-actors/skills/actors/scripts/validate-recipe.mjs +370 -0
- package/node_modules/@llblab/pi-actors/skills/artifacts/SKILL.md +33 -0
- package/node_modules/@llblab/pi-actors/skills/artifacts/recipes/bundle.json +77 -0
- package/node_modules/@llblab/pi-actors/skills/artifacts/recipes/file-write.json +14 -0
- package/node_modules/@llblab/pi-actors/skills/artifacts/recipes/manifest.json +14 -0
- package/node_modules/@llblab/pi-actors/skills/artifacts/recipes/report.json +39 -0
- package/node_modules/@llblab/pi-actors/skills/artifacts/recipes/write.json +53 -0
- package/node_modules/@llblab/pi-actors/skills/artifacts/scripts/artifact-utils.mjs +63 -0
- package/node_modules/@llblab/pi-actors/skills/music-player/SKILL.md +57 -0
- package/node_modules/@llblab/pi-actors/skills/music-player/genapps/music-player.mjs +360 -0
- package/node_modules/@llblab/pi-actors/skills/music-player/recipes/playback.json +29 -0
- package/node_modules/@llblab/pi-actors/skills/music-player/scripts/playback-client.mjs +143 -0
- package/node_modules/@llblab/pi-actors/skills/music-player/scripts/playback.mjs +1446 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/SKILL.md +37 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/recipes/changelog-head.json +11 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/recipes/changelog-section.json +11 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/recipes/docs-maintenance.json +66 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/recipes/git-log.json +11 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/recipes/git-status.json +9 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/recipes/markdown-index.json +14 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/recipes/package-summary.json +9 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/recipes/release-readiness.json +115 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/recipes/release-summary.json +74 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/recipes/repo-health.json +75 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/recipes/run-ops.json +56 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/recipes/skill-summary.json +11 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/scripts/project-utils.mjs +89 -0
- package/node_modules/@llblab/pi-actors/skills/recipe-memory/SKILL.md +36 -0
- package/node_modules/@llblab/pi-actors/skills/recipe-memory/recipes/draft-review.json +14 -0
- package/node_modules/@llblab/pi-actors/skills/recipe-memory/recipes/tool-review.json +14 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/SKILL.md +84 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/architect.json +82 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/checkpoint-continuation.json +51 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/development-tasking.json +67 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/lens-review.json +63 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/quorum-review.json +65 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/research-synthesis.json +81 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/review-readiness.json +59 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-artifact.json +21 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-checkpoint.json +21 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-conflict-report.json +19 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-contradiction-map.json +20 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-critic.json +22 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-evidence-map.json +20 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-followup.json +21 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-judge.json +22 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-merge.json +24 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-normalize.json +20 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-plan.json +20 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-preflight.json +18 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-prompt.json +16 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-prompts.json +39 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-quorum.json +31 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-review-coordinator.json +170 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-review.json +26 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-task-card.json +22 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-tools.json +15 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-verify.json +23 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/references/development-swarm.md +189 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/references/review-swarms.md +115 -0
- package/node_modules/@llblab/pi-codex-usage/AGENTS.md +17 -0
- package/node_modules/@llblab/pi-codex-usage/BACKLOG.md +8 -0
- package/node_modules/@llblab/pi-codex-usage/CHANGELOG.md +80 -0
- package/node_modules/@llblab/pi-codex-usage/LICENSE +22 -0
- package/node_modules/@llblab/pi-codex-usage/README.md +113 -0
- package/node_modules/@llblab/pi-codex-usage/banner.jpg +0 -0
- package/node_modules/@llblab/pi-codex-usage/index.ts +1525 -0
- package/node_modules/@llblab/pi-codex-usage/package.json +59 -0
- package/node_modules/@llblab/pi-grow-loop/AGENTS.md +56 -0
- package/node_modules/@llblab/pi-grow-loop/BACKLOG.md +3 -0
- package/node_modules/@llblab/pi-grow-loop/CHANGELOG.md +126 -0
- package/node_modules/@llblab/pi-grow-loop/README.md +216 -0
- package/node_modules/@llblab/pi-grow-loop/banner.jpg +0 -0
- package/node_modules/@llblab/pi-grow-loop/index.ts +219 -0
- package/node_modules/@llblab/pi-grow-loop/package.json +64 -0
- package/node_modules/@llblab/pi-grow-loop/skills/grow-loop/SKILL.md +131 -0
- package/node_modules/@llblab/pi-grow-loop/skills/while-true/SKILL.md +233 -0
- package/node_modules/@llblab/pi-telegram/AGENTS.md +157 -0
- package/node_modules/@llblab/pi-telegram/BACKLOG.md +15 -0
- package/node_modules/@llblab/pi-telegram/CHANGELOG.md +886 -0
- package/node_modules/@llblab/pi-telegram/README.md +330 -0
- package/node_modules/@llblab/pi-telegram/api/activity.ts +15 -0
- package/node_modules/@llblab/pi-telegram/api/commands.ts +11 -0
- package/node_modules/@llblab/pi-telegram/api/delivery.ts +21 -0
- package/node_modules/@llblab/pi-telegram/api/inbound.ts +14 -0
- package/node_modules/@llblab/pi-telegram/api/keyboard.ts +11 -0
- package/node_modules/@llblab/pi-telegram/api/outbound.ts +11 -0
- package/node_modules/@llblab/pi-telegram/api/sections.ts +17 -0
- package/node_modules/@llblab/pi-telegram/api/status.ts +12 -0
- package/node_modules/@llblab/pi-telegram/api/updates.ts +16 -0
- package/node_modules/@llblab/pi-telegram/api/voice.ts +24 -0
- package/node_modules/@llblab/pi-telegram/docs/README.md +25 -0
- package/node_modules/@llblab/pi-telegram/docs/activity.md +304 -0
- package/node_modules/@llblab/pi-telegram/docs/architecture.md +418 -0
- package/node_modules/@llblab/pi-telegram/docs/callback-namespaces.md +48 -0
- package/node_modules/@llblab/pi-telegram/docs/command-templates.md +365 -0
- package/node_modules/@llblab/pi-telegram/docs/compact-matrix-literal.md +176 -0
- package/node_modules/@llblab/pi-telegram/docs/delivery.md +225 -0
- package/node_modules/@llblab/pi-telegram/docs/generative-apps.md +310 -0
- package/node_modules/@llblab/pi-telegram/docs/inbound.md +136 -0
- package/node_modules/@llblab/pi-telegram/docs/multi-instance-bus.md +467 -0
- package/node_modules/@llblab/pi-telegram/docs/outbound.md +193 -0
- package/node_modules/@llblab/pi-telegram/docs/public-api.md +599 -0
- package/node_modules/@llblab/pi-telegram/docs/sections.md +452 -0
- package/node_modules/@llblab/pi-telegram/docs/ui-style.md +256 -0
- package/node_modules/@llblab/pi-telegram/docs/updates.md +171 -0
- package/node_modules/@llblab/pi-telegram/docs/voice.md +217 -0
- package/node_modules/@llblab/pi-telegram/index.ts +1336 -0
- package/node_modules/@llblab/pi-telegram/lib/activity-verbosity.ts +714 -0
- package/node_modules/@llblab/pi-telegram/lib/activity.ts +782 -0
- package/node_modules/@llblab/pi-telegram/lib/agent-messages.ts +121 -0
- package/node_modules/@llblab/pi-telegram/lib/bindings.ts +1129 -0
- package/node_modules/@llblab/pi-telegram/lib/bus-api.ts +379 -0
- package/node_modules/@llblab/pi-telegram/lib/bus-follower.ts +1941 -0
- package/node_modules/@llblab/pi-telegram/lib/bus-leader.ts +2119 -0
- package/node_modules/@llblab/pi-telegram/lib/bus-transport.ts +244 -0
- package/node_modules/@llblab/pi-telegram/lib/bus.ts +2645 -0
- package/node_modules/@llblab/pi-telegram/lib/command-templates.ts +954 -0
- package/node_modules/@llblab/pi-telegram/lib/commands.ts +1854 -0
- package/node_modules/@llblab/pi-telegram/lib/config.ts +1143 -0
- package/node_modules/@llblab/pi-telegram/lib/delivery.ts +891 -0
- package/node_modules/@llblab/pi-telegram/lib/generative-app-worker.mjs +104 -0
- package/node_modules/@llblab/pi-telegram/lib/generative-apps.ts +958 -0
- package/node_modules/@llblab/pi-telegram/lib/inbound.ts +824 -0
- package/node_modules/@llblab/pi-telegram/lib/journal.ts +3140 -0
- package/node_modules/@llblab/pi-telegram/lib/keyboard.ts +59 -0
- package/node_modules/@llblab/pi-telegram/lib/lifecycle.ts +623 -0
- package/node_modules/@llblab/pi-telegram/lib/locks.ts +1422 -0
- package/node_modules/@llblab/pi-telegram/lib/logs.ts +393 -0
- package/node_modules/@llblab/pi-telegram/lib/media.ts +921 -0
- package/node_modules/@llblab/pi-telegram/lib/menu-model.ts +1182 -0
- package/node_modules/@llblab/pi-telegram/lib/menu-queue.ts +926 -0
- package/node_modules/@llblab/pi-telegram/lib/menu-settings.ts +876 -0
- package/node_modules/@llblab/pi-telegram/lib/menu-status.ts +274 -0
- package/node_modules/@llblab/pi-telegram/lib/menu-thinking.ts +185 -0
- package/node_modules/@llblab/pi-telegram/lib/menu.ts +867 -0
- package/node_modules/@llblab/pi-telegram/lib/model.ts +672 -0
- package/node_modules/@llblab/pi-telegram/lib/outbound-attachments.ts +981 -0
- package/node_modules/@llblab/pi-telegram/lib/outbound-buttons.ts +331 -0
- package/node_modules/@llblab/pi-telegram/lib/outbound-markup.ts +515 -0
- package/node_modules/@llblab/pi-telegram/lib/outbound-voice.ts +285 -0
- package/node_modules/@llblab/pi-telegram/lib/outbound.ts +1007 -0
- package/node_modules/@llblab/pi-telegram/lib/ownership.ts +298 -0
- package/node_modules/@llblab/pi-telegram/lib/paths.ts +127 -0
- package/node_modules/@llblab/pi-telegram/lib/pi.ts +197 -0
- package/node_modules/@llblab/pi-telegram/lib/polling.ts +1588 -0
- package/node_modules/@llblab/pi-telegram/lib/preview.ts +846 -0
- package/node_modules/@llblab/pi-telegram/lib/prompt-templates.ts +158 -0
- package/node_modules/@llblab/pi-telegram/lib/prompts.ts +218 -0
- package/node_modules/@llblab/pi-telegram/lib/queue.ts +3075 -0
- package/node_modules/@llblab/pi-telegram/lib/recovery.ts +464 -0
- package/node_modules/@llblab/pi-telegram/lib/rendering.ts +1213 -0
- package/node_modules/@llblab/pi-telegram/lib/replies.ts +892 -0
- package/node_modules/@llblab/pi-telegram/lib/routing.ts +2889 -0
- package/node_modules/@llblab/pi-telegram/lib/runtime.ts +628 -0
- package/node_modules/@llblab/pi-telegram/lib/sections.ts +710 -0
- package/node_modules/@llblab/pi-telegram/lib/setup.ts +220 -0
- package/node_modules/@llblab/pi-telegram/lib/skills.ts +21 -0
- package/node_modules/@llblab/pi-telegram/lib/status.ts +1550 -0
- package/node_modules/@llblab/pi-telegram/lib/sync.ts +883 -0
- package/node_modules/@llblab/pi-telegram/lib/target.ts +49 -0
- package/node_modules/@llblab/pi-telegram/lib/telegram-api.ts +1747 -0
- package/node_modules/@llblab/pi-telegram/lib/text-groups.ts +487 -0
- package/node_modules/@llblab/pi-telegram/lib/thread-reconciler.ts +1002 -0
- package/node_modules/@llblab/pi-telegram/lib/threads.ts +3183 -0
- package/node_modules/@llblab/pi-telegram/lib/time-injection.ts +78 -0
- package/node_modules/@llblab/pi-telegram/lib/turns.ts +753 -0
- package/node_modules/@llblab/pi-telegram/lib/updates.ts +4950 -0
- package/node_modules/@llblab/pi-telegram/lib/voice.ts +340 -0
- package/node_modules/@llblab/pi-telegram/package.json +83 -0
- package/node_modules/@llblab/pi-telegram/screenshot.png +0 -0
- package/node_modules/@llblab/pi-telegram/scripts/check-downgrade.mjs +435 -0
- package/node_modules/@llblab/pi-telegram/skills/generated-control-surface/SKILL.md +241 -0
- package/node_modules/@llblab/pi-telegram/skills/generative-apps/SKILL.md +114 -0
- package/node_modules/@llblab/pi-telegram/skills/telegram-bridge/SKILL.md +149 -0
- package/package.json +67 -0
|
@@ -0,0 +1,892 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Telegram reply delivery helpers
|
|
3
|
+
* Zones: telegram outbound, native rich markdown, UI/compat rendering transport
|
|
4
|
+
* Owns native assistant replies, rendered UI delivery, reply transport wiring, and plain text replies
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { assertTelegramInlineKeyboardCallbackData } from "./keyboard.ts";
|
|
8
|
+
import {
|
|
9
|
+
getTelegramTargetThreadParams,
|
|
10
|
+
type TelegramTarget,
|
|
11
|
+
} from "./target.ts";
|
|
12
|
+
import type {
|
|
13
|
+
TelegramInputRichMessage,
|
|
14
|
+
TelegramReplyParameters,
|
|
15
|
+
TelegramSendRichMessageBody,
|
|
16
|
+
TelegramSentMessage,
|
|
17
|
+
} from "./telegram-api.ts";
|
|
18
|
+
import {
|
|
19
|
+
renderTelegramMessage,
|
|
20
|
+
type TelegramRenderedChunk,
|
|
21
|
+
type TelegramRenderMode,
|
|
22
|
+
} from "./rendering.ts";
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
renderTelegramMessage,
|
|
26
|
+
type TelegramRenderedChunk,
|
|
27
|
+
type TelegramRenderMode,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export function renderTelegramMarkdownToHtmlDraft(markdown: string): string {
|
|
31
|
+
return renderTelegramMessage(markdown, { mode: "markdown" })
|
|
32
|
+
.map((chunk) => chunk.text)
|
|
33
|
+
.join("\n");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const TELEGRAM_RICH_MESSAGE_MAX_CHARS = 32768;
|
|
37
|
+
export const TELEGRAM_RICH_MESSAGE_MAX_BLOCKS = 500;
|
|
38
|
+
|
|
39
|
+
// --- Reply Dedup ---
|
|
40
|
+
|
|
41
|
+
/** Non-persistent reply deduplication for a single agent turn.
|
|
42
|
+
* First reply to a prompt gets `reply_parameters.message_id`;
|
|
43
|
+
* subsequent replies in the same turn skip it to avoid stacking
|
|
44
|
+
* duplicate reply headers in the chat viewport. */
|
|
45
|
+
export interface ReplyDedupRuntime {
|
|
46
|
+
/** Returns true if this is the first reply for the given prompt
|
|
47
|
+
* message id in the current turn. Side-effect: marks it replied. */
|
|
48
|
+
shouldReply(promptMessageId: number): boolean;
|
|
49
|
+
/** Reset the tracker when a new prompt enters the queue. */
|
|
50
|
+
reset(): void;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function createReplyDedupRuntime(): ReplyDedupRuntime {
|
|
54
|
+
const replied = new Map<number, boolean>();
|
|
55
|
+
return {
|
|
56
|
+
shouldReply(promptMessageId: number): boolean {
|
|
57
|
+
if (replied.has(promptMessageId)) return false;
|
|
58
|
+
replied.set(promptMessageId, true);
|
|
59
|
+
return true;
|
|
60
|
+
},
|
|
61
|
+
reset(): void {
|
|
62
|
+
replied.clear();
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// --- Transport-level dedup ---
|
|
68
|
+
|
|
69
|
+
const lastRepliedToMessageIdByTarget = new Map<string, number>();
|
|
70
|
+
|
|
71
|
+
function getReplyDedupTargetKey(
|
|
72
|
+
chatId: number,
|
|
73
|
+
target?: TelegramTarget,
|
|
74
|
+
): string {
|
|
75
|
+
const threadId = target?.threadId;
|
|
76
|
+
return typeof threadId === "number"
|
|
77
|
+
? `${chatId}:thread:${threadId}`
|
|
78
|
+
: `${chatId}:private`;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function resetTransportReplyDedup(): void {
|
|
82
|
+
lastRepliedToMessageIdByTarget.clear();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function buildTelegramReplyParameters(
|
|
86
|
+
chatId: number,
|
|
87
|
+
messageId: number | undefined,
|
|
88
|
+
target?: TelegramTarget,
|
|
89
|
+
): TelegramReplyParameters | undefined {
|
|
90
|
+
if (messageId === undefined || messageId <= 0) return undefined;
|
|
91
|
+
const key = getReplyDedupTargetKey(chatId, target);
|
|
92
|
+
if (lastRepliedToMessageIdByTarget.get(key) === messageId) {
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
lastRepliedToMessageIdByTarget.set(key, messageId);
|
|
96
|
+
return {
|
|
97
|
+
message_id: messageId,
|
|
98
|
+
allow_sending_without_reply: true,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function buildTelegramMultipartReplyParameters(
|
|
103
|
+
chatId: number,
|
|
104
|
+
messageId: number | undefined,
|
|
105
|
+
target?: TelegramTarget,
|
|
106
|
+
): string | undefined {
|
|
107
|
+
const parameters = buildTelegramReplyParameters(chatId, messageId, target);
|
|
108
|
+
return parameters ? JSON.stringify(parameters) : undefined;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function getAgentMessageField(message: unknown, field: string): unknown {
|
|
112
|
+
if (typeof message !== "object" || message === null || !(field in message)) {
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
return Reflect.get(message, field);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export function isAssistantAgentMessage(message: unknown): boolean {
|
|
119
|
+
return getAgentMessageField(message, "role") === "assistant";
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function extractAgentTextContent(content: unknown): string {
|
|
123
|
+
const blocks = Array.isArray(content) ? content : [];
|
|
124
|
+
return blocks
|
|
125
|
+
.filter(
|
|
126
|
+
(block): block is { type: string; text?: string } =>
|
|
127
|
+
typeof block === "object" && block !== null && "type" in block,
|
|
128
|
+
)
|
|
129
|
+
.filter((block) => block.type === "text" && typeof block.text === "string")
|
|
130
|
+
.map((block) => block.text as string)
|
|
131
|
+
.join("")
|
|
132
|
+
.trim();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function getAgentMessageText(message: unknown): string {
|
|
136
|
+
return extractAgentTextContent(getAgentMessageField(message, "content"));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function extractLatestAssistantMessageText(
|
|
140
|
+
messages: readonly unknown[],
|
|
141
|
+
): {
|
|
142
|
+
text?: string;
|
|
143
|
+
stopReason?: string;
|
|
144
|
+
errorMessage?: string;
|
|
145
|
+
} {
|
|
146
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
147
|
+
const message = messages[i];
|
|
148
|
+
if (!message || !isAssistantAgentMessage(message)) continue;
|
|
149
|
+
const rawStopReason = getAgentMessageField(message, "stopReason");
|
|
150
|
+
const rawErrorMessage = getAgentMessageField(message, "errorMessage");
|
|
151
|
+
const stopReason =
|
|
152
|
+
typeof rawStopReason === "string" ? rawStopReason : undefined;
|
|
153
|
+
const errorMessage =
|
|
154
|
+
typeof rawErrorMessage === "string" ? rawErrorMessage : undefined;
|
|
155
|
+
const text = getAgentMessageText(message);
|
|
156
|
+
return { text: text || undefined, stopReason, errorMessage };
|
|
157
|
+
}
|
|
158
|
+
return {};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface TelegramReplyOwnershipRecorder {
|
|
162
|
+
record: (input: {
|
|
163
|
+
chatId: number;
|
|
164
|
+
messageId: number;
|
|
165
|
+
target?: TelegramTarget;
|
|
166
|
+
}) => void;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export interface TelegramReplyDeliveryDeps<TReplyMarkup> {
|
|
170
|
+
recordOwnership?: TelegramReplyOwnershipRecorder["record"];
|
|
171
|
+
sendMessage: (body: {
|
|
172
|
+
chat_id: number;
|
|
173
|
+
text: string;
|
|
174
|
+
parse_mode?: "HTML";
|
|
175
|
+
reply_markup?: TReplyMarkup;
|
|
176
|
+
reply_parameters?: TelegramReplyParameters;
|
|
177
|
+
reply_to_message_id?: number;
|
|
178
|
+
message_thread_id?: number;
|
|
179
|
+
}) => Promise<TelegramSentMessage>;
|
|
180
|
+
editMessage: (body: {
|
|
181
|
+
chat_id: number;
|
|
182
|
+
message_id: number;
|
|
183
|
+
text?: string;
|
|
184
|
+
rich_message?: TelegramInputRichMessage;
|
|
185
|
+
parse_mode?: "HTML";
|
|
186
|
+
reply_markup?: TReplyMarkup;
|
|
187
|
+
message_thread_id?: number;
|
|
188
|
+
}) => Promise<unknown>;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export interface TelegramReplyTargetOptions {
|
|
192
|
+
target?: TelegramTarget;
|
|
193
|
+
replyToMessageId?: number;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export interface TelegramReplyTransport<TReplyMarkup> {
|
|
197
|
+
sendRenderedChunks: (
|
|
198
|
+
chatId: number,
|
|
199
|
+
chunks: TelegramRenderedChunk[],
|
|
200
|
+
options?: TelegramReplyTargetOptions & {
|
|
201
|
+
replyMarkup?: TReplyMarkup;
|
|
202
|
+
},
|
|
203
|
+
) => Promise<number | undefined>;
|
|
204
|
+
editRenderedMessage: (
|
|
205
|
+
chatId: number,
|
|
206
|
+
messageId: number,
|
|
207
|
+
chunks: TelegramRenderedChunk[],
|
|
208
|
+
options?: TelegramReplyTargetOptions & { replyMarkup?: TReplyMarkup },
|
|
209
|
+
) => Promise<number | undefined>;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export function buildTelegramReplyTransport<TReplyMarkup>(
|
|
213
|
+
deps: TelegramReplyDeliveryDeps<TReplyMarkup>,
|
|
214
|
+
): TelegramReplyTransport<TReplyMarkup> {
|
|
215
|
+
return {
|
|
216
|
+
sendRenderedChunks: async (chatId, chunks, options) => {
|
|
217
|
+
return sendTelegramRenderedChunks(chatId, chunks, deps, options);
|
|
218
|
+
},
|
|
219
|
+
editRenderedMessage: async (chatId, messageId, chunks, options) => {
|
|
220
|
+
return editTelegramRenderedMessage(
|
|
221
|
+
chatId,
|
|
222
|
+
messageId,
|
|
223
|
+
chunks,
|
|
224
|
+
deps,
|
|
225
|
+
options,
|
|
226
|
+
);
|
|
227
|
+
},
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export async function sendTelegramRenderedChunks<TReplyMarkup>(
|
|
232
|
+
chatId: number,
|
|
233
|
+
chunks: TelegramRenderedChunk[],
|
|
234
|
+
deps: TelegramReplyDeliveryDeps<TReplyMarkup>,
|
|
235
|
+
options?: TelegramReplyTargetOptions & {
|
|
236
|
+
replyMarkup?: TReplyMarkup;
|
|
237
|
+
},
|
|
238
|
+
): Promise<number | undefined> {
|
|
239
|
+
assertTelegramInlineKeyboardCallbackData(options?.replyMarkup);
|
|
240
|
+
let lastMessageId: number | undefined;
|
|
241
|
+
for (const [index, chunk] of chunks.entries()) {
|
|
242
|
+
const replyParameters =
|
|
243
|
+
index === 0
|
|
244
|
+
? buildTelegramReplyParameters(
|
|
245
|
+
chatId,
|
|
246
|
+
options?.replyToMessageId,
|
|
247
|
+
options?.target,
|
|
248
|
+
)
|
|
249
|
+
: undefined;
|
|
250
|
+
const body = {
|
|
251
|
+
chat_id: chatId,
|
|
252
|
+
text: chunk.text,
|
|
253
|
+
parse_mode: chunk.parseMode,
|
|
254
|
+
reply_markup:
|
|
255
|
+
index === chunks.length - 1 ? options?.replyMarkup : undefined,
|
|
256
|
+
...(replyParameters ? { reply_parameters: replyParameters } : {}),
|
|
257
|
+
...(options?.target ? getTelegramTargetThreadParams(options.target) : {}),
|
|
258
|
+
};
|
|
259
|
+
const sent = await deps.sendMessage(body);
|
|
260
|
+
lastMessageId = sent.message_id;
|
|
261
|
+
deps.recordOwnership?.({
|
|
262
|
+
chatId,
|
|
263
|
+
messageId: sent.message_id,
|
|
264
|
+
target: options?.target,
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
return lastMessageId;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export async function editTelegramRenderedMessage<TReplyMarkup>(
|
|
271
|
+
chatId: number,
|
|
272
|
+
messageId: number,
|
|
273
|
+
chunks: TelegramRenderedChunk[],
|
|
274
|
+
deps: TelegramReplyDeliveryDeps<TReplyMarkup>,
|
|
275
|
+
options?: TelegramReplyTargetOptions & { replyMarkup?: TReplyMarkup },
|
|
276
|
+
): Promise<number | undefined> {
|
|
277
|
+
assertTelegramInlineKeyboardCallbackData(options?.replyMarkup);
|
|
278
|
+
if (chunks.length === 0) return messageId;
|
|
279
|
+
const [firstChunk, ...remainingChunks] = chunks;
|
|
280
|
+
deps.recordOwnership?.({ chatId, messageId, target: options?.target });
|
|
281
|
+
await deps.editMessage({
|
|
282
|
+
chat_id: chatId,
|
|
283
|
+
message_id: messageId,
|
|
284
|
+
text: firstChunk.text,
|
|
285
|
+
parse_mode: firstChunk.parseMode,
|
|
286
|
+
reply_markup:
|
|
287
|
+
remainingChunks.length === 0 ? options?.replyMarkup : undefined,
|
|
288
|
+
...(options?.target ? getTelegramTargetThreadParams(options.target) : {}),
|
|
289
|
+
});
|
|
290
|
+
if (remainingChunks.length > 0) {
|
|
291
|
+
return sendTelegramRenderedChunks(chatId, remainingChunks, deps, {
|
|
292
|
+
replyMarkup: options?.replyMarkup,
|
|
293
|
+
target: options?.target,
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
return messageId;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export interface TelegramTextReplyOptions extends TelegramReplyTargetOptions {
|
|
300
|
+
parseMode?: "HTML";
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export interface TelegramReplyRuntimeDeps<TReplyMarkup = unknown> {
|
|
304
|
+
renderTelegramMessage: (
|
|
305
|
+
text: string,
|
|
306
|
+
options?: { mode?: TelegramRenderMode },
|
|
307
|
+
) => TelegramRenderedChunk[];
|
|
308
|
+
sendRenderedChunks: (
|
|
309
|
+
chunks: TelegramRenderedChunk[],
|
|
310
|
+
options?: { replyMarkup?: TReplyMarkup } & TelegramReplyTargetOptions,
|
|
311
|
+
) => Promise<number | undefined>;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export async function sendTelegramPlainReply(
|
|
315
|
+
text: string,
|
|
316
|
+
deps: TelegramReplyRuntimeDeps,
|
|
317
|
+
options?: TelegramTextReplyOptions,
|
|
318
|
+
): Promise<number | undefined> {
|
|
319
|
+
const chunks = deps.renderTelegramMessage(text, {
|
|
320
|
+
mode: options?.parseMode === "HTML" ? "html" : "plain",
|
|
321
|
+
});
|
|
322
|
+
return deps.sendRenderedChunks(chunks, {
|
|
323
|
+
target: options?.target,
|
|
324
|
+
replyToMessageId: options?.replyToMessageId,
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
function normalizeIndentedTelegramNativeMarkdownList(line: string): string {
|
|
329
|
+
return line.replace(
|
|
330
|
+
/^( +|\t+)([-*+] |\d+\. )/,
|
|
331
|
+
(_match, indent: string, marker: string) => {
|
|
332
|
+
const visibleIndent = indent
|
|
333
|
+
.replace(/ /g, "\u00A0")
|
|
334
|
+
.replace(/\t/g, "\u00A0\u00A0");
|
|
335
|
+
return `${visibleIndent}${marker}`;
|
|
336
|
+
},
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
function normalizeTelegramNativeMarkdownLine(line: string): string {
|
|
341
|
+
let result = normalizeIndentedTelegramNativeMarkdownList(
|
|
342
|
+
line.replace(/^( {0,3}>)[ \t]/, "$1"),
|
|
343
|
+
);
|
|
344
|
+
const codeSpans: string[] = [];
|
|
345
|
+
result = result.replace(/`+[^`]*`+/g, (code) => {
|
|
346
|
+
const token = `\u0000${codeSpans.length}\u0000`;
|
|
347
|
+
codeSpans.push(code);
|
|
348
|
+
return token;
|
|
349
|
+
});
|
|
350
|
+
result = result.replace(
|
|
351
|
+
/(^|[^\\$])\$([A-Z][A-Z0-9]{1,})(?!\$)(?=\b|[.,;:)/-])/g,
|
|
352
|
+
(_match, prefix: string, ticker: string) => `${prefix}\\$${ticker}`,
|
|
353
|
+
);
|
|
354
|
+
return result.replace(
|
|
355
|
+
/\u0000(\d+)\u0000/g,
|
|
356
|
+
(_match, index) => codeSpans[Number(index)] ?? "",
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function hasClosingDisplayMathDelimiter(
|
|
361
|
+
lines: readonly string[],
|
|
362
|
+
startIndex: number,
|
|
363
|
+
): boolean {
|
|
364
|
+
let fence: { marker: "`" | "~"; length: number } | undefined;
|
|
365
|
+
for (let index = startIndex + 1; index < lines.length; index += 1) {
|
|
366
|
+
const line = lines[index] ?? "";
|
|
367
|
+
const fenceMatch = line.match(/^ {0,3}(`{3,}|~{3,})/);
|
|
368
|
+
if (!fence && line.trim() === "$$") return true;
|
|
369
|
+
if (!fence && fenceMatch) {
|
|
370
|
+
const markerText = fenceMatch[1] ?? "```";
|
|
371
|
+
fence = { marker: markerText[0] as "`" | "~", length: markerText.length };
|
|
372
|
+
continue;
|
|
373
|
+
}
|
|
374
|
+
if (
|
|
375
|
+
fence &&
|
|
376
|
+
new RegExp(`^ {0,3}${fence.marker}{${fence.length},}\\s*$`).test(line)
|
|
377
|
+
) {
|
|
378
|
+
fence = undefined;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
return false;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export function normalizeTelegramNativeMarkdown(markdown: string): string {
|
|
385
|
+
const lines = markdown.replace(/\r\n/g, "\n").split("\n");
|
|
386
|
+
let fence: { marker: "`" | "~"; length: number } | undefined;
|
|
387
|
+
let displayMath = false;
|
|
388
|
+
return lines
|
|
389
|
+
.map((line, index) => {
|
|
390
|
+
const fenceMatch = line.match(/^ {0,3}(`{3,}|~{3,})/);
|
|
391
|
+
const inFence = fence !== undefined;
|
|
392
|
+
if (!inFence && line.trim() === "$$") {
|
|
393
|
+
if (displayMath) {
|
|
394
|
+
displayMath = false;
|
|
395
|
+
return "```";
|
|
396
|
+
}
|
|
397
|
+
if (hasClosingDisplayMathDelimiter(lines, index)) {
|
|
398
|
+
displayMath = true;
|
|
399
|
+
return "```math";
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
if (displayMath) return line;
|
|
403
|
+
if (!inFence && fenceMatch) {
|
|
404
|
+
const markerText = fenceMatch[1] ?? "```";
|
|
405
|
+
fence = {
|
|
406
|
+
marker: markerText[0] as "`" | "~",
|
|
407
|
+
length: markerText.length,
|
|
408
|
+
};
|
|
409
|
+
return line;
|
|
410
|
+
}
|
|
411
|
+
if (
|
|
412
|
+
inFence &&
|
|
413
|
+
new RegExp(`^ {0,3}${fence?.marker}{${fence?.length},}\\s*$`).test(line)
|
|
414
|
+
) {
|
|
415
|
+
fence = undefined;
|
|
416
|
+
return line;
|
|
417
|
+
}
|
|
418
|
+
if (!inFence) return normalizeTelegramNativeMarkdownLine(line);
|
|
419
|
+
return line;
|
|
420
|
+
})
|
|
421
|
+
.join("\n");
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
export function splitTelegramNativeMarkdown(markdown: string): string[] {
|
|
425
|
+
const normalizedMarkdown = normalizeTelegramNativeMarkdown(markdown);
|
|
426
|
+
if (
|
|
427
|
+
normalizedMarkdown.length <= TELEGRAM_RICH_MESSAGE_MAX_CHARS &&
|
|
428
|
+
countTelegramNativeMarkdownBlocks(normalizedMarkdown) <=
|
|
429
|
+
TELEGRAM_RICH_MESSAGE_MAX_BLOCKS
|
|
430
|
+
) {
|
|
431
|
+
return [normalizedMarkdown];
|
|
432
|
+
}
|
|
433
|
+
const chunks: string[] = [];
|
|
434
|
+
let current = "";
|
|
435
|
+
let currentBlockCount = 0;
|
|
436
|
+
for (const rawBlock of splitTelegramNativeMarkdownBlocks(
|
|
437
|
+
normalizedMarkdown,
|
|
438
|
+
)) {
|
|
439
|
+
for (const block of splitTelegramNativeMarkdownCountedBlocks(rawBlock)) {
|
|
440
|
+
const blockCount = countTelegramNativeMarkdownBlocks(block);
|
|
441
|
+
const candidate = current ? `${current}\n\n${block}` : block;
|
|
442
|
+
const exceedsChars = candidate.length > TELEGRAM_RICH_MESSAGE_MAX_CHARS;
|
|
443
|
+
const exceedsBlocks =
|
|
444
|
+
currentBlockCount + blockCount > TELEGRAM_RICH_MESSAGE_MAX_BLOCKS;
|
|
445
|
+
if (!exceedsChars && !exceedsBlocks) {
|
|
446
|
+
current = candidate;
|
|
447
|
+
currentBlockCount += blockCount;
|
|
448
|
+
continue;
|
|
449
|
+
}
|
|
450
|
+
if (current) chunks.push(current.trimEnd());
|
|
451
|
+
if (
|
|
452
|
+
block.length <= TELEGRAM_RICH_MESSAGE_MAX_CHARS &&
|
|
453
|
+
blockCount <= TELEGRAM_RICH_MESSAGE_MAX_BLOCKS
|
|
454
|
+
) {
|
|
455
|
+
current = block;
|
|
456
|
+
currentBlockCount = blockCount;
|
|
457
|
+
continue;
|
|
458
|
+
}
|
|
459
|
+
chunks.push(...splitTelegramNativeMarkdownLongBlock(block));
|
|
460
|
+
current = "";
|
|
461
|
+
currentBlockCount = 0;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
if (current) chunks.push(current.trimEnd());
|
|
465
|
+
return chunks;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
function splitTelegramNativeMarkdownBlocks(markdown: string): string[] {
|
|
469
|
+
const blocks: string[] = [];
|
|
470
|
+
const current: string[] = [];
|
|
471
|
+
let fence: { marker: "`" | "~"; length: number } | undefined;
|
|
472
|
+
const flush = (): void => {
|
|
473
|
+
if (current.length === 0) return;
|
|
474
|
+
blocks.push(current.join("\n"));
|
|
475
|
+
current.length = 0;
|
|
476
|
+
};
|
|
477
|
+
for (const line of markdown.split("\n")) {
|
|
478
|
+
const fenceMatch = line.match(/^ {0,3}(`{3,}|~{3,})/);
|
|
479
|
+
if (!fence && line.trim().length === 0) {
|
|
480
|
+
flush();
|
|
481
|
+
continue;
|
|
482
|
+
}
|
|
483
|
+
current.push(line);
|
|
484
|
+
if (!fence && fenceMatch) {
|
|
485
|
+
const markerText = fenceMatch[1] ?? "```";
|
|
486
|
+
fence = { marker: markerText[0] as "`" | "~", length: markerText.length };
|
|
487
|
+
continue;
|
|
488
|
+
}
|
|
489
|
+
if (
|
|
490
|
+
fence &&
|
|
491
|
+
new RegExp(`^ {0,3}${fence.marker}{${fence.length},}\\s*$`).test(line)
|
|
492
|
+
) {
|
|
493
|
+
fence = undefined;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
flush();
|
|
497
|
+
return blocks;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
function splitTelegramNativeMarkdownCountedBlocks(block: string): string[] {
|
|
501
|
+
if (
|
|
502
|
+
countTelegramNativeMarkdownBlocks(block) <= TELEGRAM_RICH_MESSAGE_MAX_BLOCKS
|
|
503
|
+
) {
|
|
504
|
+
return [block];
|
|
505
|
+
}
|
|
506
|
+
const chunks: string[] = [];
|
|
507
|
+
let current: string[] = [];
|
|
508
|
+
let fence: { marker: "`" | "~"; length: number } | undefined;
|
|
509
|
+
for (const line of block.split("\n")) {
|
|
510
|
+
const fenceMatch = line.match(/^ {0,3}(`{3,}|~{3,})/);
|
|
511
|
+
if (!fence && current.length >= TELEGRAM_RICH_MESSAGE_MAX_BLOCKS) {
|
|
512
|
+
chunks.push(current.join("\n"));
|
|
513
|
+
current = [];
|
|
514
|
+
}
|
|
515
|
+
current.push(line);
|
|
516
|
+
if (!fence && fenceMatch) {
|
|
517
|
+
const markerText = fenceMatch[1] ?? "```";
|
|
518
|
+
fence = { marker: markerText[0] as "`" | "~", length: markerText.length };
|
|
519
|
+
continue;
|
|
520
|
+
}
|
|
521
|
+
if (
|
|
522
|
+
fence &&
|
|
523
|
+
new RegExp(`^ {0,3}${fence.marker}{${fence.length},}\\s*$`).test(line)
|
|
524
|
+
) {
|
|
525
|
+
fence = undefined;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
if (current.length > 0) chunks.push(current.join("\n"));
|
|
529
|
+
return chunks;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
function countTelegramNativeMarkdownBlocks(block: string): number {
|
|
533
|
+
if (/^ {0,3}(`{3,}|~{3,})/.test(block)) return 1;
|
|
534
|
+
const lines = block.split("\n").filter((line) => line.trim().length > 0);
|
|
535
|
+
if (lines.some((line) => /^\s*([-*+] |\d+\. |>|\|)/.test(line))) {
|
|
536
|
+
return Math.max(1, lines.length);
|
|
537
|
+
}
|
|
538
|
+
return 1;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
function splitTelegramNativeMarkdownLongBlock(block: string): string[] {
|
|
542
|
+
return (
|
|
543
|
+
splitTelegramNativeMarkdownLongFenceBlock(block) ??
|
|
544
|
+
splitTelegramNativeMarkdownLongWrappedInlineBlock(block) ??
|
|
545
|
+
splitTelegramNativeMarkdownLongPlainBlock(block)
|
|
546
|
+
);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
function splitTelegramNativeMarkdownLongPlainBlock(block: string): string[] {
|
|
550
|
+
const chunks: string[] = [];
|
|
551
|
+
let remaining = block;
|
|
552
|
+
while (remaining.length > TELEGRAM_RICH_MESSAGE_MAX_CHARS) {
|
|
553
|
+
const window = remaining.slice(0, TELEGRAM_RICH_MESSAGE_MAX_CHARS + 1);
|
|
554
|
+
const splitIndex = findTelegramNativeMarkdownSplitIndex(window);
|
|
555
|
+
chunks.push(remaining.slice(0, splitIndex).trimEnd());
|
|
556
|
+
remaining = remaining.slice(splitIndex).trimStart();
|
|
557
|
+
}
|
|
558
|
+
if (remaining.length > 0) chunks.push(remaining);
|
|
559
|
+
return chunks;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
function splitTelegramNativeMarkdownLongFenceBlock(
|
|
563
|
+
block: string,
|
|
564
|
+
): string[] | undefined {
|
|
565
|
+
const lines = block.split("\n");
|
|
566
|
+
const opening = lines[0] ?? "";
|
|
567
|
+
const closing = lines[lines.length - 1] ?? "";
|
|
568
|
+
const openingMatch = opening?.match(/^ {0,3}(`{3,}|~{3,})/);
|
|
569
|
+
if (!openingMatch || !closing || lines.length < 2) return undefined;
|
|
570
|
+
const markerText = openingMatch[1] ?? "```";
|
|
571
|
+
const marker = markerText[0] as "`" | "~";
|
|
572
|
+
if (
|
|
573
|
+
!new RegExp(`^ {0,3}${marker}{${markerText.length},}\\s*$`).test(closing)
|
|
574
|
+
) {
|
|
575
|
+
return undefined;
|
|
576
|
+
}
|
|
577
|
+
const maxContentLength =
|
|
578
|
+
TELEGRAM_RICH_MESSAGE_MAX_CHARS - opening.length - closing.length - 2;
|
|
579
|
+
if (maxContentLength <= 0) return undefined;
|
|
580
|
+
const content = lines.slice(1, -1).join("\n");
|
|
581
|
+
return splitTelegramNativeMarkdownWrappedContent(
|
|
582
|
+
content,
|
|
583
|
+
maxContentLength,
|
|
584
|
+
(chunk) =>
|
|
585
|
+
`${opening}\n${chunk}${chunk.endsWith("\n") ? "" : "\n"}${closing}`,
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
function splitTelegramNativeMarkdownLongWrappedInlineBlock(
|
|
590
|
+
block: string,
|
|
591
|
+
): string[] | undefined {
|
|
592
|
+
const delimiter = ["**", "__", "~~", "`", "*", "_"].find(
|
|
593
|
+
(candidate) =>
|
|
594
|
+
block.startsWith(candidate) &&
|
|
595
|
+
block.endsWith(candidate) &&
|
|
596
|
+
block.length > candidate.length * 2,
|
|
597
|
+
);
|
|
598
|
+
if (!delimiter) return undefined;
|
|
599
|
+
const maxContentLength =
|
|
600
|
+
TELEGRAM_RICH_MESSAGE_MAX_CHARS - delimiter.length * 2;
|
|
601
|
+
if (maxContentLength <= 0) return undefined;
|
|
602
|
+
return splitTelegramNativeMarkdownWrappedContent(
|
|
603
|
+
block.slice(delimiter.length, -delimiter.length),
|
|
604
|
+
maxContentLength,
|
|
605
|
+
(chunk) => `${delimiter}${chunk}${delimiter}`,
|
|
606
|
+
);
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
function splitTelegramNativeMarkdownWrappedContent(
|
|
610
|
+
content: string,
|
|
611
|
+
maxContentLength: number,
|
|
612
|
+
wrap: (chunk: string) => string,
|
|
613
|
+
): string[] {
|
|
614
|
+
const chunks: string[] = [];
|
|
615
|
+
let remaining = content;
|
|
616
|
+
while (remaining.length > maxContentLength) {
|
|
617
|
+
const window = remaining.slice(0, maxContentLength + 1);
|
|
618
|
+
const splitIndex = findTelegramNativeMarkdownSplitIndex(
|
|
619
|
+
window,
|
|
620
|
+
maxContentLength,
|
|
621
|
+
);
|
|
622
|
+
chunks.push(wrap(remaining.slice(0, splitIndex)));
|
|
623
|
+
remaining = remaining.slice(splitIndex);
|
|
624
|
+
}
|
|
625
|
+
if (remaining.length > 0) chunks.push(wrap(remaining));
|
|
626
|
+
return chunks;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
function findTelegramNativeMarkdownSplitIndex(
|
|
630
|
+
text: string,
|
|
631
|
+
hardLimit = TELEGRAM_RICH_MESSAGE_MAX_CHARS,
|
|
632
|
+
): number {
|
|
633
|
+
const paragraphIndex = text.lastIndexOf("\n\n", hardLimit);
|
|
634
|
+
if (paragraphIndex > 0) return paragraphIndex + 2;
|
|
635
|
+
const lineIndex = text.lastIndexOf("\n", hardLimit);
|
|
636
|
+
if (lineIndex > 0) return lineIndex + 1;
|
|
637
|
+
const spaceIndex = text.lastIndexOf(" ", hardLimit);
|
|
638
|
+
if (spaceIndex > 0) return spaceIndex + 1;
|
|
639
|
+
return hardLimit;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
export async function sendTelegramNativeMarkdownReply<TReplyMarkup = unknown>(
|
|
643
|
+
chatId: number,
|
|
644
|
+
replyToMessageId: number | undefined,
|
|
645
|
+
markdown: string,
|
|
646
|
+
deps: {
|
|
647
|
+
recordOwnership?: TelegramReplyOwnershipRecorder["record"];
|
|
648
|
+
sendRichMessage: (
|
|
649
|
+
body: TelegramSendRichMessageBody,
|
|
650
|
+
) => Promise<TelegramSentMessage>;
|
|
651
|
+
},
|
|
652
|
+
options?: TelegramReplyTargetOptions & { replyMarkup?: TReplyMarkup },
|
|
653
|
+
): Promise<number | undefined> {
|
|
654
|
+
assertTelegramInlineKeyboardCallbackData(options?.replyMarkup);
|
|
655
|
+
let lastMessageId: number | undefined;
|
|
656
|
+
const chunks = splitTelegramNativeMarkdown(markdown);
|
|
657
|
+
for (const [index, chunk] of chunks.entries()) {
|
|
658
|
+
const replyParameters =
|
|
659
|
+
index === 0
|
|
660
|
+
? buildTelegramReplyParameters(
|
|
661
|
+
chatId,
|
|
662
|
+
replyToMessageId,
|
|
663
|
+
options?.target,
|
|
664
|
+
)
|
|
665
|
+
: undefined;
|
|
666
|
+
const sent = await deps.sendRichMessage({
|
|
667
|
+
chat_id: chatId,
|
|
668
|
+
rich_message: { markdown: chunk, skip_entity_detection: true },
|
|
669
|
+
reply_markup:
|
|
670
|
+
index === chunks.length - 1 ? options?.replyMarkup : undefined,
|
|
671
|
+
...(replyParameters ? { reply_parameters: replyParameters } : {}),
|
|
672
|
+
...(options?.target ? getTelegramTargetThreadParams(options.target) : {}),
|
|
673
|
+
});
|
|
674
|
+
lastMessageId = sent.message_id;
|
|
675
|
+
deps.recordOwnership?.({
|
|
676
|
+
chatId,
|
|
677
|
+
messageId: sent.message_id,
|
|
678
|
+
target: options?.target,
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
return lastMessageId;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
// UI/compat regular-message runtime for bridge-owned text and interactive
|
|
685
|
+
// surfaces. Assistant and guest Markdown delivery bypass this path and use
|
|
686
|
+
// native Rich Message helpers above.
|
|
687
|
+
export type TelegramAssistantRenderingMode = "rich" | "html";
|
|
688
|
+
|
|
689
|
+
export interface TelegramRenderedMessageRuntimeDeps<TReplyMarkup> {
|
|
690
|
+
renderTelegramMessage: (
|
|
691
|
+
text: string,
|
|
692
|
+
options?: { mode?: TelegramRenderMode },
|
|
693
|
+
) => TelegramRenderedChunk[];
|
|
694
|
+
replyTransport: TelegramReplyTransport<TReplyMarkup>;
|
|
695
|
+
recordOwnership?: TelegramReplyOwnershipRecorder["record"];
|
|
696
|
+
getAssistantRenderingMode?: () => TelegramAssistantRenderingMode;
|
|
697
|
+
sendRichMessage: (
|
|
698
|
+
body: TelegramSendRichMessageBody,
|
|
699
|
+
) => Promise<TelegramSentMessage>;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
export interface TelegramRenderedMessageRuntime<TReplyMarkup> {
|
|
703
|
+
sendTextReply: (
|
|
704
|
+
chatId: number,
|
|
705
|
+
replyToMessageId: number | undefined,
|
|
706
|
+
text: string,
|
|
707
|
+
options?: TelegramTextReplyOptions,
|
|
708
|
+
) => Promise<number | undefined>;
|
|
709
|
+
sendMarkdownReply: (
|
|
710
|
+
chatId: number,
|
|
711
|
+
replyToMessageId: number | undefined,
|
|
712
|
+
markdown: string,
|
|
713
|
+
options?: TelegramReplyTargetOptions & { replyMarkup?: TReplyMarkup },
|
|
714
|
+
) => Promise<number | undefined>;
|
|
715
|
+
editInteractiveMessage: (
|
|
716
|
+
chatId: number,
|
|
717
|
+
messageId: number,
|
|
718
|
+
text: string,
|
|
719
|
+
mode: TelegramRenderMode,
|
|
720
|
+
replyMarkup: TReplyMarkup,
|
|
721
|
+
) => Promise<void>;
|
|
722
|
+
sendInteractiveMessage: (
|
|
723
|
+
chatId: number,
|
|
724
|
+
text: string,
|
|
725
|
+
mode: TelegramRenderMode,
|
|
726
|
+
replyMarkup: TReplyMarkup,
|
|
727
|
+
options?: TelegramReplyTargetOptions,
|
|
728
|
+
) => Promise<number | undefined>;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
export interface TelegramRenderedMessageDeliveryRuntime<
|
|
732
|
+
TReplyMarkup,
|
|
733
|
+
> extends TelegramRenderedMessageRuntime<TReplyMarkup> {
|
|
734
|
+
replyTransport: TelegramReplyTransport<TReplyMarkup>;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
export interface TelegramRenderedMessageDeliveryRuntimeDeps<
|
|
738
|
+
TReplyMarkup,
|
|
739
|
+
> extends TelegramReplyDeliveryDeps<TReplyMarkup> {
|
|
740
|
+
renderTelegramMessage?: (
|
|
741
|
+
text: string,
|
|
742
|
+
options?: { mode?: TelegramRenderMode },
|
|
743
|
+
) => TelegramRenderedChunk[];
|
|
744
|
+
getAssistantRenderingMode?: () => TelegramAssistantRenderingMode;
|
|
745
|
+
sendRichMessage: (
|
|
746
|
+
body: TelegramSendRichMessageBody,
|
|
747
|
+
) => Promise<TelegramSentMessage>;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
export function createTelegramRenderedMessageDeliveryRuntime<TReplyMarkup>(
|
|
751
|
+
deps: TelegramRenderedMessageDeliveryRuntimeDeps<TReplyMarkup>,
|
|
752
|
+
): TelegramRenderedMessageDeliveryRuntime<TReplyMarkup> {
|
|
753
|
+
const replyTransport = buildTelegramReplyTransport({
|
|
754
|
+
recordOwnership: deps.recordOwnership,
|
|
755
|
+
sendMessage: deps.sendMessage,
|
|
756
|
+
editMessage: deps.editMessage,
|
|
757
|
+
});
|
|
758
|
+
return {
|
|
759
|
+
replyTransport,
|
|
760
|
+
...createTelegramRenderedMessageRuntime({
|
|
761
|
+
renderTelegramMessage:
|
|
762
|
+
deps.renderTelegramMessage ?? renderTelegramMessage,
|
|
763
|
+
replyTransport,
|
|
764
|
+
recordOwnership: deps.recordOwnership,
|
|
765
|
+
getAssistantRenderingMode: deps.getAssistantRenderingMode,
|
|
766
|
+
sendRichMessage: deps.sendRichMessage,
|
|
767
|
+
}),
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
export function createTelegramRenderedMessageRuntime<TReplyMarkup>(
|
|
772
|
+
deps: TelegramRenderedMessageRuntimeDeps<TReplyMarkup>,
|
|
773
|
+
): TelegramRenderedMessageRuntime<TReplyMarkup> {
|
|
774
|
+
return {
|
|
775
|
+
sendTextReply: async (chatId, replyToMessageId, text, options) => {
|
|
776
|
+
return sendTelegramPlainReply(
|
|
777
|
+
text,
|
|
778
|
+
{
|
|
779
|
+
renderTelegramMessage: deps.renderTelegramMessage,
|
|
780
|
+
sendRenderedChunks: (chunks, chunkOptions) =>
|
|
781
|
+
deps.replyTransport.sendRenderedChunks(chatId, chunks, {
|
|
782
|
+
target: chunkOptions?.target,
|
|
783
|
+
replyToMessageId:
|
|
784
|
+
chunkOptions?.replyToMessageId ?? replyToMessageId,
|
|
785
|
+
}),
|
|
786
|
+
},
|
|
787
|
+
options,
|
|
788
|
+
);
|
|
789
|
+
},
|
|
790
|
+
sendMarkdownReply: async (chatId, replyToMessageId, markdown, options) => {
|
|
791
|
+
const renderingMode = deps.getAssistantRenderingMode?.() ?? "rich";
|
|
792
|
+
if (renderingMode === "html") {
|
|
793
|
+
return deps.replyTransport.sendRenderedChunks(
|
|
794
|
+
chatId,
|
|
795
|
+
deps.renderTelegramMessage(markdown, { mode: "markdown" }),
|
|
796
|
+
{
|
|
797
|
+
replyMarkup: options?.replyMarkup,
|
|
798
|
+
target: options?.target,
|
|
799
|
+
replyToMessageId,
|
|
800
|
+
},
|
|
801
|
+
);
|
|
802
|
+
}
|
|
803
|
+
return sendTelegramNativeMarkdownReply(
|
|
804
|
+
chatId,
|
|
805
|
+
replyToMessageId,
|
|
806
|
+
markdown,
|
|
807
|
+
{
|
|
808
|
+
recordOwnership: deps.recordOwnership,
|
|
809
|
+
sendRichMessage: deps.sendRichMessage,
|
|
810
|
+
},
|
|
811
|
+
options,
|
|
812
|
+
);
|
|
813
|
+
},
|
|
814
|
+
editInteractiveMessage: async (
|
|
815
|
+
chatId,
|
|
816
|
+
messageId,
|
|
817
|
+
text,
|
|
818
|
+
mode,
|
|
819
|
+
replyMarkup,
|
|
820
|
+
) => {
|
|
821
|
+
await deps.replyTransport.editRenderedMessage(
|
|
822
|
+
chatId,
|
|
823
|
+
messageId,
|
|
824
|
+
deps.renderTelegramMessage(text, { mode }),
|
|
825
|
+
{ replyMarkup },
|
|
826
|
+
);
|
|
827
|
+
},
|
|
828
|
+
sendInteractiveMessage: async (
|
|
829
|
+
chatId,
|
|
830
|
+
text,
|
|
831
|
+
mode,
|
|
832
|
+
replyMarkup,
|
|
833
|
+
options,
|
|
834
|
+
) => {
|
|
835
|
+
return deps.replyTransport.sendRenderedChunks(
|
|
836
|
+
chatId,
|
|
837
|
+
deps.renderTelegramMessage(text, { mode }),
|
|
838
|
+
{
|
|
839
|
+
replyMarkup,
|
|
840
|
+
target: options?.target,
|
|
841
|
+
replyToMessageId: options?.replyToMessageId,
|
|
842
|
+
},
|
|
843
|
+
);
|
|
844
|
+
},
|
|
845
|
+
};
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
// --- Dedup-wrapped Reply Wrappers ---
|
|
849
|
+
|
|
850
|
+
/** Wrap a sendTextReply with reply dedup so only the first message
|
|
851
|
+
* in a turn carries reply metadata. */
|
|
852
|
+
export function dedupSendTextReply(
|
|
853
|
+
dedup: ReplyDedupRuntime,
|
|
854
|
+
inner: (
|
|
855
|
+
chatId: number,
|
|
856
|
+
replyToMessageId: number | undefined,
|
|
857
|
+
text: string,
|
|
858
|
+
options?: TelegramTextReplyOptions,
|
|
859
|
+
) => Promise<number | undefined>,
|
|
860
|
+
): (
|
|
861
|
+
chatId: number,
|
|
862
|
+
replyToMessageId: number,
|
|
863
|
+
text: string,
|
|
864
|
+
options?: TelegramTextReplyOptions,
|
|
865
|
+
) => Promise<number | undefined> {
|
|
866
|
+
return async (chatId, replyToMessageId, text, options) => {
|
|
867
|
+
const effectiveReplyTo = dedup.shouldReply(replyToMessageId)
|
|
868
|
+
? replyToMessageId
|
|
869
|
+
: undefined;
|
|
870
|
+
return inner(chatId, effectiveReplyTo, text, options);
|
|
871
|
+
};
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
/**
|
|
875
|
+
* Guest reply sender: answers guest queries with native Rich Markdown content.
|
|
876
|
+
* Guest queries use InlineQueryResult input_message_content rather than chat
|
|
877
|
+
* sendRichMessage, so this stays as a dedicated guest transport adapter.
|
|
878
|
+
*/
|
|
879
|
+
export function createGuestMarkdownReplySender(deps: {
|
|
880
|
+
answerGuestQuery: (
|
|
881
|
+
guestQueryId: string,
|
|
882
|
+
text?: string,
|
|
883
|
+
options?: { parseMode?: string; richMessage?: TelegramInputRichMessage },
|
|
884
|
+
) => Promise<void>;
|
|
885
|
+
}) {
|
|
886
|
+
return async (guestQueryId: string, markdown: string) => {
|
|
887
|
+
const [richMarkdown = markdown] = splitTelegramNativeMarkdown(markdown);
|
|
888
|
+
await deps.answerGuestQuery(guestQueryId, undefined, {
|
|
889
|
+
richMessage: { markdown: richMarkdown, skip_entity_detection: true },
|
|
890
|
+
});
|
|
891
|
+
};
|
|
892
|
+
}
|