@a1hvdy/cc-openclaw 0.26.5 → 0.27.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/dist/src/channels/adapter.js +0 -1
- package/dist/src/channels/telegram-mirror/askuser.js +21 -8
- package/dist/src/channels/telegram-mirror/burst-accumulator.js +0 -1
- package/dist/src/channels/telegram-mirror/callback-mapping.js +0 -1
- package/dist/src/channels/telegram-mirror/card-renderer.js +113 -21
- package/dist/src/channels/telegram-mirror/card-state.js +0 -1
- package/dist/src/channels/telegram-mirror/commands.js +0 -1
- package/dist/src/channels/telegram-mirror/compose-buffer.js +0 -1
- package/dist/src/channels/telegram-mirror/cost-views.js +0 -1
- package/dist/src/channels/telegram-mirror/failure/callback-data-overflow.js +0 -1
- package/dist/src/channels/telegram-mirror/failure/gateway-down.js +0 -1
- package/dist/src/channels/telegram-mirror/failure/in-flight-conflict.js +0 -1
- package/dist/src/channels/telegram-mirror/failure/index.js +0 -1
- package/dist/src/channels/telegram-mirror/failure/model-5xx.js +0 -1
- package/dist/src/channels/telegram-mirror/failure/network-blip.js +0 -1
- package/dist/src/channels/telegram-mirror/failure/pool-exhausted-fallback.js +0 -1
- package/dist/src/channels/telegram-mirror/failure/rate-limit.js +0 -1
- package/dist/src/channels/telegram-mirror/failure/returning-after-24h.js +0 -1
- package/dist/src/channels/telegram-mirror/failure/types.js +0 -1
- package/dist/src/channels/telegram-mirror/inbound-handler.js +0 -1
- package/dist/src/channels/telegram-mirror/index.js +0 -1
- package/dist/src/channels/telegram-mirror/plan-attachment.js +0 -1
- package/dist/src/channels/telegram-mirror/quota-reader.js +0 -1
- package/dist/src/channels/telegram-mirror/sessions-keyboard.js +0 -1
- package/dist/src/channels/telegram-mirror/soak-log.js +0 -1
- package/dist/src/channels/telegram-mirror/state-machine.d.ts +12 -2
- package/dist/src/channels/telegram-mirror/state-machine.js +36 -2
- package/dist/src/channels/telegram-mirror/status-line.js +0 -1
- package/dist/src/channels/telegram-mirror/sync-commands.js +0 -1
- package/dist/src/channels/telegram-mirror/threshold-watcher.js +0 -1
- package/dist/src/channels/telegram-mirror/turn-bridge.d.ts +17 -0
- package/dist/src/channels/telegram-mirror/turn-bridge.js +70 -2
- package/dist/src/cli/checks/bridge-wiring.js +0 -1
- package/dist/src/cli/checks/config-schema.js +0 -1
- package/dist/src/cli/checks/critical-openclaw-json-keys.js +0 -1
- package/dist/src/cli/checks/install-path.js +0 -1
- package/dist/src/cli/checks/patch-scaffold.js +0 -1
- package/dist/src/cli/doctor.js +0 -1
- package/dist/src/cli/index.js +0 -1
- package/dist/src/cli/migrate.js +0 -1
- package/dist/src/command-router/cc-handler.js +0 -1
- package/dist/src/command-router/index.js +0 -1
- package/dist/src/command-router/launch-policy.js +0 -1
- package/dist/src/command-router/resume-policy.js +0 -1
- package/dist/src/command-router/turn-formatter.js +0 -1
- package/dist/src/config/drift-detector.js +0 -1
- package/dist/src/config/loader.js +0 -1
- package/dist/src/config/schema.js +0 -1
- package/dist/src/constants.js +0 -1
- package/dist/src/council/build-agent-prompt.js +0 -1
- package/dist/src/council/cleanup-worktrees.js +0 -1
- package/dist/src/council/consensus.js +0 -1
- package/dist/src/council/council.js +0 -1
- package/dist/src/council/index.js +0 -1
- package/dist/src/council/system-prompt.js +0 -1
- package/dist/src/council/write-worktree-claude-md.js +0 -1
- package/dist/src/engines/base-oneshot-session.js +0 -1
- package/dist/src/engines/heartbeat-guard.js +0 -1
- package/dist/src/engines/index.js +0 -1
- package/dist/src/engines/persistent-codex-session.js +0 -1
- package/dist/src/engines/persistent-cursor-session.js +0 -1
- package/dist/src/engines/persistent-custom-session.js +0 -1
- package/dist/src/engines/persistent-gemini-session.js +0 -1
- package/dist/src/engines/persistent-session.js +30 -1
- package/dist/src/engines/resolve-bin.js +0 -1
- package/dist/src/engines/subprocess-pool.js +0 -1
- package/dist/src/health/handler.js +0 -1
- package/dist/src/health/index.js +0 -1
- package/dist/src/health/metrics.js +0 -1
- package/dist/src/index.js +0 -1
- package/dist/src/lib/auto-recovery.js +0 -1
- package/dist/src/lib/cache-parity.js +0 -1
- package/dist/src/lib/circuit-breaker.js +0 -1
- package/dist/src/lib/config-service.js +0 -1
- package/dist/src/lib/config.js +0 -1
- package/dist/src/lib/cost-rollup.js +0 -1
- package/dist/src/lib/debounce.js +0 -1
- package/dist/src/lib/debug-tap.js +0 -1
- package/dist/src/lib/domain-error.js +0 -1
- package/dist/src/lib/drift-detector.js +0 -1
- package/dist/src/lib/env-overrides.js +0 -1
- package/dist/src/lib/error-formatter.js +0 -1
- package/dist/src/lib/error-renderer.js +0 -1
- package/dist/src/lib/heartbeat-config.js +0 -1
- package/dist/src/lib/heartbeat-workaround.js +0 -1
- package/dist/src/lib/html-render.d.ts +43 -0
- package/dist/src/lib/html-render.js +110 -0
- package/dist/src/lib/http-agent.js +0 -1
- package/dist/src/lib/index.js +0 -1
- package/dist/src/lib/json-array.js +0 -1
- package/dist/src/lib/markdown-to-mdv2.js +0 -1
- package/dist/src/lib/markdown-v2.js +0 -1
- package/dist/src/lib/perf/async-compact.js +0 -1
- package/dist/src/lib/perf/direct-sdk.js +0 -1
- package/dist/src/lib/perf/haiku-route.js +0 -1
- package/dist/src/lib/perf/predictive-continuation.js +0 -1
- package/dist/src/lib/perf/read-batch.js +0 -1
- package/dist/src/lib/perf/skill-list-collapse.js +0 -1
- package/dist/src/lib/perf/speculative-bubble.js +0 -1
- package/dist/src/lib/perf/typing-prefetch.js +0 -1
- package/dist/src/lib/register-guard.js +0 -1
- package/dist/src/lib/req-shape-log.js +0 -1
- package/dist/src/lib/safe-upstream-probes.js +0 -1
- package/dist/src/lib/session-registry.js +0 -1
- package/dist/src/lib/spawn-async.js +0 -1
- package/dist/src/lib/stale-pid-files.js +0 -1
- package/dist/src/lib/status-tee-reader.js +0 -1
- package/dist/src/lib/sysprompt-strip.js +0 -1
- package/dist/src/lib/telegram-bot-api.js +2 -3
- package/dist/src/lib/telemetry.js +0 -1
- package/dist/src/lib/test-mode.js +0 -1
- package/dist/src/lib/trajectory.js +0 -1
- package/dist/src/lib/vendor-paths.js +0 -1
- package/dist/src/lifecycle/boot.js +0 -1
- package/dist/src/lifecycle/patch-manifest.js +0 -1
- package/dist/src/lifecycle/phase-import-upstream.js +0 -1
- package/dist/src/lifecycle/phase-install-patches.js +0 -1
- package/dist/src/lifecycle/phase-schedule-jobs.js +0 -1
- package/dist/src/lifecycle/phase-start-server.js +0 -1
- package/dist/src/lifecycle/phase-validate-config.js +0 -1
- package/dist/src/lifecycle/phase-validate-upstream.js +0 -1
- package/dist/src/lifecycle/phase-wire-handlers.js +0 -1
- package/dist/src/lifecycle/safe-restart.js +0 -1
- package/dist/src/logger.js +0 -1
- package/dist/src/mcp/bridge.js +0 -1
- package/dist/src/mcp/index.js +0 -1
- package/dist/src/models.js +0 -1
- package/dist/src/observability/event-bus.js +0 -1
- package/dist/src/observability/get-event-bus.js +0 -1
- package/dist/src/observability/observability-service.js +0 -1
- package/dist/src/observability/perf-telemetry.js +0 -1
- package/dist/src/observability/subscribers/metrics.js +0 -1
- package/dist/src/observability/subscribers/session-capture.js +0 -1
- package/dist/src/openai-compat/bridges/allowlist.js +0 -1
- package/dist/src/openai-compat/bridges/factory.js +0 -1
- package/dist/src/openai-compat/bridges/media-bridge.js +0 -1
- package/dist/src/openai-compat/bridges/openclaw-api-shim.js +0 -1
- package/dist/src/openai-compat/bridges/openclaw-native-tools.js +0 -1
- package/dist/src/openai-compat/bridges/openclaw-tool-registry.js +0 -1
- package/dist/src/openai-compat/bridges/tts-media-bridge.js +0 -1
- package/dist/src/openai-compat/cli-stream-parser.js +0 -1
- package/dist/src/openai-compat/index.js +0 -1
- package/dist/src/openai-compat/message-extractor.js +0 -1
- package/dist/src/openai-compat/mode-flags.js +0 -1
- package/dist/src/openai-compat/non-streaming-handler.js +13 -3
- package/dist/src/openai-compat/openai-chunk-types.js +0 -1
- package/dist/src/openai-compat/openai-compat.js +0 -1
- package/dist/src/openai-compat/openai-types.js +0 -1
- package/dist/src/openai-compat/parse-route-body.js +0 -1
- package/dist/src/openai-compat/prompts.js +0 -1
- package/dist/src/openai-compat/response-formatter.js +0 -1
- package/dist/src/openai-compat/session-key-resolver.js +0 -1
- package/dist/src/openai-compat/skill-resolver.js +0 -1
- package/dist/src/openai-compat/sse-translator.js +0 -1
- package/dist/src/openai-compat/status-reporter.js +0 -1
- package/dist/src/openai-compat/streaming-handler.js +16 -3
- package/dist/src/openai-compat/tool-calls-parser.js +0 -1
- package/dist/src/openai-compat/tool-results-serializer.js +0 -1
- package/dist/src/openai-compat/tts-rule.js +0 -1
- package/dist/src/openai-compat/voice-recovery.js +0 -1
- package/dist/src/patches/cache-parity-registry.js +0 -1
- package/dist/src/patches/claude-md-injection.js +0 -1
- package/dist/src/patches/cwd-redirect.js +0 -1
- package/dist/src/patches/embedded-server-route.js +0 -1
- package/dist/src/patches/pricing-overrides.js +0 -1
- package/dist/src/patches/resume-registry-restore.js +0 -1
- package/dist/src/patches/session-pid-tracking.js +0 -1
- package/dist/src/patches/sysprompt-strip.js +0 -1
- package/dist/src/patches/tools-restoration.js +0 -1
- package/dist/src/persistence/migration-v0.js +0 -1
- package/dist/src/persistence/session-registry.js +0 -1
- package/dist/src/persistence/snapshot.js +0 -1
- package/dist/src/persistence/wal.js +0 -1
- package/dist/src/proxy/anthropic-adapter.js +0 -1
- package/dist/src/proxy/handler.js +0 -1
- package/dist/src/proxy/index.js +0 -1
- package/dist/src/proxy/schema-cleaner.js +0 -1
- package/dist/src/proxy/thought-cache.js +0 -1
- package/dist/src/session/embedded-server.js +0 -1
- package/dist/src/session/inbox-manager.js +0 -1
- package/dist/src/session/index.js +0 -1
- package/dist/src/session/persisted-sessions.js +0 -1
- package/dist/src/session/session-manager.js +0 -1
- package/dist/src/session/watchdogs.js +0 -1
- package/dist/src/session-bootstrap/boot-self-heal.js +0 -1
- package/dist/src/session-bootstrap/cwd-patch.js +0 -1
- package/dist/src/session-bootstrap/index.js +0 -1
- package/dist/src/session-bootstrap/resume-registry.js +0 -1
- package/dist/src/session-bootstrap/session-hygiene.js +0 -1
- package/dist/src/session-bootstrap/sysprompt-strip.js +0 -1
- package/dist/src/session-bootstrap/think-conflict-resolver.js +0 -1
- package/dist/src/types/index.js +0 -1
- package/dist/src/types/route.js +0 -1
- package/dist/src/types/runtime-config.js +0 -1
- package/dist/src/types/session.js +0 -1
- package/dist/src/types/sse.js +0 -1
- package/dist/src/types/tool-bridge.js +0 -1
- package/dist/src/types/upstream.js +0 -1
- package/dist/src/types.js +0 -1
- package/dist/src/validation.js +0 -1
- package/package.json +1 -1
- package/dist/src/channels/adapter.js.map +0 -1
- package/dist/src/channels/telegram/card-renderer.d.ts +0 -80
- package/dist/src/channels/telegram/card-renderer.js +0 -169
- package/dist/src/channels/telegram/card-renderer.js.map +0 -1
- package/dist/src/channels/telegram/completion-summary.d.ts +0 -21
- package/dist/src/channels/telegram/completion-summary.js +0 -218
- package/dist/src/channels/telegram/completion-summary.js.map +0 -1
- package/dist/src/channels/telegram/edit-cadence.d.ts +0 -37
- package/dist/src/channels/telegram/edit-cadence.js +0 -50
- package/dist/src/channels/telegram/edit-cadence.js.map +0 -1
- package/dist/src/channels/telegram/error-renderer.d.ts +0 -29
- package/dist/src/channels/telegram/error-renderer.js +0 -133
- package/dist/src/channels/telegram/error-renderer.js.map +0 -1
- package/dist/src/channels/telegram/event-reducer.d.ts +0 -33
- package/dist/src/channels/telegram/event-reducer.js +0 -647
- package/dist/src/channels/telegram/event-reducer.js.map +0 -1
- package/dist/src/channels/telegram/format-helpers.d.ts +0 -20
- package/dist/src/channels/telegram/format-helpers.js +0 -34
- package/dist/src/channels/telegram/format-helpers.js.map +0 -1
- package/dist/src/channels/telegram/index.d.ts +0 -13
- package/dist/src/channels/telegram/index.js +0 -14
- package/dist/src/channels/telegram/index.js.map +0 -1
- package/dist/src/channels/telegram/injector.d.ts +0 -53
- package/dist/src/channels/telegram/injector.js +0 -271
- package/dist/src/channels/telegram/injector.js.map +0 -1
- package/dist/src/channels/telegram/insight-formatter.d.ts +0 -36
- package/dist/src/channels/telegram/insight-formatter.js +0 -36
- package/dist/src/channels/telegram/insight-formatter.js.map +0 -1
- package/dist/src/channels/telegram/live-card.d.ts +0 -185
- package/dist/src/channels/telegram/live-card.js +0 -868
- package/dist/src/channels/telegram/live-card.js.map +0 -1
- package/dist/src/channels/telegram/logger.d.ts +0 -10
- package/dist/src/channels/telegram/logger.js +0 -13
- package/dist/src/channels/telegram/logger.js.map +0 -1
- package/dist/src/channels/telegram/result-preview.d.ts +0 -12
- package/dist/src/channels/telegram/result-preview.js +0 -48
- package/dist/src/channels/telegram/result-preview.js.map +0 -1
- package/dist/src/channels/telegram/speculative-bubble.d.ts +0 -33
- package/dist/src/channels/telegram/speculative-bubble.js +0 -42
- package/dist/src/channels/telegram/speculative-bubble.js.map +0 -1
- package/dist/src/channels/telegram/state-machine.d.ts +0 -22
- package/dist/src/channels/telegram/state-machine.js +0 -72
- package/dist/src/channels/telegram/state-machine.js.map +0 -1
- package/dist/src/channels/telegram/throttle-controller.d.ts +0 -88
- package/dist/src/channels/telegram/throttle-controller.js +0 -203
- package/dist/src/channels/telegram/throttle-controller.js.map +0 -1
- package/dist/src/channels/telegram/tool-tracker.d.ts +0 -149
- package/dist/src/channels/telegram/tool-tracker.js +0 -578
- package/dist/src/channels/telegram/tool-tracker.js.map +0 -1
- package/dist/src/channels/telegram-mirror/askuser.js.map +0 -1
- package/dist/src/channels/telegram-mirror/burst-accumulator.js.map +0 -1
- package/dist/src/channels/telegram-mirror/callback-mapping.js.map +0 -1
- package/dist/src/channels/telegram-mirror/card-renderer.js.map +0 -1
- package/dist/src/channels/telegram-mirror/card-state.js.map +0 -1
- package/dist/src/channels/telegram-mirror/commands.js.map +0 -1
- package/dist/src/channels/telegram-mirror/compose-buffer.js.map +0 -1
- package/dist/src/channels/telegram-mirror/cost-views.js.map +0 -1
- package/dist/src/channels/telegram-mirror/failure/callback-data-overflow.js.map +0 -1
- package/dist/src/channels/telegram-mirror/failure/gateway-down.js.map +0 -1
- package/dist/src/channels/telegram-mirror/failure/in-flight-conflict.js.map +0 -1
- package/dist/src/channels/telegram-mirror/failure/index.js.map +0 -1
- package/dist/src/channels/telegram-mirror/failure/model-5xx.js.map +0 -1
- package/dist/src/channels/telegram-mirror/failure/network-blip.js.map +0 -1
- package/dist/src/channels/telegram-mirror/failure/pool-exhausted-fallback.js.map +0 -1
- package/dist/src/channels/telegram-mirror/failure/rate-limit.js.map +0 -1
- package/dist/src/channels/telegram-mirror/failure/returning-after-24h.js.map +0 -1
- package/dist/src/channels/telegram-mirror/failure/types.js.map +0 -1
- package/dist/src/channels/telegram-mirror/inbound-handler.js.map +0 -1
- package/dist/src/channels/telegram-mirror/index.js.map +0 -1
- package/dist/src/channels/telegram-mirror/plan-attachment.js.map +0 -1
- package/dist/src/channels/telegram-mirror/quota-reader.js.map +0 -1
- package/dist/src/channels/telegram-mirror/sessions-keyboard.js.map +0 -1
- package/dist/src/channels/telegram-mirror/soak-log.js.map +0 -1
- package/dist/src/channels/telegram-mirror/state-machine.js.map +0 -1
- package/dist/src/channels/telegram-mirror/status-line.js.map +0 -1
- package/dist/src/channels/telegram-mirror/sync-commands.js.map +0 -1
- package/dist/src/channels/telegram-mirror/threshold-watcher.js.map +0 -1
- package/dist/src/channels/telegram-mirror/turn-bridge.js.map +0 -1
- package/dist/src/cli/checks/bridge-wiring.js.map +0 -1
- package/dist/src/cli/checks/config-schema.js.map +0 -1
- package/dist/src/cli/checks/critical-openclaw-json-keys.js.map +0 -1
- package/dist/src/cli/checks/install-path.js.map +0 -1
- package/dist/src/cli/checks/patch-scaffold.js.map +0 -1
- package/dist/src/cli/doctor.js.map +0 -1
- package/dist/src/cli/index.js.map +0 -1
- package/dist/src/cli/migrate.js.map +0 -1
- package/dist/src/command-router/cc-handler.js.map +0 -1
- package/dist/src/command-router/index.js.map +0 -1
- package/dist/src/command-router/launch-policy.js.map +0 -1
- package/dist/src/command-router/resume-policy.js.map +0 -1
- package/dist/src/command-router/turn-formatter.js.map +0 -1
- package/dist/src/config/drift-detector.js.map +0 -1
- package/dist/src/config/loader.js.map +0 -1
- package/dist/src/config/schema.js.map +0 -1
- package/dist/src/constants.js.map +0 -1
- package/dist/src/council/build-agent-prompt.js.map +0 -1
- package/dist/src/council/cleanup-worktrees.js.map +0 -1
- package/dist/src/council/consensus.js.map +0 -1
- package/dist/src/council/council.js.map +0 -1
- package/dist/src/council/index.js.map +0 -1
- package/dist/src/council/system-prompt.js.map +0 -1
- package/dist/src/council/write-worktree-claude-md.js.map +0 -1
- package/dist/src/engines/base-oneshot-session.js.map +0 -1
- package/dist/src/engines/heartbeat-guard.js.map +0 -1
- package/dist/src/engines/index.js.map +0 -1
- package/dist/src/engines/persistent-codex-session.js.map +0 -1
- package/dist/src/engines/persistent-cursor-session.js.map +0 -1
- package/dist/src/engines/persistent-custom-session.js.map +0 -1
- package/dist/src/engines/persistent-gemini-session.js.map +0 -1
- package/dist/src/engines/persistent-session.js.map +0 -1
- package/dist/src/engines/resolve-bin.js.map +0 -1
- package/dist/src/engines/subprocess-pool.js.map +0 -1
- package/dist/src/health/handler.js.map +0 -1
- package/dist/src/health/index.js.map +0 -1
- package/dist/src/health/metrics.js.map +0 -1
- package/dist/src/index.js.map +0 -1
- package/dist/src/lib/auto-recovery.js.map +0 -1
- package/dist/src/lib/cache-parity.js.map +0 -1
- package/dist/src/lib/circuit-breaker.js.map +0 -1
- package/dist/src/lib/config-service.js.map +0 -1
- package/dist/src/lib/config.js.map +0 -1
- package/dist/src/lib/cost-rollup.js.map +0 -1
- package/dist/src/lib/debounce.js.map +0 -1
- package/dist/src/lib/debug-tap.js.map +0 -1
- package/dist/src/lib/domain-error.js.map +0 -1
- package/dist/src/lib/drift-detector.js.map +0 -1
- package/dist/src/lib/env-overrides.js.map +0 -1
- package/dist/src/lib/error-formatter.js.map +0 -1
- package/dist/src/lib/error-renderer.js.map +0 -1
- package/dist/src/lib/heartbeat-config.js.map +0 -1
- package/dist/src/lib/heartbeat-workaround.js.map +0 -1
- package/dist/src/lib/http-agent.js.map +0 -1
- package/dist/src/lib/index.js.map +0 -1
- package/dist/src/lib/json-array.js.map +0 -1
- package/dist/src/lib/markdown-to-mdv2.js.map +0 -1
- package/dist/src/lib/markdown-v2.js.map +0 -1
- package/dist/src/lib/perf/async-compact.js.map +0 -1
- package/dist/src/lib/perf/direct-sdk.js.map +0 -1
- package/dist/src/lib/perf/haiku-route.js.map +0 -1
- package/dist/src/lib/perf/predictive-continuation.js.map +0 -1
- package/dist/src/lib/perf/read-batch.js.map +0 -1
- package/dist/src/lib/perf/skill-list-collapse.js.map +0 -1
- package/dist/src/lib/perf/speculative-bubble.js.map +0 -1
- package/dist/src/lib/perf/typing-prefetch.js.map +0 -1
- package/dist/src/lib/register-guard.js.map +0 -1
- package/dist/src/lib/req-shape-log.js.map +0 -1
- package/dist/src/lib/safe-upstream-probes.js.map +0 -1
- package/dist/src/lib/session-registry.js.map +0 -1
- package/dist/src/lib/spawn-async.js.map +0 -1
- package/dist/src/lib/stale-pid-files.js.map +0 -1
- package/dist/src/lib/status-tee-reader.js.map +0 -1
- package/dist/src/lib/sysprompt-strip.js.map +0 -1
- package/dist/src/lib/telegram-bot-api.js.map +0 -1
- package/dist/src/lib/telemetry.js.map +0 -1
- package/dist/src/lib/test-mode.js.map +0 -1
- package/dist/src/lib/trajectory.js.map +0 -1
- package/dist/src/lib/vendor-paths.js.map +0 -1
- package/dist/src/lifecycle/boot.js.map +0 -1
- package/dist/src/lifecycle/patch-manifest.js.map +0 -1
- package/dist/src/lifecycle/phase-import-upstream.js.map +0 -1
- package/dist/src/lifecycle/phase-install-patches.js.map +0 -1
- package/dist/src/lifecycle/phase-schedule-jobs.js.map +0 -1
- package/dist/src/lifecycle/phase-start-server.js.map +0 -1
- package/dist/src/lifecycle/phase-validate-config.js.map +0 -1
- package/dist/src/lifecycle/phase-validate-upstream.js.map +0 -1
- package/dist/src/lifecycle/phase-wire-handlers.js.map +0 -1
- package/dist/src/lifecycle/safe-restart.js.map +0 -1
- package/dist/src/logger.js.map +0 -1
- package/dist/src/mcp/bridge.js.map +0 -1
- package/dist/src/mcp/index.js.map +0 -1
- package/dist/src/models.js.map +0 -1
- package/dist/src/observability/event-bus.js.map +0 -1
- package/dist/src/observability/get-event-bus.js.map +0 -1
- package/dist/src/observability/observability-service.js.map +0 -1
- package/dist/src/observability/perf-telemetry.js.map +0 -1
- package/dist/src/observability/subscribers/metrics.js.map +0 -1
- package/dist/src/observability/subscribers/session-capture.js.map +0 -1
- package/dist/src/openai-compat/bridges/allowlist.js.map +0 -1
- package/dist/src/openai-compat/bridges/factory.js.map +0 -1
- package/dist/src/openai-compat/bridges/media-bridge.js.map +0 -1
- package/dist/src/openai-compat/bridges/openclaw-api-shim.js.map +0 -1
- package/dist/src/openai-compat/bridges/openclaw-native-tools.js.map +0 -1
- package/dist/src/openai-compat/bridges/openclaw-tool-registry.js.map +0 -1
- package/dist/src/openai-compat/bridges/tts-media-bridge.js.map +0 -1
- package/dist/src/openai-compat/cli-stream-parser.js.map +0 -1
- package/dist/src/openai-compat/index.js.map +0 -1
- package/dist/src/openai-compat/message-extractor.js.map +0 -1
- package/dist/src/openai-compat/mode-flags.js.map +0 -1
- package/dist/src/openai-compat/non-streaming-handler.js.map +0 -1
- package/dist/src/openai-compat/openai-chunk-types.js.map +0 -1
- package/dist/src/openai-compat/openai-compat.js.map +0 -1
- package/dist/src/openai-compat/openai-types.js.map +0 -1
- package/dist/src/openai-compat/parse-route-body.js.map +0 -1
- package/dist/src/openai-compat/prompts.js.map +0 -1
- package/dist/src/openai-compat/response-formatter.js.map +0 -1
- package/dist/src/openai-compat/session-key-resolver.js.map +0 -1
- package/dist/src/openai-compat/skill-resolver.js.map +0 -1
- package/dist/src/openai-compat/sse-translator.js.map +0 -1
- package/dist/src/openai-compat/status-reporter.js.map +0 -1
- package/dist/src/openai-compat/streaming-handler.js.map +0 -1
- package/dist/src/openai-compat/tool-calls-parser.js.map +0 -1
- package/dist/src/openai-compat/tool-results-serializer.js.map +0 -1
- package/dist/src/openai-compat/tts-rule.js.map +0 -1
- package/dist/src/openai-compat/voice-recovery.js.map +0 -1
- package/dist/src/patches/cache-parity-registry.js.map +0 -1
- package/dist/src/patches/claude-md-injection.js.map +0 -1
- package/dist/src/patches/cwd-redirect.js.map +0 -1
- package/dist/src/patches/embedded-server-route.js.map +0 -1
- package/dist/src/patches/pricing-overrides.js.map +0 -1
- package/dist/src/patches/resume-registry-restore.js.map +0 -1
- package/dist/src/patches/session-pid-tracking.js.map +0 -1
- package/dist/src/patches/sysprompt-strip.js.map +0 -1
- package/dist/src/patches/sysprompt-strip.spec.d.ts +0 -33
- package/dist/src/patches/sysprompt-strip.spec.js +0 -53
- package/dist/src/patches/sysprompt-strip.spec.js.map +0 -1
- package/dist/src/patches/tools-restoration.js.map +0 -1
- package/dist/src/persistence/migration-v0.js.map +0 -1
- package/dist/src/persistence/session-registry.js.map +0 -1
- package/dist/src/persistence/snapshot.js.map +0 -1
- package/dist/src/persistence/wal.js.map +0 -1
- package/dist/src/proxy/anthropic-adapter.js.map +0 -1
- package/dist/src/proxy/handler.js.map +0 -1
- package/dist/src/proxy/index.js.map +0 -1
- package/dist/src/proxy/schema-cleaner.js.map +0 -1
- package/dist/src/proxy/thought-cache.js.map +0 -1
- package/dist/src/session/embedded-server.js.map +0 -1
- package/dist/src/session/inbox-manager.js.map +0 -1
- package/dist/src/session/index.js.map +0 -1
- package/dist/src/session/persisted-sessions.js.map +0 -1
- package/dist/src/session/session-manager.js.map +0 -1
- package/dist/src/session/watchdogs.js.map +0 -1
- package/dist/src/session-bootstrap/boot-self-heal.js.map +0 -1
- package/dist/src/session-bootstrap/cwd-patch.js.map +0 -1
- package/dist/src/session-bootstrap/index.js.map +0 -1
- package/dist/src/session-bootstrap/resume-registry.js.map +0 -1
- package/dist/src/session-bootstrap/session-hygiene.js.map +0 -1
- package/dist/src/session-bootstrap/sysprompt-strip.js.map +0 -1
- package/dist/src/session-bootstrap/think-conflict-resolver.js.map +0 -1
- package/dist/src/types/index.js.map +0 -1
- package/dist/src/types/route.js.map +0 -1
- package/dist/src/types/runtime-config.js.map +0 -1
- package/dist/src/types/session.js.map +0 -1
- package/dist/src/types/sse.js.map +0 -1
- package/dist/src/types/tool-bridge.js.map +0 -1
- package/dist/src/types/upstream.js.map +0 -1
- package/dist/src/types.js.map +0 -1
- package/dist/src/validation.js.map +0 -1
|
@@ -30,6 +30,13 @@ import { editTg } from '../../lib/telegram-bot-api.js';
|
|
|
30
30
|
import { readQuotaSnapshot } from '../../lib/status-tee-reader.js';
|
|
31
31
|
import { captureAskUserQuestion } from './askuser.js';
|
|
32
32
|
const _lastRepaintAt = new Map();
|
|
33
|
+
// v0.26.5: per-chat in-flight guard. repaint() is called fire-and-forget
|
|
34
|
+
// (`void repaint(...)`) from every push, so two edits for the same card could
|
|
35
|
+
// otherwise overlap — racing Telegram's editMessageText and provoking 429 /
|
|
36
|
+
// "message is not modified" churn (the "fragile" feel). Skipping while an edit
|
|
37
|
+
// is in flight is safe because finalizeActiveCards() always does a final
|
|
38
|
+
// authoritative render at turn end, so no state is lost.
|
|
39
|
+
const _inFlight = new Set();
|
|
33
40
|
const REPAINT_MIN_MS = 800;
|
|
34
41
|
async function repaint(chatId, force) {
|
|
35
42
|
const card = cardState.get(chatId);
|
|
@@ -42,7 +49,10 @@ async function repaint(chatId, force) {
|
|
|
42
49
|
const last = _lastRepaintAt.get(chatId) ?? 0;
|
|
43
50
|
if (!force && now - last < REPAINT_MIN_MS)
|
|
44
51
|
return;
|
|
52
|
+
if (_inFlight.has(chatId))
|
|
53
|
+
return;
|
|
45
54
|
_lastRepaintAt.set(chatId, now);
|
|
55
|
+
_inFlight.add(chatId);
|
|
46
56
|
try {
|
|
47
57
|
await editTg(chatId, card.messageId, renderTurn(turn, card.meta));
|
|
48
58
|
}
|
|
@@ -52,6 +62,9 @@ async function repaint(chatId, force) {
|
|
|
52
62
|
process.stderr.write(`[cc-openclaw/turn-bridge] repaint failed chat=${chatId}: ${m}\n`);
|
|
53
63
|
}
|
|
54
64
|
}
|
|
65
|
+
finally {
|
|
66
|
+
_inFlight.delete(chatId);
|
|
67
|
+
}
|
|
55
68
|
}
|
|
56
69
|
function activeChatIds() {
|
|
57
70
|
return Array.from(cardState.keys());
|
|
@@ -123,6 +136,12 @@ export function pushToolUse(name, input, toolUseId) {
|
|
|
123
136
|
void captureAskUserQuestion(chatId, cardState.get(chatId)?.threadId, input, toolUseId);
|
|
124
137
|
}
|
|
125
138
|
}
|
|
139
|
+
// v0.26.5: claude.exe fires tool_use twice — once with empty input, once with
|
|
140
|
+
// the full input (state-machine dedups by id). Force the immediate repaint
|
|
141
|
+
// only on the full-input fire; the empty-input fire takes a throttled repaint.
|
|
142
|
+
// Halves the edit volume per tool without losing the "line appears instantly"
|
|
143
|
+
// feel (the bare line still shows on the first throttle-permitted repaint).
|
|
144
|
+
const hasInput = !!input && Object.keys(input).length > 0;
|
|
126
145
|
for (const chatId of chats) {
|
|
127
146
|
const card = cardState.get(chatId);
|
|
128
147
|
if (!card)
|
|
@@ -134,7 +153,7 @@ export function pushToolUse(name, input, toolUseId) {
|
|
|
134
153
|
id,
|
|
135
154
|
tool: { name, input: input ?? {} },
|
|
136
155
|
});
|
|
137
|
-
void repaint(chatId, /* force */
|
|
156
|
+
void repaint(chatId, /* force */ hasInput);
|
|
138
157
|
}
|
|
139
158
|
}
|
|
140
159
|
/** Parse a TodoWrite tool_use input into the CardMeta todos shape, or undefined
|
|
@@ -255,11 +274,60 @@ export async function finalizeActiveCards() {
|
|
|
255
274
|
cardState.delete(chatId);
|
|
256
275
|
}
|
|
257
276
|
}
|
|
277
|
+
/**
|
|
278
|
+
* Map a caught error to a short, user-readable card reason (v0.27.0 M4). Keeps
|
|
279
|
+
* the "❌ <reason>" header concise and classifies the common cc-openclaw-side
|
|
280
|
+
* failures (its own watchdog kill / dead subprocess / timeout) rather than
|
|
281
|
+
* dumping a raw stack.
|
|
282
|
+
*/
|
|
283
|
+
export function classifyFailure(err) {
|
|
284
|
+
const msg = (err instanceof Error ? err.message : String(err ?? '')) || 'unknown error';
|
|
285
|
+
if (/timed out|timeout/i.test(msg))
|
|
286
|
+
return 'Turn timed out';
|
|
287
|
+
if (/not ready|closed|exited|spawn|ENOENT|killed|SIGTERM|stalled/i.test(msg))
|
|
288
|
+
return 'Subprocess died';
|
|
289
|
+
return `Turn failed: ${msg.slice(0, 60)}`;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Fail every active card (v0.27.0 M4). Called from the openai-compat handlers'
|
|
293
|
+
* catch path when cc-openclaw's OWN turn errors — its subprocess died, its
|
|
294
|
+
* stalled-session watchdog SIGTERMed it, or the model call threw/timed out. The
|
|
295
|
+
* card flips to "❌ <reason>" instead of being left as an eternal "…" (or worse,
|
|
296
|
+
* finalized to a misleading "✓ Done"). Scoped to cc-openclaw's own vantage; the
|
|
297
|
+
* gateway's recovery=none stalls that never throw here are out of M4's reach.
|
|
298
|
+
* Best-effort: a fail-render failure must not mask the original error.
|
|
299
|
+
*/
|
|
300
|
+
export async function failActiveCards(reason) {
|
|
301
|
+
const chats = activeChatIds();
|
|
302
|
+
if (chats.length === 0)
|
|
303
|
+
return;
|
|
304
|
+
logPush('failActiveCards', chats.length, ` reason=${reason}`);
|
|
305
|
+
for (const chatId of chats) {
|
|
306
|
+
const card = cardState.get(chatId);
|
|
307
|
+
if (!card)
|
|
308
|
+
continue;
|
|
309
|
+
card.sm.fail(chatId, reason);
|
|
310
|
+
const turn = card.sm.getTurn(chatId);
|
|
311
|
+
if (turn) {
|
|
312
|
+
turn.assistantText = '';
|
|
313
|
+
try {
|
|
314
|
+
await editTg(chatId, card.messageId, renderTurn(turn, card.meta));
|
|
315
|
+
}
|
|
316
|
+
catch (err) {
|
|
317
|
+
const m = err.message;
|
|
318
|
+
if (!/message is not modified/i.test(m)) {
|
|
319
|
+
process.stderr.write(`[cc-openclaw/turn-bridge] fail edit failed chat=${chatId}: ${m}\n`);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
cardState.delete(chatId);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
258
326
|
/**
|
|
259
327
|
* Test-only — reset module-level repaint state. Card state lives in
|
|
260
328
|
* card-state.ts so import that and clear directly if your test needs it.
|
|
261
329
|
*/
|
|
262
330
|
export function _resetBridgeForTests() {
|
|
263
331
|
_lastRepaintAt.clear();
|
|
332
|
+
_inFlight.clear();
|
|
264
333
|
}
|
|
265
|
-
//# sourceMappingURL=turn-bridge.js.map
|
package/dist/src/cli/doctor.js
CHANGED
package/dist/src/cli/index.js
CHANGED
package/dist/src/cli/migrate.js
CHANGED
package/dist/src/constants.js
CHANGED
|
@@ -185,4 +185,3 @@ export const CC_AUTO_COMPACT_THRESHOLD = 70;
|
|
|
185
185
|
* recreate) instead of compacting. Used when /compact itself would leave
|
|
186
186
|
* the session too close to the model's window cap to do useful work. */
|
|
187
187
|
export const CC_HARD_RESET_THRESHOLD = 90;
|
|
188
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -439,6 +439,36 @@ export class PersistentClaudeSession extends EventEmitter {
|
|
|
439
439
|
}
|
|
440
440
|
case 'user':
|
|
441
441
|
this.stats.turns++;
|
|
442
|
+
// v0.26.5: Claude CLI delivers tool RESULTS as content blocks inside a
|
|
443
|
+
// `user` message (it auto-runs the tool, then feeds the result back as
|
|
444
|
+
// a synthetic user turn) — NOT as a top-level `tool_result` event. The
|
|
445
|
+
// standalone `case 'tool_result'` below therefore essentially never
|
|
446
|
+
// fires in practice, so onToolResult was never called and the Telegram
|
|
447
|
+
// mirror's tool glyphs were stuck at "…" forever (never flipped to
|
|
448
|
+
// ✓/✗). Extract them here, mirroring the tool_use extraction in
|
|
449
|
+
// `case 'assistant'`. Shape matches what onToolResult consumers expect
|
|
450
|
+
// (tool_use_id / content / is_error).
|
|
451
|
+
if (event.message?.content && Array.isArray(event.message.content)) {
|
|
452
|
+
for (const block of event.message.content) {
|
|
453
|
+
if (block?.type === 'tool_result') {
|
|
454
|
+
const b = block;
|
|
455
|
+
const resultEvent = {
|
|
456
|
+
tool_use_id: b.tool_use_id,
|
|
457
|
+
content: b.content,
|
|
458
|
+
is_error: Boolean(b.is_error),
|
|
459
|
+
};
|
|
460
|
+
if (b.is_error)
|
|
461
|
+
this.stats.toolErrors++;
|
|
462
|
+
try {
|
|
463
|
+
this._streamCallbacks?.onToolResult?.(resultEvent);
|
|
464
|
+
}
|
|
465
|
+
catch (err) {
|
|
466
|
+
this.emit(SESSION_EVENT.LOG, `[stream callback error] onToolResult (user block): ${err.message}`);
|
|
467
|
+
}
|
|
468
|
+
this.emit(SESSION_EVENT.TOOL_RESULT, resultEvent);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
442
472
|
this.emit(SESSION_EVENT.USER_ECHO, event);
|
|
443
473
|
break;
|
|
444
474
|
case 'assistant':
|
|
@@ -868,4 +898,3 @@ export class PersistentClaudeSession extends EventEmitter {
|
|
|
868
898
|
this.emit(`hook:${hookName}`, data);
|
|
869
899
|
}
|
|
870
900
|
}
|
|
871
|
-
//# sourceMappingURL=persistent-session.js.map
|
package/dist/src/health/index.js
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -184,4 +184,3 @@ export { registerChannelAdapter } from './channels/adapter.js';
|
|
|
184
184
|
// Re-export engine routing primitives. Originally lived in lib/route-flag.ts;
|
|
185
185
|
// collapsed into config-service.ts at Cluster A step 8 (route-flag.ts deleted).
|
|
186
186
|
export { selectEngine, captureSessionRoute } from './lib/config-service.js';
|
|
187
|
-
//# sourceMappingURL=index.js.map
|
package/dist/src/lib/config.js
CHANGED
package/dist/src/lib/debounce.js
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* html-render — Telegram HTML parse_mode rendering (v0.27.0 M1).
|
|
3
|
+
*
|
|
4
|
+
* The CLI-fidelity rendering engine. Chosen over MarkdownV2 because Telegram's
|
|
5
|
+
* HTML mode only requires escaping `& < >` (no "every . - ! must be backslashed"
|
|
6
|
+
* fragility), and it supports `<pre><code class="language-bash">…</code></pre>` —
|
|
7
|
+
* labeled, monospaced code blocks that mirror the terminal — plus `<blockquote>`
|
|
8
|
+
* and `<tg-spoiler>`.
|
|
9
|
+
*
|
|
10
|
+
* Companion to markdown-v2.ts / markdown-to-mdv2.ts (the prior engine). This
|
|
11
|
+
* module is the HTML path the card-renderer + telegram-bot-api now use.
|
|
12
|
+
*
|
|
13
|
+
* Telegram-supported tags (Bot API): b/strong, i/em, u, s, a, code, pre,
|
|
14
|
+
* pre+code[class=language-X], blockquote, tg-spoiler. Everything else in text
|
|
15
|
+
* content must have &, <, > escaped.
|
|
16
|
+
*/
|
|
17
|
+
/** Escape the three HTML-significant chars for Telegram HTML text content. */
|
|
18
|
+
export declare function escapeHtml(text: string | null | undefined): string;
|
|
19
|
+
/** Inline monospace span: `<code>escaped</code>`. */
|
|
20
|
+
export declare function code(s: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Fenced code block: `<pre><code class="language-LANG">escaped</code></pre>`.
|
|
23
|
+
* Omits the class when no language is given. Body is HTML-escaped (the only
|
|
24
|
+
* escaping Telegram requires inside pre/code).
|
|
25
|
+
*/
|
|
26
|
+
export declare function pre(body: string, lang?: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Convert a subset of CommonMark Markdown to Telegram HTML with structure
|
|
29
|
+
* preserved (`**bold**`→`<b>`, fenced blocks→`<pre><code>`, etc.). Returns ''
|
|
30
|
+
* for null/undefined.
|
|
31
|
+
*
|
|
32
|
+
* Algorithm (placeholder substitution, NUL-sentinel keyed — mirrors
|
|
33
|
+
* markdown-to-mdv2.ts so behaviour is auditable side-by-side):
|
|
34
|
+
* 1. code fences → <pre><code [class]>…</code></pre>
|
|
35
|
+
* 2. inline code → <code>…</code>
|
|
36
|
+
* 3. bold (**…**) → <b>…</b>
|
|
37
|
+
* 4. italic (*…* / _…_) → <i>…</i>
|
|
38
|
+
* 5. ATX headers (#…) at line start → <b>…</b>
|
|
39
|
+
* 6. links [label](url) → <a href="url">label</a>
|
|
40
|
+
* 7. escape remaining text (& < >)
|
|
41
|
+
* 8. restore placeholders verbatim
|
|
42
|
+
*/
|
|
43
|
+
export declare function markdownToHtml(input: string | null | undefined): string;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* html-render — Telegram HTML parse_mode rendering (v0.27.0 M1).
|
|
3
|
+
*
|
|
4
|
+
* The CLI-fidelity rendering engine. Chosen over MarkdownV2 because Telegram's
|
|
5
|
+
* HTML mode only requires escaping `& < >` (no "every . - ! must be backslashed"
|
|
6
|
+
* fragility), and it supports `<pre><code class="language-bash">…</code></pre>` —
|
|
7
|
+
* labeled, monospaced code blocks that mirror the terminal — plus `<blockquote>`
|
|
8
|
+
* and `<tg-spoiler>`.
|
|
9
|
+
*
|
|
10
|
+
* Companion to markdown-v2.ts / markdown-to-mdv2.ts (the prior engine). This
|
|
11
|
+
* module is the HTML path the card-renderer + telegram-bot-api now use.
|
|
12
|
+
*
|
|
13
|
+
* Telegram-supported tags (Bot API): b/strong, i/em, u, s, a, code, pre,
|
|
14
|
+
* pre+code[class=language-X], blockquote, tg-spoiler. Everything else in text
|
|
15
|
+
* content must have &, <, > escaped.
|
|
16
|
+
*/
|
|
17
|
+
/** Escape the three HTML-significant chars for Telegram HTML text content. */
|
|
18
|
+
export function escapeHtml(text) {
|
|
19
|
+
if (text == null)
|
|
20
|
+
return '';
|
|
21
|
+
return String(text)
|
|
22
|
+
.replace(/&/g, '&')
|
|
23
|
+
.replace(/</g, '<')
|
|
24
|
+
.replace(/>/g, '>');
|
|
25
|
+
}
|
|
26
|
+
/** Inline monospace span: `<code>escaped</code>`. */
|
|
27
|
+
export function code(s) {
|
|
28
|
+
return `<code>${escapeHtml(s)}</code>`;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Fenced code block: `<pre><code class="language-LANG">escaped</code></pre>`.
|
|
32
|
+
* Omits the class when no language is given. Body is HTML-escaped (the only
|
|
33
|
+
* escaping Telegram requires inside pre/code).
|
|
34
|
+
*/
|
|
35
|
+
export function pre(body, lang) {
|
|
36
|
+
const cls = lang ? ` class="language-${escapeHtml(lang)}"` : '';
|
|
37
|
+
return `<pre><code${cls}>${escapeHtml(body)}</code></pre>`;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Convert a subset of CommonMark Markdown to Telegram HTML with structure
|
|
41
|
+
* preserved (`**bold**`→`<b>`, fenced blocks→`<pre><code>`, etc.). Returns ''
|
|
42
|
+
* for null/undefined.
|
|
43
|
+
*
|
|
44
|
+
* Algorithm (placeholder substitution, NUL-sentinel keyed — mirrors
|
|
45
|
+
* markdown-to-mdv2.ts so behaviour is auditable side-by-side):
|
|
46
|
+
* 1. code fences → <pre><code [class]>…</code></pre>
|
|
47
|
+
* 2. inline code → <code>…</code>
|
|
48
|
+
* 3. bold (**…**) → <b>…</b>
|
|
49
|
+
* 4. italic (*…* / _…_) → <i>…</i>
|
|
50
|
+
* 5. ATX headers (#…) at line start → <b>…</b>
|
|
51
|
+
* 6. links [label](url) → <a href="url">label</a>
|
|
52
|
+
* 7. escape remaining text (& < >)
|
|
53
|
+
* 8. restore placeholders verbatim
|
|
54
|
+
*/
|
|
55
|
+
export function markdownToHtml(input) {
|
|
56
|
+
if (input == null)
|
|
57
|
+
return '';
|
|
58
|
+
let text = String(input);
|
|
59
|
+
const codeBlocks = [];
|
|
60
|
+
text = text.replace(/```([a-zA-Z0-9_+\-]*)\n?([\s\S]*?)```/g, (_m, lang, body) => {
|
|
61
|
+
const idx = codeBlocks.length;
|
|
62
|
+
codeBlocks.push(pre(body.replace(/\n$/, ''), lang || undefined));
|
|
63
|
+
return `\x00CODEBLOCK${idx}\x00`;
|
|
64
|
+
});
|
|
65
|
+
const inlineCodes = [];
|
|
66
|
+
text = text.replace(/`([^`\n]+)`/g, (_m, body) => {
|
|
67
|
+
const idx = inlineCodes.length;
|
|
68
|
+
inlineCodes.push(code(body));
|
|
69
|
+
return `\x00INLINECODE${idx}\x00`;
|
|
70
|
+
});
|
|
71
|
+
const bolds = [];
|
|
72
|
+
text = text.replace(/\*\*([^*\n]+)\*\*/g, (_m, body) => {
|
|
73
|
+
const idx = bolds.length;
|
|
74
|
+
bolds.push(`<b>${escapeHtml(body)}</b>`);
|
|
75
|
+
return `\x00BOLD${idx}\x00`;
|
|
76
|
+
});
|
|
77
|
+
const italics = [];
|
|
78
|
+
text = text.replace(/(?<![\w*])\*([^*\n]+)\*(?!\w)/g, (_m, body) => {
|
|
79
|
+
const idx = italics.length;
|
|
80
|
+
italics.push(`<i>${escapeHtml(body)}</i>`);
|
|
81
|
+
return `\x00ITALIC${idx}\x00`;
|
|
82
|
+
});
|
|
83
|
+
text = text.replace(/(?<![\w_])_([^_\n]+)_(?!\w)/g, (_m, body) => {
|
|
84
|
+
const idx = italics.length;
|
|
85
|
+
italics.push(`<i>${escapeHtml(body)}</i>`);
|
|
86
|
+
return `\x00ITALIC${idx}\x00`;
|
|
87
|
+
});
|
|
88
|
+
const headers = [];
|
|
89
|
+
text = text.replace(/^(#{1,6})\s+(.+?)\s*#*\s*$/gm, (_m, _hashes, body) => {
|
|
90
|
+
const idx = headers.length;
|
|
91
|
+
headers.push(`<b>${escapeHtml(body)}</b>`);
|
|
92
|
+
return `\x00HEADER${idx}\x00`;
|
|
93
|
+
});
|
|
94
|
+
const links = [];
|
|
95
|
+
text = text.replace(/\[([^\]\n]+)\]\(([^)\s]+)\)/g, (_m, label, url) => {
|
|
96
|
+
const idx = links.length;
|
|
97
|
+
// Attribute value: escape & < > and the double-quote that would close it.
|
|
98
|
+
const safeUrl = escapeHtml(url).replace(/"/g, '"');
|
|
99
|
+
links.push(`<a href="${safeUrl}">${escapeHtml(label)}</a>`);
|
|
100
|
+
return `\x00LINK${idx}\x00`;
|
|
101
|
+
});
|
|
102
|
+
text = escapeHtml(text);
|
|
103
|
+
text = text.replace(/\x00CODEBLOCK(\d+)\x00/g, (_m, idx) => codeBlocks[Number(idx)]);
|
|
104
|
+
text = text.replace(/\x00INLINECODE(\d+)\x00/g, (_m, idx) => inlineCodes[Number(idx)]);
|
|
105
|
+
text = text.replace(/\x00BOLD(\d+)\x00/g, (_m, idx) => bolds[Number(idx)]);
|
|
106
|
+
text = text.replace(/\x00ITALIC(\d+)\x00/g, (_m, idx) => italics[Number(idx)]);
|
|
107
|
+
text = text.replace(/\x00HEADER(\d+)\x00/g, (_m, idx) => headers[Number(idx)]);
|
|
108
|
+
text = text.replace(/\x00LINK(\d+)\x00/g, (_m, idx) => links[Number(idx)]);
|
|
109
|
+
return text;
|
|
110
|
+
}
|