blun-king-cli 9.1.587 → 9.1.588
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/CHANGELOG.md +11 -185
- package/LIESMICH.txt +51 -13
- package/README.md +44 -47
- package/agent-spine-plugin/.codex-plugin/plugin.json +16 -4
- package/agent-spine-plugin/CHANGELOG.md +37 -5
- package/agent-spine-plugin/README.md +3 -3
- package/agent-spine-plugin/blun.plugin.json +45 -10
- package/agent-spine-plugin/docs/artifact-evaluation.md +93 -0
- package/agent-spine-plugin/docs/host-integration.md +42 -27
- package/agent-spine-plugin/docs/preflight-recall.md +4 -2
- package/agent-spine-plugin/docs/session-timeline.md +97 -236
- package/agent-spine-plugin/docs/world-model.md +25 -0
- package/agent-spine-plugin/hooks/codex.json +1 -1
- package/agent-spine-plugin/hooks/hooks.json +1 -1
- package/agent-spine-plugin/package.json +1 -3
- package/agent-spine-plugin/scripts/check-hosts.js +3 -3
- package/agent-spine-plugin/scripts/release-check.js +10 -5
- package/agent-spine-plugin/scripts/run-checks.js +4 -1
- package/agent-spine-plugin/scripts/run-tests-hermetic.js +32 -6
- package/agent-spine-plugin/src/cli-learning.js +15 -0
- package/agent-spine-plugin/src/cli.js +2 -0
- package/agent-spine-plugin/src/hook.js +32 -32
- package/agent-spine-plugin/src/lib/action-lesson-recall.js +73 -8
- package/agent-spine-plugin/src/lib/briefing.js +146 -36
- package/agent-spine-plugin/src/lib/channel-continuity.js +19 -0
- package/agent-spine-plugin/src/lib/delivery-agent-usage.js +14 -7
- package/agent-spine-plugin/src/lib/gateway-group-response.js +128 -0
- package/agent-spine-plugin/src/lib/gateway-runs.js +24 -15
- package/agent-spine-plugin/src/lib/hook-briefing-use.js +13 -3
- package/agent-spine-plugin/src/lib/hook-context.js +16 -3
- package/agent-spine-plugin/src/lib/hook-output.js +129 -5
- package/agent-spine-plugin/src/lib/hook-timeline.js +5 -3
- package/agent-spine-plugin/src/lib/indexed-memory.js +2 -2
- package/agent-spine-plugin/src/lib/learning-artifact-evaluator.js +114 -0
- package/agent-spine-plugin/src/lib/learning-context.js +11 -4
- package/agent-spine-plugin/src/lib/learning-measurements.js +2 -2
- package/agent-spine-plugin/src/lib/mcp-runtime.js +89 -3
- package/agent-spine-plugin/src/lib/mcp-source-context.js +12 -2
- package/agent-spine-plugin/src/lib/mcp-timeline-tools.js +91 -8
- package/agent-spine-plugin/src/lib/mcp-world-tools.js +2 -2
- package/agent-spine-plugin/src/lib/owned-file-lock.js +20 -1
- package/agent-spine-plugin/src/lib/persona-runtime.js +2 -2
- package/agent-spine-plugin/src/lib/preflight-delivery-id.js +27 -0
- package/agent-spine-plugin/src/lib/preflight.js +4 -4
- package/agent-spine-plugin/src/lib/session-timeline-codex.js +15 -0
- package/agent-spine-plugin/src/lib/session-timeline-contract.js +12 -4
- package/agent-spine-plugin/src/lib/session-timeline-event-extract.js +36 -7
- package/agent-spine-plugin/src/lib/session-timeline-host-origin.js +13 -10
- package/agent-spine-plugin/src/lib/session-timeline-invocation.js +1 -1
- package/agent-spine-plugin/src/lib/session-timeline-king.js +14 -0
- package/agent-spine-plugin/src/lib/session-timeline-prior.js +18 -12
- package/agent-spine-plugin/src/lib/session-timeline-provider.js +5 -0
- package/agent-spine-plugin/src/lib/session-timeline-query.js +2 -0
- package/agent-spine-plugin/src/lib/session-timeline-results.js +35 -10
- package/agent-spine-plugin/src/lib/session-timeline-source-open.js +30 -0
- package/agent-spine-plugin/src/lib/session-timeline.js +122 -75
- package/agent-spine-plugin/src/lib/source-roots.js +3 -2
- package/agent-spine-plugin/src/lib/task-knowledge-context.js +22 -1
- package/agent-spine-plugin/src/lib/timeline-continuation-update.js +100 -0
- package/agent-spine-plugin/src/lib/timeline-tool-guard.js +30 -7
- package/agent-spine-plugin/src/lib/timeline-user-feedback.js +217 -0
- package/agent-spine-plugin/src/lib/timeline-world-capture.js +233 -0
- package/agent-spine-plugin/src/lib/world-knowledge.js +59 -2
- package/agent-spine-plugin/src/lib/world-model.js +64 -9
- package/agent-spine-plugin/src/worker.js +13 -1
- package/bin/blun.js +43 -28
- package/bin/core-bootstrap.js +5 -4
- package/bin/king.js +43 -28
- package/bin/launcher-mode.js +1 -10
- package/bin/launcher-runtime.js +128 -295
- package/bin/managed-node.js +0 -0
- package/bin/managed-plugin-selection.cjs +0 -1
- package/bin/native-module-repair.js +0 -0
- package/bin/node-runtime.js +0 -0
- package/bin/node-version.js +0 -0
- package/bin/plugin-bootstrap.js +56 -120
- package/bin/private-paths.js +11 -34
- package/bin/standard-tools-bootstrap.js +34 -114
- package/bin/turn-thinking-policy.cjs +3 -11
- package/bin/update-copy.js +200 -0
- package/bin/update-lease.js +0 -0
- package/bin/update-notice.js +136 -289
- package/bin/verify-agent-behavior.cjs +122 -0
- package/bin/verify-agent-components.cjs +104 -0
- package/bin/verify-bundled-agent-sources.cjs +57 -0
- package/blun.mjs +143076 -135288
- package/bundled-agent-sources.json +701 -0
- package/package.json +12 -15
- package/standard-skills/translate-native/README.md +1293 -0
- package/standard-skills/translate-native/SKILL.md +172 -22
- package/standard-skills/translate-native/VERSION +1 -1
- package/standard-skills/translate-native/agents/openai.yaml +18 -0
- package/standard-skills/translate-native/assets/icon.svg +8 -0
- package/standard-skills/translate-native/docs/BLUN_CODE_INTEGRATION.md +76 -0
- package/standard-skills/translate-native/docs/PREMORTEM.md +489 -0
- package/standard-skills/translate-native/docs/WEBSITE_LOCALIZATION.md +2035 -0
- package/standard-skills/translate-native/docs/WEBSITE_LOCALIZATION_API.md +1302 -0
- package/standard-skills/translate-native/docs/WEBSITE_LOCALIZATION_EVIDENCE_HTTP.md +136 -0
- package/standard-skills/translate-native/docs/WEBSITE_LOCALIZATION_HEALTH_HTTP.md +130 -0
- package/standard-skills/translate-native/docs/WEBSITE_LOCALIZATION_HTTP_PROVIDER.md +175 -0
- package/standard-skills/translate-native/docs/WEBSITE_LOCALIZATION_RECEIPT_VERIFIER_HTTP.md +86 -0
- package/standard-skills/translate-native/integrations/AGENT_RULES.md +32 -0
- package/standard-skills/translate-native/integrations/adapters/blun-code-language-guard.js +514 -0
- package/standard-skills/translate-native/integrations/adapters/node-language-guard.js +230 -0
- package/standard-skills/translate-native/integrations/audit_log.py +327 -0
- package/standard-skills/translate-native/integrations/claude_language_hook.js +1536 -0
- package/standard-skills/translate-native/integrations/commercial_localization_profile.py +42 -0
- package/standard-skills/translate-native/integrations/delivery-policy.example.json +28 -0
- package/standard-skills/translate-native/integrations/enforced_delivery.py +543 -0
- package/standard-skills/translate-native/integrations/guard_service.py +435 -0
- package/standard-skills/translate-native/integrations/language_gateway.py +67 -0
- package/standard-skills/translate-native/integrations/mcp_auth_headers.py +198 -0
- package/standard-skills/translate-native/integrations/mcp_http_gateway.py +429 -0
- package/standard-skills/translate-native/integrations/non_language_html_entities.js +1485 -0
- package/standard-skills/translate-native/integrations/pre_output_guard.py +65 -0
- package/standard-skills/translate-native/integrations/task_router.py +101 -0
- package/standard-skills/translate-native/integrations/website_localization.py +401 -0
- package/standard-skills/translate-native/integrations/website_localization_api.py +581 -0
- package/standard-skills/translate-native/integrations/website_localization_benchmark.py +1885 -0
- package/standard-skills/translate-native/integrations/website_localization_benchmark_campaign.py +1772 -0
- package/standard-skills/translate-native/integrations/website_localization_benchmark_candidate.py +506 -0
- package/standard-skills/translate-native/integrations/website_localization_benchmark_http.py +400 -0
- package/standard-skills/translate-native/integrations/website_localization_benchmark_review_store.py +781 -0
- package/standard-skills/translate-native/integrations/website_localization_benchmark_reviewer_http.py +500 -0
- package/standard-skills/translate-native/integrations/website_localization_benchmark_runtime.py +1107 -0
- package/standard-skills/translate-native/integrations/website_localization_benchmark_suite.py +463 -0
- package/standard-skills/translate-native/integrations/website_localization_cms.py +2835 -0
- package/standard-skills/translate-native/integrations/website_localization_cms_client.py +875 -0
- package/standard-skills/translate-native/integrations/website_localization_cms_dispatch.py +805 -0
- package/standard-skills/translate-native/integrations/website_localization_cms_http.py +588 -0
- package/standard-skills/translate-native/integrations/website_localization_cms_lifecycle_monitor.py +991 -0
- package/standard-skills/translate-native/integrations/website_localization_cms_receiver.py +1441 -0
- package/standard-skills/translate-native/integrations/website_localization_cms_receiver_runtime.py +414 -0
- package/standard-skills/translate-native/integrations/website_localization_cms_receiver_store.py +1073 -0
- package/standard-skills/translate-native/integrations/website_localization_cms_removal_dispatch.py +865 -0
- package/standard-skills/translate-native/integrations/website_localization_cms_source_client.py +583 -0
- package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery.py +964 -0
- package/standard-skills/translate-native/integrations/website_localization_cms_source_delivery_runtime.py +665 -0
- package/standard-skills/translate-native/integrations/website_localization_cms_source_http.py +1153 -0
- package/standard-skills/translate-native/integrations/website_localization_cms_source_runtime.py +675 -0
- package/standard-skills/translate-native/integrations/website_localization_cms_source_service.py +1125 -0
- package/standard-skills/translate-native/integrations/website_localization_cms_terminal_notification.py +674 -0
- package/standard-skills/translate-native/integrations/website_localization_cms_terminal_notification_http.py +444 -0
- package/standard-skills/translate-native/integrations/website_localization_cms_terminal_notification_receiver.py +1469 -0
- package/standard-skills/translate-native/integrations/website_localization_cms_terminal_notification_receiver_runtime.py +1142 -0
- package/standard-skills/translate-native/integrations/website_localization_cms_terminal_processing_monitor.py +634 -0
- package/standard-skills/translate-native/integrations/website_localization_cms_terminal_receiver_client.py +804 -0
- package/standard-skills/translate-native/integrations/website_localization_deepl_baseline.py +922 -0
- package/standard-skills/translate-native/integrations/website_localization_evidence_http.py +482 -0
- package/standard-skills/translate-native/integrations/website_localization_health.py +1541 -0
- package/standard-skills/translate-native/integrations/website_localization_health_http.py +372 -0
- package/standard-skills/translate-native/integrations/website_localization_http_provider.py +297 -0
- package/standard-skills/translate-native/integrations/website_localization_native_reference_http.py +479 -0
- package/standard-skills/translate-native/integrations/website_localization_native_reference_intake.py +363 -0
- package/standard-skills/translate-native/integrations/website_localization_native_reference_queue.py +1449 -0
- package/standard-skills/translate-native/integrations/website_localization_native_reference_store.py +420 -0
- package/standard-skills/translate-native/integrations/website_localization_quality_profiles.py +235 -0
- package/standard-skills/translate-native/integrations/website_localization_queue.py +671 -0
- package/standard-skills/translate-native/integrations/website_localization_receipt_verifier_http.py +516 -0
- package/standard-skills/translate-native/integrations/website_localization_release.py +928 -0
- package/standard-skills/translate-native/integrations/website_localization_release_coordinator.py +1008 -0
- package/standard-skills/translate-native/integrations/website_localization_runner.py +276 -0
- package/standard-skills/translate-native/integrations/website_localization_runtime.py +862 -0
- package/standard-skills/translate-native/integrations/website_localization_service.py +350 -0
- package/standard-skills/translate-native/integrations/website_localization_supervisor.py +511 -0
- package/standard-skills/translate-native/integrations/website_localization_worker.py +663 -0
- package/standard-skills/translate-native/provenance.json +3 -4
- package/standard-skills/translate-native/references/commercial-localization.md +177 -0
- package/standard-skills/translate-native/scripts/blun_language_guard.py +7 -1
- package/standard-skills/translate-native/scripts/check_commercial_review.py +80 -0
- package/standard-skills/translate-native/scripts/commercial_localization_profile.py +333 -0
- package/standard-tools/language-guard/LICENSE +21 -0
- package/standard-tools/language-guard/VERSION +1 -0
- package/standard-tools/language-guard/blun_language_guard.py +7 -1
- package/standard-tools/language-guard/check_commercial_review.py +80 -0
- package/standard-tools/language-guard/commercial_localization_profile.py +333 -0
- package/standard-tools/language-guard/language_gateway.py +62 -0
- package/standard-tools/language-guard/pre_output_guard.py +64 -0
- package/standard-tools/language-guard/provenance.json +4 -11
- package/standard-tools/manifest.json +34 -11
- package/telegram-plugin/commands/access.md +2 -10
- package/telegram-plugin/dist/bridge.mjs +64041 -687
- package/telegram-plugin/dist/mcp-server.mjs +72810 -9027
- package/telegram-plugin/dist/noise.mjs +28 -63511
- package/agent-spine-plugin/CONTRIBUTING.md +0 -52
- package/agent-spine-plugin/SECURITY.md +0 -47
- package/agent-spine-plugin/docs/assignment-continuation.md +0 -48
- package/agent-spine-plugin/docs/releasing.md +0 -85
- package/agent-spine-plugin/docs/structured-completion.md +0 -67
- package/bin/abort-listener-policy.cjs +0 -43
- package/bin/active-steer-priority-policy.cjs +0 -24
- package/bin/agent-api-http-adapter.mjs +0 -446
- package/bin/agent-api-private-http-server.mjs +0 -288
- package/bin/agent-api-runtime.mjs +0 -252
- package/bin/agent-api-service-environment.mjs +0 -236
- package/bin/agent-api-service-host.mjs +0 -209
- package/bin/agent-api-service-process.mjs +0 -171
- package/bin/agent-api-session-registry.mjs +0 -428
- package/bin/agent-api-tool-broker.cjs +0 -248
- package/bin/agent-api-turn-controller.mjs +0 -461
- package/bin/agent-api-usage-journal.cjs +0 -259
- package/bin/agent-resume-snapshot.cjs +0 -241
- package/bin/agentspine-king-goal-inbox.mjs +0 -111
- package/bin/agentspine-king-goal-intake.mjs +0 -106
- package/bin/approval-rejection-stop.cjs +0 -15
- package/bin/assistant-message-offload-policy.cjs +0 -284
- package/bin/baseline-skill-performance-policy.cjs +0 -39
- package/bin/bash-search-scope-policy.cjs +0 -49
- package/bin/codebase-search-runtime.cjs +0 -23
- package/bin/cognitive-action-checkpoint.cjs +0 -1104
- package/bin/cognitive-attention-delivery.cjs +0 -76
- package/bin/cognitive-attention-policy.cjs +0 -143
- package/bin/cognitive-attention-runtime.cjs +0 -91
- package/bin/cognitive-context-projection.cjs +0 -73
- package/bin/cognitive-cross-portal-acceptance.cjs +0 -443
- package/bin/cognitive-effective-view.cjs +0 -77
- package/bin/cognitive-focus-projection.cjs +0 -206
- package/bin/cognitive-focus-scope.cjs +0 -37
- package/bin/cognitive-goal-autostart-policy.cjs +0 -72
- package/bin/cognitive-goal-time-trigger-controller.cjs +0 -146
- package/bin/cognitive-memory-adapter.cjs +0 -282
- package/bin/cognitive-memory-command.cjs +0 -293
- package/bin/cognitive-memory-provider.cjs +0 -92
- package/bin/cognitive-salience-policy.cjs +0 -159
- package/bin/cognitive-state-store.cjs +0 -508
- package/bin/cognitive-turn-lifecycle.cjs +0 -624
- package/bin/cognitive-work-focus.cjs +0 -180
- package/bin/compaction-history-archive.cjs +0 -166
- package/bin/compaction-history-startup.cjs +0 -50
- package/bin/compaction-model-policy.cjs +0 -31
- package/bin/compaction-stage-policy.cjs +0 -21
- package/bin/compaction-transaction-policy.cjs +0 -122
- package/bin/config-write-dedup-policy.cjs +0 -27
- package/bin/context-budget-ledger.cjs +0 -31
- package/bin/context-doctor-policy.cjs +0 -70
- package/bin/context-insight-policy.cjs +0 -36
- package/bin/context-performance-policy.cjs +0 -19
- package/bin/context-pressure-policy.cjs +0 -20
- package/bin/cron-run-output.cjs +0 -45
- package/bin/cron-run-store.cjs +0 -145
- package/bin/curiosity-scout-policy.cjs +0 -49
- package/bin/default-model-output-budget-policy.cjs +0 -28
- package/bin/durable-task-resume-policy.cjs +0 -130
- package/bin/durable-task-resume-runtime.cjs +0 -117
- package/bin/durable-task-resume-store.cjs +0 -88
- package/bin/editable-tool-approval-policy.cjs +0 -540
- package/bin/editable-tool-approval-runtime.cjs +0 -99
- package/bin/effective-system-prompt-cache-policy.cjs +0 -33
- package/bin/error-memory-performance-policy.cjs +0 -113
- package/bin/file-observation-policy.cjs +0 -133
- package/bin/foreground-output-capture-policy.cjs +0 -41
- package/bin/generated-source-health.cjs +0 -142
- package/bin/glob-pattern-policy.cjs +0 -13
- package/bin/goal-completion-evidence-policy.cjs +0 -120
- package/bin/grep-output-limit-policy.cjs +0 -39
- package/bin/historical-media-projection-policy.cjs +0 -48
- package/bin/history-offload-pressure-policy.cjs +0 -33
- package/bin/html-to-research-markdown.cjs +0 -147
- package/bin/identity-context-policy.cjs +0 -764
- package/bin/identity-journal-policy.cjs +0 -107
- package/bin/input-draft-persistence.cjs +0 -77
- package/bin/king-tui-function-contract.json +0 -33
- package/bin/launcher-restart-policy.cjs +0 -150
- package/bin/live-response-repetition-guard.cjs +0 -196
- package/bin/llm-config-log-dedup-policy.cjs +0 -76
- package/bin/loop-event-record-policy.cjs +0 -174
- package/bin/managed-context-startup-policy.cjs +0 -27
- package/bin/media-activity-layout-policy.cjs +0 -34
- package/bin/media-auto-retrieval-policy.cjs +0 -90
- package/bin/media-result-policy.cjs +0 -59
- package/bin/micro-compaction-policy.cjs +0 -145
- package/bin/mistake-relevance-policy.cjs +0 -319
- package/bin/model-retry-progress-policy.cjs +0 -46
- package/bin/native-large-file-io.cjs +0 -42
- package/bin/native-runtime-cache.cjs +0 -76
- package/bin/natural-presence-policy.cjs +0 -28
- package/bin/noninteractive-shell-env-policy.cjs +0 -19
- package/bin/observer-hooks.cjs +0 -14
- package/bin/outbound-claim-provenance.cjs +0 -150
- package/bin/oversized-context-offload-policy.cjs +0 -86
- package/bin/pending-media-policy.cjs +0 -182
- package/bin/pending-token-estimate-policy.cjs +0 -41
- package/bin/personal-memory-consent-policy.cjs +0 -72
- package/bin/personal-memory-performance-policy.cjs +0 -12
- package/bin/personality-choice-policy.cjs +0 -101
- package/bin/personality-memory-adapter.cjs +0 -379
- package/bin/personality-mode.cjs +0 -46
- package/bin/personality-setup-policy.cjs +0 -197
- package/bin/proactive-compaction-policy.cjs +0 -25
- package/bin/profile-identity-resolution.cjs +0 -136
- package/bin/profile-runtime.cjs +0 -318
- package/bin/profile-tool-exclusion-policy.cjs +0 -37
- package/bin/programmatic-context-isolation.cjs +0 -25
- package/bin/programmatic-tool-runtime.mjs +0 -627
- package/bin/provider-idle-timeout-policy.cjs +0 -14
- package/bin/provider-model-refresh-deadline.cjs +0 -53
- package/bin/provider-model-refresh-policy.cjs +0 -107
- package/bin/rate-limit-recovery-policy.cjs +0 -47
- package/bin/read-batch-policy.cjs +0 -32
- package/bin/read-continuation-policy.cjs +0 -59
- package/bin/recurring-cron-history-policy.cjs +0 -124
- package/bin/relationship-continuity-policy.cjs +0 -143
- package/bin/relationship-curiosity-policy.cjs +0 -107
- package/bin/relationship-learning-policy.cjs +0 -168
- package/bin/release-artifact-freeze-policy.cjs +0 -30
- package/bin/reload-plugin-bootstrap.cjs +0 -18
- package/bin/reload-queue-policy.cjs +0 -38
- package/bin/repeated-assistant-response-policy.cjs +0 -232
- package/bin/repeated-injection-projection.cjs +0 -107
- package/bin/repeated-user-message-projection.cjs +0 -8
- package/bin/research-page-result.cjs +0 -74
- package/bin/retry-checkpoint-policy.cjs +0 -13
- package/bin/runtime-exit-ledger.cjs +0 -144
- package/bin/scoped-cron-run-policy.cjs +0 -358
- package/bin/session-checkpoint-policy.cjs +0 -25
- package/bin/session-compaction-policy.cjs +0 -84
- package/bin/session-replay-policy.cjs +0 -20
- package/bin/session-replay-window-policy.cjs +0 -40
- package/bin/session-resume-checkpoint.cjs +0 -254
- package/bin/session-scrollback-archive.cjs +0 -229
- package/bin/skill-activation-performance-policy.cjs +0 -69
- package/bin/skill-listing-performance-policy.cjs +0 -92
- package/bin/soul-organization-policy.cjs +0 -78
- package/bin/soul-preservation-policy.cjs +0 -20
- package/bin/startup-preferences.cjs +0 -131
- package/bin/streaming-flush-performance-policy.cjs +0 -28
- package/bin/structured-agent-swarm-output.cjs +0 -325
- package/bin/structured-subagent-output.cjs +0 -252
- package/bin/subagent-context-fork-policy.cjs +0 -155
- package/bin/subagent-max-tokens-handoff-policy.cjs +0 -69
- package/bin/subagent-parent-responsiveness.cjs +0 -19
- package/bin/subagent-skill-policy.cjs +0 -206
- package/bin/subagent-timeout-policy.cjs +0 -182
- package/bin/subagent-tool-policy.cjs +0 -60
- package/bin/subagent-usage-rollup-policy.cjs +0 -29
- package/bin/system-prompt-context-policy.cjs +0 -124
- package/bin/system-prompt-token-cache-policy.cjs +0 -60
- package/bin/telegram-addressed-focus.cjs +0 -55
- package/bin/telegram-addressed-priority.cjs +0 -12
- package/bin/telegram-approval-relay.cjs +0 -290
- package/bin/telegram-bot-priority.cjs +0 -17
- package/bin/telegram-console-status-policy.cjs +0 -174
- package/bin/telegram-context-projection-policy.cjs +0 -141
- package/bin/telegram-delivery-lifecycle.cjs +0 -125
- package/bin/telegram-direct-focus-policy.cjs +0 -273
- package/bin/telegram-mcp-compatibility.cjs +0 -49
- package/bin/telegram-media-delivery-policy.cjs +0 -42
- package/bin/telegram-private-conversation-policy.cjs +0 -185
- package/bin/telegram-queue-handoff-policy.cjs +0 -73
- package/bin/telegram-remote-status-policy.cjs +0 -120
- package/bin/telegram-session-queue-runtime.mjs +0 -306
- package/bin/telegram-text-chunk-policy.cjs +0 -63
- package/bin/telegram-truncated-reply-policy.cjs +0 -37
- package/bin/telegram-urgent-policy.cjs +0 -45
- package/bin/telemetry-spool-policy.cjs +0 -57
- package/bin/thinking-activity-status-policy.cjs +0 -132
- package/bin/thinking-only-guard.cjs +0 -80
- package/bin/todo-list-turn-policy.cjs +0 -131
- package/bin/tool-call-loop-policy.cjs +0 -51
- package/bin/tool-file-persistence.cjs +0 -141
- package/bin/tool-result-offload-policy.cjs +0 -359
- package/bin/tool-result-offload-telemetry.cjs +0 -12
- package/bin/tool-schema-token-cache-policy.cjs +0 -41
- package/bin/tool-stream-preview-policy.cjs +0 -9
- package/bin/tui-functional-contract.cjs +0 -55
- package/bin/turn-tool-performance-policy.cjs +0 -486
- package/bin/usage-cache-efficiency-policy.cjs +0 -26
- package/bin/user-home-path-policy.cjs +0 -13
- package/bin/user-message-offload-policy.cjs +0 -103
- package/bin/user-prompt-hook-origin-policy.cjs +0 -34
- package/bin/user-tool-record-policy.cjs +0 -7
- package/bin/validated-learning-insight-policy.cjs +0 -58
- package/bin/validated-learning-outcome-trace.cjs +0 -107
- package/bin/validated-learning-performance-policy.cjs +0 -53
- package/bin/validated-learning-signal.cjs +0 -463
- package/bin/windows-bash-dialect-policy.cjs +0 -25
- package/bin/windows-node-crash-dump.cjs +0 -110
- package/bin/write-continuation-policy.cjs +0 -69
- package/codebase-index/README.md +0 -82
- package/codebase-index/codebase_index.py +0 -470
- package/standard-skills/agent-browser/SKILL.md +0 -19
- package/standard-skills/agent-browser/references/runtime.md +0 -8
- package/standard-skills/blun-session-inspector/SKILL.md +0 -41
- package/standard-skills/blun-session-inspector/scripts/inspect-session.cjs +0 -437
- package/standard-skills/design-taste-frontend/SKILL.md +0 -1206
- package/standard-skills/full-output-enforcement/SKILL.md +0 -49
- package/standard-skills/high-end-visual-design/SKILL.md +0 -98
- package/standard-skills/image-to-code/SKILL.md +0 -1228
- package/standard-skills/industrial-brutalist-ui/SKILL.md +0 -92
- package/standard-skills/minimalist-ui/SKILL.md +0 -85
- package/standard-skills/motion-design-taste/SKILL.md +0 -74
- package/standard-skills/playwright-testing/SKILL.md +0 -19
- package/standard-skills/playwright-testing/references/runtime.md +0 -7
- package/standard-skills/premortem/SKILL.md +0 -148
- package/standard-skills/redesign-existing-projects/SKILL.md +0 -178
- package/standard-skills/research-evidence/SKILL.md +0 -39
- package/standard-skills/research-evidence/references/evidence-format.md +0 -104
- package/standard-skills/research-evidence/scripts/evidence-collection.cjs +0 -260
- package/standard-skills/research-evidence/scripts/score-report.cjs +0 -130
- package/standard-skills/screenshot-lesen/SKILL.md +0 -52
- package/standard-skills/stitch-design-taste/DESIGN.md +0 -121
- package/standard-skills/stitch-design-taste/SKILL.md +0 -184
- package/standard-skills/telegram-channel/SKILL.md +0 -18
- package/standard-skills/telegram-channel/references/runtime.md +0 -7
- package/standard-skills/venture-flywheel/SKILL.md +0 -32
- package/standard-skills/venture-flywheel/identity/project-identity.cjs +0 -146
- package/standard-skills/venture-flywheel/policy/capability-engine.cjs +0 -114
- package/standard-skills/venture-flywheel/policy/repository-trust.cjs +0 -229
- package/standard-skills/venture-flywheel/references/BEISPIELE-phase0.md +0 -146
- package/standard-skills/venture-flywheel/references/CAPABILITY-MAP.md +0 -34
- package/standard-skills/venture-flywheel/references/SPEC-phase0-identity-trust.md +0 -77
- package/standard-skills/venture-flywheel/references/SPEC-phase0-state-events.md +0 -93
- package/standard-skills/venture-flywheel/schemas/capability-decision.schema.json +0 -13
- package/standard-skills/venture-flywheel/schemas/execution-event.schema.json +0 -44
- package/standard-skills/venture-flywheel/schemas/project-identity.schema.json +0 -32
- package/standard-skills/venture-flywheel/schemas/repository-trust.schema.json +0 -57
- package/standard-skills/venture-flywheel/schemas/run-transition.schema.json +0 -59
- package/standard-skills/venture-flywheel/state/execution-event.cjs +0 -191
- package/standard-skills/venture-flywheel/state/task-state-machine.cjs +0 -190
- package/standard-skills/web-lesen/SKILL.md +0 -73
- package/standard-skills/web-lesen/scripts/crawl_public.py +0 -379
- package/standard-skills/windows-mcp/SKILL.md +0 -19
- package/standard-skills/windows-mcp/references/runtime.md +0 -9
- package/telegram-plugin/DELIVERY.md +0 -36
- package/telegram-plugin/bin/telegram-approval-relay.cjs +0 -290
- package/telegram-plugin/bin/telegram-console-status-policy.cjs +0 -175
- package/telegram-plugin/bin/telegram-delivery-lifecycle.cjs +0 -125
- package/telegram-plugin/bin/telegram-direct-reply-policy.cjs +0 -48
- package/telegram-plugin/bin/telegram-launcher-status-queue.cjs +0 -122
- package/telegram-plugin/bin/telegram-private-conversation-policy.cjs +0 -186
- package/telegram-plugin/bin/telegram-remote-status-policy.cjs +0 -121
- package/telegram-plugin/bin/telegram-reply-parts.cjs +0 -149
- package/telegram-plugin/bin/telegram-text-chunk-policy.cjs +0 -63
- package/telegram-plugin/bin/telegram-typing-keepalive.cjs +0 -89
- package/telegram-plugin/compat/mcp-server-fa511cd1.mjs +0 -73825
- /package/{bin → scripts}/fix-node-pty-perms.js +0 -0
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const crypto = require('node:crypto');
|
|
4
|
-
const fs = require('node:fs');
|
|
5
|
-
const path = require('node:path');
|
|
6
|
-
|
|
7
|
-
const DEFAULT_MAX_BYTES = 2 * 1024 * 1024;
|
|
8
|
-
const JOURNAL_NAME = 'delivery-lifecycle.jsonl';
|
|
9
|
-
const PREVIOUS_NAME = 'delivery-lifecycle.previous.jsonl';
|
|
10
|
-
|
|
11
|
-
function cleanToken(value, maximum = 80) {
|
|
12
|
-
if (value === undefined || value === null) return undefined;
|
|
13
|
-
const text = String(value).replace(/[^a-zA-Z0-9_.:-]/gu, '_').slice(0, maximum);
|
|
14
|
-
return text.length > 0 ? text : undefined;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function boundedInteger(value) {
|
|
18
|
-
const number = Number(value);
|
|
19
|
-
if (!Number.isSafeInteger(number) || number < 0) return undefined;
|
|
20
|
-
return Math.min(number, Number.MAX_SAFE_INTEGER);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function numericMessageId(value) {
|
|
24
|
-
if (value === undefined || value === null) return undefined;
|
|
25
|
-
const text = String(value);
|
|
26
|
-
return /^[1-9][0-9]{0,39}$/u.test(text) ? text : undefined;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function strictChatHash(value) {
|
|
30
|
-
if (value === undefined || value === null) return undefined;
|
|
31
|
-
const text = String(value);
|
|
32
|
-
return /^[a-f0-9]{12}$/u.test(text) ? text : undefined;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function hashChatId(chatId) {
|
|
36
|
-
if (chatId === undefined || chatId === null || String(chatId).length === 0) return undefined;
|
|
37
|
-
return crypto.createHash('sha256').update(String(chatId)).digest('hex').slice(0, 12);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function telegramDeliveryIdentity(meta = {}) {
|
|
41
|
-
const messageId = numericMessageId(meta.message_id ?? meta.messageId);
|
|
42
|
-
const chatHash = hashChatId(meta.chat_id ?? meta.chatId);
|
|
43
|
-
return {
|
|
44
|
-
...(messageId === undefined ? {} : { messageId }),
|
|
45
|
-
...(chatHash === undefined ? {} : { chatHash }),
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function lifecycleRecord(event, now, pid) {
|
|
50
|
-
const messageId = numericMessageId(event.messageId);
|
|
51
|
-
const chatHash = event.chatHash === undefined
|
|
52
|
-
? undefined
|
|
53
|
-
: strictChatHash(event.chatHash);
|
|
54
|
-
const identity = {
|
|
55
|
-
...(messageId === undefined ? {} : { messageId }),
|
|
56
|
-
...(event.chatHash === undefined
|
|
57
|
-
? telegramDeliveryIdentity({ chatId: event.chatId })
|
|
58
|
-
: chatHash === undefined ? {} : { chatHash }),
|
|
59
|
-
};
|
|
60
|
-
const record = {
|
|
61
|
-
version: 1,
|
|
62
|
-
at: now().toISOString(),
|
|
63
|
-
pid,
|
|
64
|
-
stage: cleanToken(event.stage, 48) ?? 'unknown',
|
|
65
|
-
...identity,
|
|
66
|
-
};
|
|
67
|
-
for (const [key, limit] of [
|
|
68
|
-
['route', 24],
|
|
69
|
-
['priority', 24],
|
|
70
|
-
['turnId', 48],
|
|
71
|
-
['reason', 48],
|
|
72
|
-
]) {
|
|
73
|
-
const value = cleanToken(event[key], limit);
|
|
74
|
-
if (value !== undefined) record[key] = value;
|
|
75
|
-
}
|
|
76
|
-
for (const key of ['queueDepth', 'attempt', 'checkpointOffset']) {
|
|
77
|
-
const value = boundedInteger(event[key]);
|
|
78
|
-
if (value !== undefined) record[key] = value;
|
|
79
|
-
}
|
|
80
|
-
return record;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function rotateJournal(file, previous, maximum) {
|
|
84
|
-
try {
|
|
85
|
-
if (fs.statSync(file).size < maximum) return;
|
|
86
|
-
} catch {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
try {
|
|
90
|
-
fs.rmSync(previous, { force: true });
|
|
91
|
-
fs.renameSync(file, previous);
|
|
92
|
-
} catch {}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function createTelegramDeliveryLifecycle(options = {}) {
|
|
96
|
-
const directory = options.stateDir;
|
|
97
|
-
const maximum = Number.isSafeInteger(options.maxBytes) && options.maxBytes > 0
|
|
98
|
-
? options.maxBytes
|
|
99
|
-
: DEFAULT_MAX_BYTES;
|
|
100
|
-
const now = typeof options.now === 'function' ? options.now : () => new Date();
|
|
101
|
-
const pid = Number.isSafeInteger(options.pid) ? options.pid : process.pid;
|
|
102
|
-
const file = path.join(directory, JOURNAL_NAME);
|
|
103
|
-
const previous = path.join(directory, PREVIOUS_NAME);
|
|
104
|
-
|
|
105
|
-
return {
|
|
106
|
-
record(event) {
|
|
107
|
-
try {
|
|
108
|
-
fs.mkdirSync(directory, { recursive: true });
|
|
109
|
-
rotateJournal(file, previous, maximum);
|
|
110
|
-
fs.appendFileSync(file, `${JSON.stringify(lifecycleRecord(event, now, pid))}\n`, {
|
|
111
|
-
encoding: 'utf8',
|
|
112
|
-
mode: 0o600,
|
|
113
|
-
});
|
|
114
|
-
return true;
|
|
115
|
-
} catch {
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
module.exports = {
|
|
123
|
-
createTelegramDeliveryLifecycle,
|
|
124
|
-
telegramDeliveryIdentity,
|
|
125
|
-
};
|
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const fs = require('node:fs');
|
|
4
|
-
const os = require('node:os');
|
|
5
|
-
const path = require('node:path');
|
|
6
|
-
|
|
7
|
-
const DEFAULT_SILENCE_MS = 60_000;
|
|
8
|
-
const RESUME_APPROVAL = /^(?:ja|yes|weiter|mach(?:e)? weiter|du kannst weiter(?:machen)?|bitte weiter|fortsetzen|resume|go)(?:[\s.!?,].*)?$/iu;
|
|
9
|
-
const CONVERSATION_CLOSE = /^(?:danke(?: dir)?|dankesch(?:oe|\u00f6)n|alles klar|ok(?:ay)?|passt|das war(?:'s| es| alles)|mehr nicht|fertig)(?:[\s.!?,].*)?$/iu;
|
|
10
|
-
const EXPLICIT_PAUSE = /^(?:(?:bitte\s+)?(?:pause|pausier(?:e)?|stop|stopp|warte|halt(?:e)?\s+an|nicht\s+weiter(?:machen)?))(?:[\s.!?,].*)?$/iu;
|
|
11
|
-
const DIRECT_TELEGRAM_CHANNEL = /<channel\b(?=[^>]*\bsource=["']telegram["'])(?=[^>]*\bpriority=["']direct["'])[^>]*>/iu;
|
|
12
|
-
const TELEGRAM_REPLY_TOOL = /^mcp__[^\s]*telegram[^\s]*__reply$/iu;
|
|
13
|
-
const DIRECT_CHANNEL_PAYLOAD = /<channel\b(?=[^>]*\bsource=["']telegram["'])(?=[^>]*\bpriority=["']direct["'])[^>]*>([\s\S]*?)<\/channel>/giu;
|
|
14
|
-
const DIRECT_WORK_INTENT = /\b(?:auftrag|arbeite|bau(?:e|en)?|build|check|continue|edit|feuer\s+frei|fix|fortsetzen|implement|install|lies|mach(?:e)?\s+weiter|mess|patch|pruef|resume|run|schreib|starte?|test|update|weiterarbeiten|weiterbauen|write)\b/iu;
|
|
15
|
-
const DIRECT_WORK_PAUSE = /\b(?:halt(?:e)?\s+an|nicht\s+weiter(?:machen)?|pause|pausier(?:e)?|stop|stopp|warte)\b/iu;
|
|
16
|
-
|
|
17
|
-
function isPrivateTelegramChat(chatId) {
|
|
18
|
-
return /^[1-9]\d*$/u.test(String(chatId ?? '').trim());
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function telegramDirectMessage(envelope) {
|
|
22
|
-
const chatId = String(envelope?.meta?.chat_id ?? '').trim();
|
|
23
|
-
const text = String(envelope?.text ?? '').trim();
|
|
24
|
-
if (!isPrivateTelegramChat(chatId) || text.length === 0 || text.startsWith('/')) return undefined;
|
|
25
|
-
return { chatId };
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function rewriteTelegramDirectEnvelope(envelope) {
|
|
29
|
-
const originalTag = String(envelope?.tag ?? '');
|
|
30
|
-
const tag = originalTag.replace(
|
|
31
|
-
/<channel\b(?![^>]*\bpriority=)/u,
|
|
32
|
-
'<channel priority="direct"',
|
|
33
|
-
);
|
|
34
|
-
if (tag === originalTag) return undefined;
|
|
35
|
-
return {
|
|
36
|
-
...envelope,
|
|
37
|
-
tag,
|
|
38
|
-
meta: { ...envelope.meta, priority: 'direct' },
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function enqueueTelegramDirect(queue, item) {
|
|
43
|
-
const firstNormal = queue.findIndex(
|
|
44
|
-
(queued) => queued.channelUrgent !== true && queued.channelDirect !== true,
|
|
45
|
-
);
|
|
46
|
-
queue.splice(firstNormal < 0 ? queue.length : firstNormal, 0, item);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function isResumeApproval(text) {
|
|
50
|
-
return RESUME_APPROVAL.test(String(text ?? '').trim());
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function isConversationClose(text) {
|
|
54
|
-
return CONVERSATION_CLOSE.test(String(text ?? '').trim());
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function isExplicitPauseRequest(text) {
|
|
58
|
-
return EXPLICIT_PAUSE.test(String(text ?? '').trim());
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function directTelegramPayloadText(inputText) {
|
|
62
|
-
const matches = [...String(inputText ?? '').matchAll(DIRECT_CHANNEL_PAYLOAD)];
|
|
63
|
-
return String(matches.at(-1)?.[1] ?? '').trim();
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function directMessageAllowsWorkContinuation(inputText) {
|
|
67
|
-
if (!DIRECT_TELEGRAM_CHANNEL.test(String(inputText ?? ''))) return false;
|
|
68
|
-
const payload = directTelegramPayloadText(inputText);
|
|
69
|
-
return payload.length > 0 && !DIRECT_WORK_PAUSE.test(payload);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function directMessageStartsOrResumesWork(inputText) {
|
|
73
|
-
if (!directMessageAllowsWorkContinuation(inputText)) return false;
|
|
74
|
-
const payload = directTelegramPayloadText(inputText);
|
|
75
|
-
return isResumeApproval(payload) || DIRECT_WORK_INTENT.test(payload);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function createDirectReplyTurnStop(inputText) {
|
|
79
|
-
const direct = DIRECT_TELEGRAM_CHANNEL.test(String(inputText ?? ''))
|
|
80
|
-
&& !directMessageStartsOrResumesWork(inputText);
|
|
81
|
-
let delivered = false;
|
|
82
|
-
return {
|
|
83
|
-
noteToolResult(toolName, isError) {
|
|
84
|
-
if (direct && isError !== true && TELEGRAM_REPLY_TOOL.test(String(toolName ?? ''))) {
|
|
85
|
-
delivered = true;
|
|
86
|
-
}
|
|
87
|
-
return delivered;
|
|
88
|
-
},
|
|
89
|
-
shouldStop: () => delivered,
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function createDirectFocusController(options = {}) {
|
|
94
|
-
const setTimer = options.setTimer ?? setTimeout;
|
|
95
|
-
const clearTimer = options.clearTimer ?? clearTimeout;
|
|
96
|
-
const now = options.now ?? Date.now;
|
|
97
|
-
const checkpoint = options.checkpoint ?? (() => {});
|
|
98
|
-
const resume = options.resume ?? (() => {});
|
|
99
|
-
const silenceMs = options.silenceMs ?? DEFAULT_SILENCE_MS;
|
|
100
|
-
const conversations = new Map();
|
|
101
|
-
let savedCheckpoint;
|
|
102
|
-
|
|
103
|
-
function clearConversationTimer(conversation) {
|
|
104
|
-
if (conversation?.timer === undefined) return;
|
|
105
|
-
clearTimer(conversation.timer);
|
|
106
|
-
conversation.timer = undefined;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function finishConversation(chatId, conversation) {
|
|
110
|
-
const current = conversations.get(chatId);
|
|
111
|
-
if (current !== conversation) return false;
|
|
112
|
-
clearConversationTimer(current);
|
|
113
|
-
conversations.delete(chatId);
|
|
114
|
-
if (conversations.size === 0) {
|
|
115
|
-
const restored = savedCheckpoint;
|
|
116
|
-
savedCheckpoint = undefined;
|
|
117
|
-
resume(restored);
|
|
118
|
-
}
|
|
119
|
-
return true;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function noteInbound(chatIdValue, text, checkpointValue) {
|
|
123
|
-
const chatId = String(chatIdValue ?? '').trim();
|
|
124
|
-
if (!isPrivateTelegramChat(chatId)) return { resumeGranted: false };
|
|
125
|
-
const existing = conversations.get(chatId);
|
|
126
|
-
if (existing?.waitingPermission === true && isResumeApproval(text)) {
|
|
127
|
-
finishConversation(chatId, existing);
|
|
128
|
-
return { resumeGranted: true };
|
|
129
|
-
}
|
|
130
|
-
const startsConversation = conversations.size === 0;
|
|
131
|
-
if (startsConversation) {
|
|
132
|
-
savedCheckpoint = { ...checkpointValue, chatId };
|
|
133
|
-
}
|
|
134
|
-
const conversation = existing ?? { chatId };
|
|
135
|
-
clearConversationTimer(conversation);
|
|
136
|
-
const wasExplicitPause = conversation.explicitPause === true;
|
|
137
|
-
conversation.explicitPause = conversation.explicitPause === true || isExplicitPauseRequest(text);
|
|
138
|
-
conversation.waitingPermission = conversation.explicitPause;
|
|
139
|
-
conversation.closeAfterReply = isConversationClose(text);
|
|
140
|
-
conversations.set(chatId, conversation);
|
|
141
|
-
savedCheckpoint = {
|
|
142
|
-
...savedCheckpoint,
|
|
143
|
-
explicitPause: conversation.explicitPause,
|
|
144
|
-
resumeAfterAt: null,
|
|
145
|
-
};
|
|
146
|
-
if (startsConversation || wasExplicitPause !== conversation.explicitPause) checkpoint(savedCheckpoint);
|
|
147
|
-
return { resumeGranted: false, explicitPause: conversation.explicitPause };
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
function noteReplyDelivered(chatIdValue) {
|
|
151
|
-
const chatId = String(chatIdValue ?? '').trim();
|
|
152
|
-
const conversation = conversations.get(chatId);
|
|
153
|
-
if (conversation === undefined) return false;
|
|
154
|
-
clearConversationTimer(conversation);
|
|
155
|
-
if (conversation.explicitPause === true) {
|
|
156
|
-
conversation.waitingPermission = true;
|
|
157
|
-
checkpoint({ ...savedCheckpoint, explicitPause: true, resumeAfterAt: null });
|
|
158
|
-
return true;
|
|
159
|
-
}
|
|
160
|
-
const delay = conversation.closeAfterReply ? 0 : silenceMs;
|
|
161
|
-
conversation.closeAfterReply = false;
|
|
162
|
-
const resumeAfterAt = new Date(now() + delay).toISOString();
|
|
163
|
-
savedCheckpoint = { ...savedCheckpoint, explicitPause: false, resumeAfterAt };
|
|
164
|
-
checkpoint(savedCheckpoint);
|
|
165
|
-
conversation.timer = setTimer(() => {
|
|
166
|
-
finishConversation(chatId, conversation);
|
|
167
|
-
}, delay);
|
|
168
|
-
return true;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function dispose() {
|
|
172
|
-
for (const conversation of conversations.values()) clearConversationTimer(conversation);
|
|
173
|
-
conversations.clear();
|
|
174
|
-
savedCheckpoint = undefined;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
const initialCheckpoint = options.initialCheckpoint;
|
|
178
|
-
if (initialCheckpoint?.status === 'paused' && isPrivateTelegramChat(initialCheckpoint.chatId)) {
|
|
179
|
-
const chatId = String(initialCheckpoint.chatId);
|
|
180
|
-
const explicitPause = initialCheckpoint.explicitPause === true;
|
|
181
|
-
const conversation = {
|
|
182
|
-
chatId,
|
|
183
|
-
explicitPause,
|
|
184
|
-
waitingPermission: explicitPause,
|
|
185
|
-
};
|
|
186
|
-
savedCheckpoint = { ...initialCheckpoint, chatId };
|
|
187
|
-
conversations.set(chatId, conversation);
|
|
188
|
-
const resumeAfterMs = Date.parse(String(initialCheckpoint.resumeAfterAt ?? ''));
|
|
189
|
-
if (!explicitPause) {
|
|
190
|
-
const pausedAtMs = Date.parse(String(initialCheckpoint.pausedAt ?? ''));
|
|
191
|
-
const resumeDeadlineMs = Number.isFinite(resumeAfterMs)
|
|
192
|
-
? resumeAfterMs
|
|
193
|
-
: Number.isFinite(pausedAtMs)
|
|
194
|
-
? pausedAtMs + silenceMs
|
|
195
|
-
: now();
|
|
196
|
-
conversation.timer = setTimer(
|
|
197
|
-
() => finishConversation(chatId, conversation),
|
|
198
|
-
Math.max(0, resumeDeadlineMs - now()),
|
|
199
|
-
);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return {
|
|
204
|
-
dispose,
|
|
205
|
-
isPaused: () => conversations.size > 0,
|
|
206
|
-
isWaitingPermission: (chatId) => conversations.get(String(chatId))?.waitingPermission === true,
|
|
207
|
-
noteInbound,
|
|
208
|
-
noteReplyDelivered,
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
function directFocusCheckpointPath(env = process.env) {
|
|
213
|
-
const home = String(env.BLUN_HOME ?? '').trim() || path.join(os.homedir(), '.blun');
|
|
214
|
-
return path.join(home, 'channels', 'telegram', 'direct-focus-checkpoint.json');
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
function writeDirectFocusCheckpoint(value, env = process.env) {
|
|
218
|
-
const target = directFocusCheckpointPath(env);
|
|
219
|
-
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
220
|
-
const record = {
|
|
221
|
-
version: 1,
|
|
222
|
-
status: value?.status === 'resumed' ? 'resumed' : 'paused',
|
|
223
|
-
pausedAt: Number.isFinite(Date.parse(String(value?.pausedAt ?? '')))
|
|
224
|
-
? new Date(value.pausedAt).toISOString()
|
|
225
|
-
: new Date().toISOString(),
|
|
226
|
-
explicitPause: value?.explicitPause === true,
|
|
227
|
-
resumeAfterAt: Number.isFinite(Date.parse(String(value?.resumeAfterAt ?? '')))
|
|
228
|
-
? new Date(value.resumeAfterAt).toISOString()
|
|
229
|
-
: null,
|
|
230
|
-
chatId: isPrivateTelegramChat(value?.chatId) ? String(value.chatId) : null,
|
|
231
|
-
sessionId: value?.sessionId === undefined ? null : String(value.sessionId).slice(0, 160),
|
|
232
|
-
turnId: value?.turnId === undefined ? null : String(value.turnId),
|
|
233
|
-
step: Number.isInteger(value?.step) ? value.step : 0,
|
|
234
|
-
agentId: String(value?.agentId ?? 'main').slice(0, 120),
|
|
235
|
-
queueDepth: Number.isInteger(value?.queueDepth) ? value.queueDepth : 0,
|
|
236
|
-
workDir: String(value?.workDir ?? '').slice(0, 2048),
|
|
237
|
-
};
|
|
238
|
-
const temporary = `${target}.tmp-${process.pid}-${Date.now()}`;
|
|
239
|
-
fs.writeFileSync(temporary, `${JSON.stringify(record, null, 2)}\n`, { encoding: 'utf8', mode: 0o600 });
|
|
240
|
-
fs.renameSync(temporary, target);
|
|
241
|
-
return { path: target, record };
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
function readDirectFocusCheckpoint(env = process.env) {
|
|
245
|
-
const target = directFocusCheckpointPath(env);
|
|
246
|
-
try {
|
|
247
|
-
const record = JSON.parse(fs.readFileSync(target, 'utf8'));
|
|
248
|
-
if (record?.version !== 1 || (record.status !== 'paused' && record.status !== 'resumed')) return undefined;
|
|
249
|
-
return record;
|
|
250
|
-
} catch (error) {
|
|
251
|
-
if (error?.code === 'ENOENT') return undefined;
|
|
252
|
-
throw error;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
module.exports = {
|
|
257
|
-
DEFAULT_SILENCE_MS,
|
|
258
|
-
createDirectFocusController,
|
|
259
|
-
createDirectReplyTurnStop,
|
|
260
|
-
directMessageAllowsWorkContinuation,
|
|
261
|
-
directMessageStartsOrResumesWork,
|
|
262
|
-
directTelegramPayloadText,
|
|
263
|
-
directFocusCheckpointPath,
|
|
264
|
-
enqueueTelegramDirect,
|
|
265
|
-
isConversationClose,
|
|
266
|
-
isExplicitPauseRequest,
|
|
267
|
-
isPrivateTelegramChat,
|
|
268
|
-
isResumeApproval,
|
|
269
|
-
readDirectFocusCheckpoint,
|
|
270
|
-
rewriteTelegramDirectEnvelope,
|
|
271
|
-
telegramDirectMessage,
|
|
272
|
-
writeDirectFocusCheckpoint,
|
|
273
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const fs = require('node:fs');
|
|
3
|
-
const path = require('node:path');
|
|
4
|
-
const { createHash } = require('node:crypto');
|
|
5
|
-
const REPAIRS = {
|
|
6
|
-
fa511cd1e2a0a911aafa100d7a41b3ebd0abd0599c3e2e66daca1c8421298573: {
|
|
7
|
-
file: 'compat/mcp-server-fa511cd1.mjs', sha256: '0d2d078722245e1e559ea146ba5139d999f9ec1f3d4f21ce2dc6d68f6783d0a9',
|
|
8
|
-
},
|
|
9
|
-
'4ed83af87c8d4d89b1f21172aeabfd609bd7772242a9f7d046685acdd24d316c': {
|
|
10
|
-
file: 'dist/mcp-server.mjs', sha256: 'fa9ab7a79a0a98dad505d761f5e1e20a8f72ae640f67b0e9151bcce2bccd0998',
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
function fileHash(file) {
|
|
14
|
-
const info = fs.lstatSync(file);
|
|
15
|
-
if (!info.isFile() || info.size > 3 * 1024 * 1024) return null;
|
|
16
|
-
return createHash('sha256').update(fs.readFileSync(file)).digest('hex');
|
|
17
|
-
}
|
|
18
|
-
function resolveKnownTelegramMcp(selected, { explicitOverride = false } = {}) {
|
|
19
|
-
if (explicitOverride) return selected;
|
|
20
|
-
try {
|
|
21
|
-
const repair = REPAIRS[fileHash(selected)];
|
|
22
|
-
if (!repair) return selected;
|
|
23
|
-
const replacement = path.join(__dirname, '..', 'telegram-plugin', repair.file);
|
|
24
|
-
// Never replace unknown/custom code or launch a damaged compatibility payload.
|
|
25
|
-
return fileHash(replacement) === repair.sha256 ? replacement : selected;
|
|
26
|
-
} catch {
|
|
27
|
-
return selected;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
function repairKnownTelegramPluginConfig(entry, { recipientName = '' } = {}) {
|
|
31
|
-
const config = entry.config;
|
|
32
|
-
if (entry.pluginId !== 'telegram' || entry.serverName !== 'telegram' || config?.transport !== 'stdio') return config;
|
|
33
|
-
if (process.env.BLUN_TELEGRAM_MCP_SERVER) return config;
|
|
34
|
-
const args = config.args;
|
|
35
|
-
if (!Array.isArray(args) || typeof config.cwd !== 'string') return config;
|
|
36
|
-
const native = args.length === 2 && args[0] === '__plugin_run_node';
|
|
37
|
-
if (!native && !(args.length === 1 && /^node(?:\.exe)?$/iu.test(path.basename(config.command || '')))) return config;
|
|
38
|
-
const index = native ? 1 : 0;
|
|
39
|
-
if (typeof args[index] !== 'string') return config;
|
|
40
|
-
const selected = path.resolve(config.cwd, args[index]);
|
|
41
|
-
const replacement = resolveKnownTelegramMcp(selected);
|
|
42
|
-
if (selected === replacement) return config;
|
|
43
|
-
return { ...config, args: args.map((value, i) => i === index ? replacement : value), env: {
|
|
44
|
-
...config.env,
|
|
45
|
-
BLUN_TELEGRAM_PERSONA_NAME: typeof recipientName === 'string' ? recipientName : '',
|
|
46
|
-
...(native ? { BLUN_PLUGIN_ROOT: path.dirname(path.dirname(replacement)) } : {}),
|
|
47
|
-
} };
|
|
48
|
-
}
|
|
49
|
-
module.exports = { resolveKnownTelegramMcp, repairKnownTelegramPluginConfig };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const DEFAULT_RETRY_DELAYS_MS = Object.freeze([0, 750, 2_500]);
|
|
4
|
-
|
|
5
|
-
function retryableTelegramMediaFailure(status, description = '') {
|
|
6
|
-
if (!Number.isInteger(status)) return true;
|
|
7
|
-
if ([408, 409, 425, 429].includes(status) || status >= 500) return true;
|
|
8
|
-
return /(?:flood|retry|temporar|timeout|too many requests)/i.test(String(description));
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
async function retryTelegramMediaDelivery(sendAttempt, options = {}) {
|
|
12
|
-
const delays = options.delays ?? DEFAULT_RETRY_DELAYS_MS;
|
|
13
|
-
const wait = options.wait ?? ((milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds)));
|
|
14
|
-
let lastResult = { ok: false, retryable: true };
|
|
15
|
-
|
|
16
|
-
for (let index = 0; index < delays.length; index += 1) {
|
|
17
|
-
const delay = delays[index];
|
|
18
|
-
if (delay > 0) await wait(delay);
|
|
19
|
-
|
|
20
|
-
try {
|
|
21
|
-
lastResult = await sendAttempt(index + 1);
|
|
22
|
-
} catch (error) {
|
|
23
|
-
lastResult = {
|
|
24
|
-
ok: false,
|
|
25
|
-
retryable: true,
|
|
26
|
-
description: error instanceof Error ? error.message : String(error),
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (lastResult.ok === true || lastResult.retryable !== true) {
|
|
31
|
-
return { ...lastResult, attempts: index + 1 };
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return { ...lastResult, attempts: delays.length };
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
module.exports = {
|
|
39
|
-
DEFAULT_RETRY_DELAYS_MS,
|
|
40
|
-
retryableTelegramMediaFailure,
|
|
41
|
-
retryTelegramMediaDelivery,
|
|
42
|
-
};
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const { closeSync, openSync, readSync, statSync } = require('node:fs');
|
|
4
|
-
|
|
5
|
-
const PRIVATE_CHAT_ID = /^[1-9]\d*$/u;
|
|
6
|
-
const WORK_PERMISSION_QUESTION = /^(?:kann|darf|soll) ich\b.{0,100}\b(?:arbeit(?:en)?|weiterarbeiten|weitermachen|fortfahren|weiterbauen|umbau|bau)\b/u;
|
|
7
|
-
const TRAILING_WORK_PERMISSION_QUESTION = /(?:^|\r?\n\s*\r?\n)(?:kann|darf|soll)\s+ich\b[^\r\n]{0,160}\b(?:arbeit(?:en)?|weiterarbeiten|weitermachen|fortfahren|weiterbauen|umbau|bau)\b[^\r\n]*$/iu;
|
|
8
|
-
const INTERNAL_CONTROL_MARKER = /\b(?:cron|loop|checkpoint|handoff|resume|session|sha|tool|werkzeug|hook|queue|lane|inbound|outbound|arbeitsstand|arbeitsauftrag|bau freigabe|freigabe dieser lane|turn|zug|status|private nachricht|telegram nachricht|reply|verlauf|basis|qa gate|wartezustand|f\d+|m\d+|w\d+)\b/gu;
|
|
9
|
-
const NO_USER_VALUE = /\b(?:keine neue aktion|keine neue information|keine neue nachricht|kein neuer auftrag|kein neuer zweck|kein neuer inbound bedarf|kein offener handlungsbedarf|nichts neues zu melden|nichts zu melden|bleibt pausiert|warte auf (?:dein|sein|ihr|papas) (?:zeichen|go|freigabe|antwort)|ich warte|ich sende nichts|wiederholen wäre spam|keine weitere nachricht|bereits geantwortet|bereits gesendet|kein werkzeugaufruf nötig|stand unverändert|zug läuft seit|kein bau ohne|qa gate steht noch aus|wartezustand)\b/u;
|
|
10
|
-
const EMPTY_COMPLETION_STATUS = /^(?:(?:status|arbeitsstand|checkpoint)\s+)?(?:fertig\s+)?nichts weiteres(?:\s+(?:offen|zu melden|zu tun))?$/u;
|
|
11
|
-
|
|
12
|
-
const MEDIA_PROGRESS_MARKER = /\b(?:bildgenerierung|bildjob|generateimage|getmedia|media job|medienjob)\b/u;
|
|
13
|
-
const MEDIA_PENDING_STATE = /\b(?:auftrag wurde angenommen|job wurde angenommen|job angenommen|aufruf wurde abgesetzt|angestossen|angestoßen|processing|verarbeitung)\b/u;
|
|
14
|
-
const MEDIA_NO_RESULT = /\b(?:kein neues bild|noch kein bild|kein bild liefern|nichts angekommen|nichts neues gelandet|nicht verfuegbar|nicht verfügbar|getmedia fehlt)\b/u;
|
|
15
|
-
|
|
16
|
-
const DUPLICATE_LOG_TAIL_BYTES = 512 * 1024;
|
|
17
|
-
const DUPLICATE_MAX_AGE_MS = 24 * 60 * 60 * 1000;
|
|
18
|
-
const NEAR_DUPLICATE_MIN_CHARS = 120;
|
|
19
|
-
const NEAR_DUPLICATE_SIMILARITY = 0.88;
|
|
20
|
-
const SUCCESSFUL_REPLY_KINDS = new Set(['reply', 'reply-fallback']);
|
|
21
|
-
|
|
22
|
-
function normalize(text) {
|
|
23
|
-
return String(text ?? '')
|
|
24
|
-
.normalize('NFKC')
|
|
25
|
-
.toLocaleLowerCase('de-DE')
|
|
26
|
-
.replace(/[^\p{L}\p{N}\s]/gu, ' ')
|
|
27
|
-
.replace(/\s+/gu, ' ')
|
|
28
|
-
.trim();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function readJsonlTail(file, maxBytes = DUPLICATE_LOG_TAIL_BYTES) {
|
|
32
|
-
try {
|
|
33
|
-
const size = statSync(file).size;
|
|
34
|
-
if (size <= 0) return [];
|
|
35
|
-
const start = Math.max(0, size - maxBytes);
|
|
36
|
-
const length = size - start;
|
|
37
|
-
const buffer = Buffer.allocUnsafe(length);
|
|
38
|
-
const descriptor = openSync(file, 'r');
|
|
39
|
-
let bytesRead = 0;
|
|
40
|
-
try {
|
|
41
|
-
while (bytesRead < length) {
|
|
42
|
-
const count = readSync(descriptor, buffer, bytesRead, length - bytesRead, start + bytesRead);
|
|
43
|
-
if (count === 0) break;
|
|
44
|
-
bytesRead += count;
|
|
45
|
-
}
|
|
46
|
-
} finally {
|
|
47
|
-
closeSync(descriptor);
|
|
48
|
-
}
|
|
49
|
-
let raw = buffer.subarray(0, bytesRead).toString('utf8');
|
|
50
|
-
if (start > 0) {
|
|
51
|
-
const firstNewline = raw.indexOf('\n');
|
|
52
|
-
raw = firstNewline < 0 ? '' : raw.slice(firstNewline + 1);
|
|
53
|
-
}
|
|
54
|
-
return raw.split(/\r?\n/u).flatMap((line) => {
|
|
55
|
-
if (line.trim().length === 0) return [];
|
|
56
|
-
try {
|
|
57
|
-
const entry = JSON.parse(line);
|
|
58
|
-
return typeof entry === 'object' && entry !== null ? [entry] : [];
|
|
59
|
-
} catch {
|
|
60
|
-
return [];
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
} catch {
|
|
64
|
-
return [];
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function normalizedTokens(text) {
|
|
69
|
-
return normalize(text).match(/[\p{L}\p{N}_]+/gu) ?? [];
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function tokenBigrams(tokens) {
|
|
73
|
-
const bigrams = [];
|
|
74
|
-
for (let index = 0; index + 1 < tokens.length; index += 1) {
|
|
75
|
-
bigrams.push(`${tokens[index]}\u0000${tokens[index + 1]}`);
|
|
76
|
-
}
|
|
77
|
-
return bigrams;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function diceSimilarity(leftItems, rightItems) {
|
|
81
|
-
const left = new Set(leftItems);
|
|
82
|
-
const right = new Set(rightItems);
|
|
83
|
-
if (left.size === 0 || right.size === 0) return 0;
|
|
84
|
-
let intersection = 0;
|
|
85
|
-
for (const item of left) {
|
|
86
|
-
if (right.has(item)) intersection += 1;
|
|
87
|
-
}
|
|
88
|
-
return (2 * intersection) / (left.size + right.size);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function outboundReplySimilarity(left, right) {
|
|
92
|
-
const leftNormalized = normalize(left);
|
|
93
|
-
const rightNormalized = normalize(right);
|
|
94
|
-
if (leftNormalized.length === 0 || rightNormalized.length === 0) return 0;
|
|
95
|
-
if (leftNormalized === rightNormalized) return 1;
|
|
96
|
-
if (leftNormalized.length < NEAR_DUPLICATE_MIN_CHARS || rightNormalized.length < NEAR_DUPLICATE_MIN_CHARS) return 0;
|
|
97
|
-
const leftTokens = normalizedTokens(leftNormalized);
|
|
98
|
-
const rightTokens = normalizedTokens(rightNormalized);
|
|
99
|
-
if (leftTokens.length < 12 || rightTokens.length < 12) return 0;
|
|
100
|
-
const tokenScore = diceSimilarity(leftTokens, rightTokens);
|
|
101
|
-
const bigramScore = diceSimilarity(tokenBigrams(leftTokens), tokenBigrams(rightTokens));
|
|
102
|
-
return (tokenScore + bigramScore) / 2;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function entryTime(entry) {
|
|
106
|
-
const raw = entry?.ts ?? entry?.meta?.timestamp;
|
|
107
|
-
const value = Date.parse(String(raw ?? ''));
|
|
108
|
-
return Number.isFinite(value) ? value : Number.NEGATIVE_INFINITY;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function entryChatId(entry) {
|
|
112
|
-
return String(entry?.chat_id ?? entry?.meta?.chat_id ?? '');
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function findDuplicateReplyWithoutNewInbound({
|
|
116
|
-
chatId,
|
|
117
|
-
inboundFile,
|
|
118
|
-
now = Date.now(),
|
|
119
|
-
outboxFile,
|
|
120
|
-
text,
|
|
121
|
-
}) {
|
|
122
|
-
const wantedChat = String(chatId ?? '').trim();
|
|
123
|
-
const candidate = String(text ?? '').trim();
|
|
124
|
-
if (wantedChat.length === 0 || candidate.length === 0) return null;
|
|
125
|
-
|
|
126
|
-
const outbound = readJsonlTail(outboxFile).filter((entry) => (
|
|
127
|
-
SUCCESSFUL_REPLY_KINDS.has(entry.kind)
|
|
128
|
-
&& entryChatId(entry) === wantedChat
|
|
129
|
-
&& typeof entry.text === 'string'
|
|
130
|
-
));
|
|
131
|
-
if (outbound.length === 0) return null;
|
|
132
|
-
const latestOutboundAt = Math.max(...outbound.map(entryTime));
|
|
133
|
-
if (!Number.isFinite(latestOutboundAt)) return null;
|
|
134
|
-
|
|
135
|
-
const inboundTimes = readJsonlTail(inboundFile)
|
|
136
|
-
.filter((entry) => entryChatId(entry) === wantedChat)
|
|
137
|
-
.map(entryTime)
|
|
138
|
-
.filter(Number.isFinite);
|
|
139
|
-
if (inboundTimes.length === 0) return null;
|
|
140
|
-
if (Math.max(...inboundTimes) > latestOutboundAt) return null;
|
|
141
|
-
|
|
142
|
-
const cutoff = Number(now) - DUPLICATE_MAX_AGE_MS;
|
|
143
|
-
for (let index = outbound.length - 1; index >= 0; index -= 1) {
|
|
144
|
-
const previous = outbound[index];
|
|
145
|
-
const previousAt = entryTime(previous);
|
|
146
|
-
if (previousAt < cutoff || previousAt > Number(now)) continue;
|
|
147
|
-
const similarity = outboundReplySimilarity(previous.text, candidate);
|
|
148
|
-
if (similarity < NEAR_DUPLICATE_SIMILARITY) continue;
|
|
149
|
-
return {
|
|
150
|
-
kind: previous.kind,
|
|
151
|
-
similarity,
|
|
152
|
-
ts: previous.ts,
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
return null;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
function sanitizePrivateConversationReply(chatId, text) {
|
|
159
|
-
const value = String(text ?? '');
|
|
160
|
-
if (!PRIVATE_CHAT_ID.test(String(chatId ?? '').trim())) return value;
|
|
161
|
-
return value.replace(TRAILING_WORK_PERMISSION_QUESTION, '').trim();
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function isPrivateInternalStatusReply(chatId, text) {
|
|
165
|
-
if (!PRIVATE_CHAT_ID.test(String(chatId ?? '').trim())) return false;
|
|
166
|
-
const sanitized = sanitizePrivateConversationReply(chatId, text);
|
|
167
|
-
const value = normalize(sanitized.length === 0 ? text : sanitized);
|
|
168
|
-
if (value.length === 0) return false;
|
|
169
|
-
if (sanitized.length === 0 && WORK_PERMISSION_QUESTION.test(value)) return true;
|
|
170
|
-
if (MEDIA_PROGRESS_MARKER.test(value) && MEDIA_PENDING_STATE.test(value) && MEDIA_NO_RESULT.test(value)) return true;
|
|
171
|
-
|
|
172
|
-
const internalMarkers = value.match(INTERNAL_CONTROL_MARKER) ?? [];
|
|
173
|
-
return internalMarkers.length > 0 && (NO_USER_VALUE.test(value) || EMPTY_COMPLETION_STATUS.test(value));
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
module.exports = {
|
|
177
|
-
DUPLICATE_LOG_TAIL_BYTES,
|
|
178
|
-
DUPLICATE_MAX_AGE_MS,
|
|
179
|
-
NEAR_DUPLICATE_MIN_CHARS,
|
|
180
|
-
NEAR_DUPLICATE_SIMILARITY,
|
|
181
|
-
findDuplicateReplyWithoutNewInbound,
|
|
182
|
-
isPrivateInternalStatusReply,
|
|
183
|
-
outboundReplySimilarity,
|
|
184
|
-
sanitizePrivateConversationReply,
|
|
185
|
-
};
|