@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
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
import { CallbackMap } from './callback-mapping.js';
|
|
24
24
|
import { sendTg, editTg, telegramApi } from '../../lib/telegram-bot-api.js';
|
|
25
|
+
import { escapeHtml } from '../../lib/html-render.js';
|
|
25
26
|
/** Namespace prefix for callback_data so api.registerInteractiveHandler routes
|
|
26
27
|
* taps here. Matched at the first ':' by the gateway (must be [A-Za-z0-9._-]+). */
|
|
27
28
|
export const ASKUSER_NS = 'ccmirror';
|
|
@@ -74,21 +75,34 @@ export function parseFirstQuestion(input) {
|
|
|
74
75
|
function shortQid() {
|
|
75
76
|
return Math.random().toString(36).slice(2, 8);
|
|
76
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* v0.27.0 M3 — render the question body as organized Telegram HTML (bold header,
|
|
80
|
+
* numbered options with italic descriptions). All dynamic text is HTML-escaped
|
|
81
|
+
* (the send path uses parse_mode HTML since M1, so a stray < in a question would
|
|
82
|
+
* otherwise break the message). Mirrors the CLI's clean option layout.
|
|
83
|
+
*/
|
|
77
84
|
function bodyText(s) {
|
|
78
|
-
const lines = [`❓
|
|
79
|
-
//
|
|
80
|
-
//
|
|
85
|
+
const lines = [`❓ <b>${escapeHtml(s.header)}</b>`, escapeHtml(s.question)];
|
|
86
|
+
// List options with their descriptions in the body (buttons only show the
|
|
87
|
+
// label, so descriptions would otherwise be lost).
|
|
81
88
|
const described = s.options.filter((o) => o.description);
|
|
82
89
|
if (described.length > 0) {
|
|
83
90
|
lines.push('');
|
|
84
91
|
s.options.forEach((o, i) => {
|
|
85
|
-
|
|
92
|
+
const n = `<b>${i + 1}.</b>`;
|
|
93
|
+
lines.push(o.description
|
|
94
|
+
? `${n} ${escapeHtml(o.label)} — <i>${escapeHtml(o.description)}</i>`
|
|
95
|
+
: `${n} ${escapeHtml(o.label)}`);
|
|
86
96
|
});
|
|
87
97
|
}
|
|
88
98
|
if (s.multiSelect)
|
|
89
|
-
lines.push('', '(select one or more, then Submit)');
|
|
99
|
+
lines.push('', '<i>(select one or more, then Submit)</i>');
|
|
90
100
|
return lines.join('\n');
|
|
91
101
|
}
|
|
102
|
+
/** v0.27.0 M3 — HTML-safe "you chose" confirmation shown after a tap. */
|
|
103
|
+
function chosenText(s, chosen) {
|
|
104
|
+
return `❓ <b>${escapeHtml(s.header)}</b>\n${escapeHtml(s.question)}\n\n✓ You chose: <b>${escapeHtml(chosen)}</b>`;
|
|
105
|
+
}
|
|
92
106
|
/** Build the inline keyboard for a question. callback_data is
|
|
93
107
|
* `ccmirror:<CallbackMap id>` so the gateway routes taps to our handler. */
|
|
94
108
|
function buildKeyboard(qid, s) {
|
|
@@ -216,7 +230,7 @@ export async function handleTap(ctx, api) {
|
|
|
216
230
|
if (payload.kind === 'opt' && !s.multiSelect) {
|
|
217
231
|
const label = s.options[payload.idx]?.label ?? '';
|
|
218
232
|
await answerCb(ctx, `Selected: ${label}`);
|
|
219
|
-
await editQ(s,
|
|
233
|
+
await editQ(s, chosenText(s, label));
|
|
220
234
|
injectAnswer(api, ctx, label);
|
|
221
235
|
_questions.delete(payload.qid);
|
|
222
236
|
return;
|
|
@@ -237,7 +251,7 @@ export async function handleTap(ctx, api) {
|
|
|
237
251
|
return;
|
|
238
252
|
}
|
|
239
253
|
await answerCb(ctx, `Submitted ${labels.length}`);
|
|
240
|
-
await editQ(s,
|
|
254
|
+
await editQ(s, chosenText(s, labels.join(', ')));
|
|
241
255
|
injectAnswer(api, ctx, labels.join(', '));
|
|
242
256
|
_questions.delete(payload.qid);
|
|
243
257
|
return;
|
|
@@ -271,4 +285,3 @@ export function _resetAskUserForTests() {
|
|
|
271
285
|
export function _pendingCount() {
|
|
272
286
|
return _questions.size;
|
|
273
287
|
}
|
|
274
|
-
//# sourceMappingURL=askuser.js.map
|
|
@@ -14,6 +14,18 @@
|
|
|
14
14
|
* Tests live at tests/channels/telegram-mirror/m2-render-pipeline.test.ts.
|
|
15
15
|
*/
|
|
16
16
|
import { renderStatusLine, renderMeters, renderTodos } from './status-line.js';
|
|
17
|
+
import { escapeHtml, code, pre, markdownToHtml } from '../../lib/html-render.js';
|
|
18
|
+
// v0.27.0 M1 — the card renders as Telegram HTML (parse_mode: 'HTML'), not
|
|
19
|
+
// MarkdownV2. HTML only needs `& < >` escaped (no per-char backslash litter)
|
|
20
|
+
// and supports <pre><code class="language-…"> + <blockquote> for true
|
|
21
|
+
// CLI-fidelity. escapeHtml / code() / markdownToHtml come from lib/html-render.
|
|
22
|
+
/** Last path segment (basename) — keeps tool lines short and CLI-like, e.g.
|
|
23
|
+
* "/home/a1/kris-kitchen/components/ShoppingList.tsx" → "ShoppingList.tsx". */
|
|
24
|
+
function basename(p) {
|
|
25
|
+
const cleaned = p.replace(/\/+$/, '');
|
|
26
|
+
const idx = cleaned.lastIndexOf('/');
|
|
27
|
+
return idx >= 0 ? cleaned.slice(idx + 1) : cleaned;
|
|
28
|
+
}
|
|
17
29
|
/**
|
|
18
30
|
* Glyph picked per tool-call status. Mirrors terminal "running / done /
|
|
19
31
|
* errored" iconography that A1 already reads in the live Claude Code TUI.
|
|
@@ -28,25 +40,78 @@ function toolGlyph(tc) {
|
|
|
28
40
|
/**
|
|
29
41
|
* Render the input argument summary for a tool call. Kept tight — full
|
|
30
42
|
* input is in the result; the mirror line is meant to read at a glance.
|
|
43
|
+
* Returns RAW (unescaped) text; the caller wraps it in a code span.
|
|
44
|
+
*
|
|
45
|
+
* v0.26.5: collapse embedded whitespace/newlines to single spaces (a
|
|
46
|
+
* multi-line Bash command used to spill across several card rows), prefer the
|
|
47
|
+
* basename for file paths (shorter + CLI-like), and truncate with a single "…".
|
|
31
48
|
*/
|
|
32
49
|
function toolInputSummary(tc) {
|
|
33
50
|
const input = tc.input;
|
|
34
51
|
if (!input || typeof input !== 'object')
|
|
35
52
|
return '';
|
|
36
|
-
// Prefer common single-field shapes used by Bash/Read/Edit/Write.
|
|
37
|
-
const
|
|
53
|
+
// Prefer common single-field shapes used by Bash/Read/Edit/Write/Grep/Glob.
|
|
54
|
+
const raw = typeof input.command === 'string'
|
|
38
55
|
? input.command
|
|
39
56
|
: typeof input.file_path === 'string'
|
|
40
|
-
? input.file_path
|
|
57
|
+
? basename(input.file_path)
|
|
41
58
|
: typeof input.path === 'string'
|
|
42
|
-
? input.path
|
|
43
|
-
: typeof input.
|
|
44
|
-
? input.
|
|
45
|
-
: ''
|
|
46
|
-
|
|
47
|
-
|
|
59
|
+
? basename(input.path)
|
|
60
|
+
: typeof input.pattern === 'string'
|
|
61
|
+
? input.pattern
|
|
62
|
+
: typeof input.url === 'string'
|
|
63
|
+
? input.url
|
|
64
|
+
: '';
|
|
65
|
+
if (!raw)
|
|
66
|
+
return '';
|
|
67
|
+
const collapsed = raw.replace(/\s+/g, ' ').trim();
|
|
68
|
+
return collapsed.length > 48 ? collapsed.slice(0, 47) + '…' : collapsed;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* v0.27.0 M2 — coerce a tool's RESULT payload to display text. Claude delivers
|
|
72
|
+
* tool_result content as a string OR an array of `{type:'text',text}` blocks
|
|
73
|
+
* (via the persistent-session user-message extraction). Returns trimmed text, or
|
|
74
|
+
* '' when there's nothing real to show (no-fake-data — never stringify objects).
|
|
75
|
+
*/
|
|
76
|
+
function toolResultText(tc) {
|
|
77
|
+
const r = tc.result;
|
|
78
|
+
if (r == null)
|
|
79
|
+
return '';
|
|
80
|
+
let s = '';
|
|
81
|
+
if (typeof r === 'string') {
|
|
82
|
+
s = r;
|
|
83
|
+
}
|
|
84
|
+
else if (Array.isArray(r)) {
|
|
85
|
+
s = r
|
|
86
|
+
.map((b) => {
|
|
87
|
+
if (typeof b === 'string')
|
|
88
|
+
return b;
|
|
89
|
+
if (b && typeof b === 'object' && typeof b.text === 'string') {
|
|
90
|
+
return b.text;
|
|
91
|
+
}
|
|
92
|
+
return '';
|
|
93
|
+
})
|
|
94
|
+
.join('');
|
|
95
|
+
}
|
|
96
|
+
return s.trim();
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* v0.27.0 M2 — truncate result text for the card: at most RESULT_MAX_LINES lines
|
|
100
|
+
* and RESULT_MAX_CHARS chars, with a trailing "…" when cut. Keeps the card
|
|
101
|
+
* readable (Telegram's 4096-char message cap) while still surfacing tool output
|
|
102
|
+
* the way the CLI shows it inline.
|
|
103
|
+
*/
|
|
104
|
+
const RESULT_MAX_LINES = 3;
|
|
105
|
+
const RESULT_MAX_CHARS = 200;
|
|
106
|
+
function truncateResult(s) {
|
|
107
|
+
const lines = s.split('\n');
|
|
108
|
+
let cut = lines.length > RESULT_MAX_LINES;
|
|
109
|
+
let out = lines.slice(0, RESULT_MAX_LINES).join('\n');
|
|
110
|
+
if (out.length > RESULT_MAX_CHARS) {
|
|
111
|
+
out = out.slice(0, RESULT_MAX_CHARS);
|
|
112
|
+
cut = true;
|
|
48
113
|
}
|
|
49
|
-
return '';
|
|
114
|
+
return cut ? out.replace(/\s+$/, '') + '\n…' : out;
|
|
50
115
|
}
|
|
51
116
|
/**
|
|
52
117
|
* Format one tool-call line for inclusion in the rendered card body.
|
|
@@ -87,8 +152,11 @@ export function toolIcon(name) {
|
|
|
87
152
|
export function renderToolLine(tc) {
|
|
88
153
|
const glyph = toolGlyph(tc);
|
|
89
154
|
const icon = toolIcon(tc.name);
|
|
155
|
+
// Status glyph + emoji are HTML-safe; the tool name is HTML-escaped and the
|
|
156
|
+
// input detail rides in a <code> span (v0.27.0 M1 HTML styling).
|
|
157
|
+
const name = escapeHtml(tc.name);
|
|
90
158
|
const summary = toolInputSummary(tc);
|
|
91
|
-
return summary ? `${glyph} ${icon} ${
|
|
159
|
+
return summary ? `${glyph} ${icon} ${name} · ${code(summary)}` : `${glyph} ${icon} ${name}`;
|
|
92
160
|
}
|
|
93
161
|
/**
|
|
94
162
|
* Render the thinking block (M6). Each line of the thinking text is
|
|
@@ -100,8 +168,14 @@ export function renderThinkingBlock(thinkingText) {
|
|
|
100
168
|
const trimmed = thinkingText.trim();
|
|
101
169
|
if (trimmed.length === 0)
|
|
102
170
|
return '';
|
|
103
|
-
|
|
104
|
-
|
|
171
|
+
// v0.27.0 M1 — Telegram HTML <blockquote> renders the reasoning as a single
|
|
172
|
+
// indented quote (terminal-style), distinct from the assistant text. Content
|
|
173
|
+
// is HTML-escaped; newlines are preserved inside the blockquote.
|
|
174
|
+
const body = trimmed
|
|
175
|
+
.split('\n')
|
|
176
|
+
.map((l) => escapeHtml(l))
|
|
177
|
+
.join('\n');
|
|
178
|
+
return `💭 Thinking\n<blockquote>${body}</blockquote>`;
|
|
105
179
|
}
|
|
106
180
|
/**
|
|
107
181
|
* Render the full turn into a Telegram-safe message body. The mirror keeps
|
|
@@ -133,30 +207,46 @@ export function renderTurn(turn, meta) {
|
|
|
133
207
|
// handler calls setCardMeta(), the status line appears on the next repaint.
|
|
134
208
|
if (meta) {
|
|
135
209
|
const status = renderStatusLine(turn, meta);
|
|
210
|
+
// v0.27.0 M1 — bold the status line (the card header) via HTML <b>. Content
|
|
211
|
+
// HTML-escaped first ( & < > only — model/version dots & brackets are safe).
|
|
136
212
|
if (status)
|
|
137
|
-
lines.push(status);
|
|
213
|
+
lines.push(`<b>${escapeHtml(status)}</b>`);
|
|
138
214
|
// v0.26.2 M2 — meter row (context % + quota % + reset). Same no-fake-data
|
|
139
|
-
// gating: omitted unless real values are present.
|
|
215
|
+
// gating: omitted unless real values are present. HTML-escaped for safety.
|
|
140
216
|
const meters = renderMeters(meta);
|
|
141
217
|
if (meters)
|
|
142
|
-
lines.push(meters);
|
|
218
|
+
lines.push(escapeHtml(meters));
|
|
143
219
|
// v0.26.4 styling — divider between the status/telemetry block and the
|
|
144
|
-
// activity block (only when a status block was actually rendered).
|
|
220
|
+
// activity block (only when a status block was actually rendered). The
|
|
221
|
+
// heavy-bar glyph is not HTML-significant, so it needs no escaping.
|
|
145
222
|
if (lines.length > 0)
|
|
146
223
|
lines.push('━━━━━━━━━━━━');
|
|
147
224
|
}
|
|
148
|
-
|
|
225
|
+
// Turn-status header. v0.27.0 M4 — a failed turn shows "❌ <reason>" so it
|
|
226
|
+
// never dies as an eternal "…"; reason is HTML-escaped (it's an error message).
|
|
227
|
+
const header = turn.state === 'failed'
|
|
228
|
+
? `❌ ${escapeHtml(turn.failReason ?? 'Turn failed')}`
|
|
229
|
+
: turn.state === 'done'
|
|
230
|
+
? '✓ Done'
|
|
231
|
+
: '▶ Working';
|
|
149
232
|
lines.push(header);
|
|
150
233
|
if (turn.toolCalls.length > 0) {
|
|
151
234
|
for (const tc of turn.toolCalls) {
|
|
152
235
|
lines.push(renderToolLine(tc));
|
|
236
|
+
// v0.27.0 M2 — surface the tool's RESULT as a truncated <pre><code> block
|
|
237
|
+
// under its line (CLI-style inline output), when there's real text.
|
|
238
|
+
const resultText = toolResultText(tc);
|
|
239
|
+
if (resultText)
|
|
240
|
+
lines.push(pre(truncateResult(resultText)));
|
|
153
241
|
}
|
|
154
242
|
}
|
|
155
243
|
// v0.26.2 M4 — todo checklist (real data from the agent's TodoWrite calls).
|
|
244
|
+
// Escaped as a block (glyphs are safe; content + the "+N more" plus sign are
|
|
245
|
+
// not, so the whole block goes through the escaper).
|
|
156
246
|
const todoBlock = renderTodos(meta);
|
|
157
247
|
if (todoBlock) {
|
|
158
248
|
lines.push('');
|
|
159
|
-
lines.push(todoBlock);
|
|
249
|
+
lines.push(escapeHtml(todoBlock));
|
|
160
250
|
}
|
|
161
251
|
// Defensive default — Turn.thinkingText is required by the interface, but
|
|
162
252
|
// some test helpers and pre-M6 fixtures construct Turn-shaped objects
|
|
@@ -169,7 +259,10 @@ export function renderTurn(turn, meta) {
|
|
|
169
259
|
const text = turn.assistantText.trim();
|
|
170
260
|
if (text.length > 0) {
|
|
171
261
|
lines.push('');
|
|
172
|
-
|
|
262
|
+
// v0.27.0 M1 — render the model's markdown as Telegram HTML with structure
|
|
263
|
+
// preserved (**bold**→<b>, `code`→<code>, ```bash fences→<pre><code
|
|
264
|
+
// class="language-bash">). HTML-escapes all remaining content (& < >).
|
|
265
|
+
lines.push(markdownToHtml(text));
|
|
173
266
|
}
|
|
174
267
|
return lines.join('\n');
|
|
175
268
|
}
|
|
@@ -185,4 +278,3 @@ export function planRenderAction(turn, knownMessageId) {
|
|
|
185
278
|
}
|
|
186
279
|
return { type: 'edit', chatId: turn.chatId, text, messageId: knownMessageId };
|
|
187
280
|
}
|
|
188
|
-
//# sourceMappingURL=card-renderer.js.map
|
|
@@ -38,7 +38,7 @@ export interface StreamEvent {
|
|
|
38
38
|
error?: unknown;
|
|
39
39
|
result?: string;
|
|
40
40
|
}
|
|
41
|
-
export type TurnState = 'working' | 'done';
|
|
41
|
+
export type TurnState = 'working' | 'done' | 'failed';
|
|
42
42
|
export interface ToolCallRecord {
|
|
43
43
|
/** Tool name (e.g. "Bash", "Read", "Edit"). */
|
|
44
44
|
name: string;
|
|
@@ -58,8 +58,11 @@ export interface Turn {
|
|
|
58
58
|
state: TurnState;
|
|
59
59
|
/** Monotonic timestamp (Date.now()) when the turn started. */
|
|
60
60
|
startedAt: number;
|
|
61
|
-
/** Set when the turn transitions to 'done'. */
|
|
61
|
+
/** Set when the turn transitions to 'done' or 'failed'. */
|
|
62
62
|
endedAt?: number;
|
|
63
|
+
/** Set when the turn transitions to 'failed' (M4) — a short failure reason
|
|
64
|
+
* surfaced on the card so a turn never dies as an eternal "…". */
|
|
65
|
+
failReason?: string;
|
|
63
66
|
/** Tool calls observed during the turn, in arrival order. */
|
|
64
67
|
toolCalls: ToolCallRecord[];
|
|
65
68
|
/** Accumulated assistant text (concatenation of text events). */
|
|
@@ -90,6 +93,13 @@ export declare class TurnStateMachine {
|
|
|
90
93
|
* endedAt. Returns the finalized turn, or undefined if no turn was active.
|
|
91
94
|
*/
|
|
92
95
|
end(chatId: string, now?: number): Turn | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Fail the active turn for chatId (M4). Transitions state to 'failed', stamps
|
|
98
|
+
* endedAt, and records a short reason so renderTurn can show "❌ <reason>"
|
|
99
|
+
* instead of leaving the card frozen at "…". Returns the failed turn, or
|
|
100
|
+
* undefined if no turn was active.
|
|
101
|
+
*/
|
|
102
|
+
fail(chatId: string, reason: string, now?: number): Turn | undefined;
|
|
93
103
|
/**
|
|
94
104
|
* Returns the active or most-recently-ended turn for chatId.
|
|
95
105
|
*/
|
|
@@ -52,10 +52,30 @@ export class TurnStateMachine {
|
|
|
52
52
|
if (turn.state !== 'working')
|
|
53
53
|
return turn;
|
|
54
54
|
if (event.type === 'tool_use') {
|
|
55
|
+
const id = event.id ?? event.tool_use_id ?? '';
|
|
56
|
+
// Dedup by tool-use id. claude.exe emits each tool_use TWICE — once at
|
|
57
|
+
// `content_block_start` with empty input, then again in the aggregate
|
|
58
|
+
// `assistant` message with the fully-assembled input. Both fires carry
|
|
59
|
+
// the same block id. Without this guard the card shows every tool twice
|
|
60
|
+
// (a bare line + a detailed line), doubles the 🔧 count, and the
|
|
61
|
+
// tool_result `.find()` below resolves only the FIRST record so the
|
|
62
|
+
// detailed line never flips … → ✓. Merge the richer payload into the
|
|
63
|
+
// existing record instead of pushing a duplicate.
|
|
64
|
+
if (id) {
|
|
65
|
+
const existing = turn.toolCalls.find((tc) => tc.toolUseId === id);
|
|
66
|
+
if (existing) {
|
|
67
|
+
const incoming = event.tool?.input;
|
|
68
|
+
if (incoming && Object.keys(incoming).length > 0)
|
|
69
|
+
existing.input = incoming;
|
|
70
|
+
if (existing.name === 'Unknown' && event.tool?.name)
|
|
71
|
+
existing.name = event.tool.name;
|
|
72
|
+
return turn;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
55
75
|
turn.toolCalls.push({
|
|
56
76
|
name: event.tool?.name ?? 'Unknown',
|
|
57
77
|
input: event.tool?.input ?? {},
|
|
58
|
-
toolUseId:
|
|
78
|
+
toolUseId: id,
|
|
59
79
|
});
|
|
60
80
|
return turn;
|
|
61
81
|
}
|
|
@@ -100,6 +120,21 @@ export class TurnStateMachine {
|
|
|
100
120
|
turn.endedAt = now;
|
|
101
121
|
return turn;
|
|
102
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Fail the active turn for chatId (M4). Transitions state to 'failed', stamps
|
|
125
|
+
* endedAt, and records a short reason so renderTurn can show "❌ <reason>"
|
|
126
|
+
* instead of leaving the card frozen at "…". Returns the failed turn, or
|
|
127
|
+
* undefined if no turn was active.
|
|
128
|
+
*/
|
|
129
|
+
fail(chatId, reason, now = Date.now()) {
|
|
130
|
+
const turn = this.turns.get(chatId);
|
|
131
|
+
if (!turn)
|
|
132
|
+
return undefined;
|
|
133
|
+
turn.state = 'failed';
|
|
134
|
+
turn.failReason = reason;
|
|
135
|
+
turn.endedAt = now;
|
|
136
|
+
return turn;
|
|
137
|
+
}
|
|
103
138
|
/**
|
|
104
139
|
* Returns the active or most-recently-ended turn for chatId.
|
|
105
140
|
*/
|
|
@@ -114,4 +149,3 @@ export class TurnStateMachine {
|
|
|
114
149
|
this.turns.delete(chatId);
|
|
115
150
|
}
|
|
116
151
|
}
|
|
117
|
-
//# sourceMappingURL=state-machine.js.map
|
|
@@ -80,6 +80,23 @@ export declare function pushAssistantText(text: string): void;
|
|
|
80
80
|
* finalizes ALL active cards (one at a time in practice).
|
|
81
81
|
*/
|
|
82
82
|
export declare function finalizeActiveCards(): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Map a caught error to a short, user-readable card reason (v0.27.0 M4). Keeps
|
|
85
|
+
* the "❌ <reason>" header concise and classifies the common cc-openclaw-side
|
|
86
|
+
* failures (its own watchdog kill / dead subprocess / timeout) rather than
|
|
87
|
+
* dumping a raw stack.
|
|
88
|
+
*/
|
|
89
|
+
export declare function classifyFailure(err: unknown): string;
|
|
90
|
+
/**
|
|
91
|
+
* Fail every active card (v0.27.0 M4). Called from the openai-compat handlers'
|
|
92
|
+
* catch path when cc-openclaw's OWN turn errors — its subprocess died, its
|
|
93
|
+
* stalled-session watchdog SIGTERMed it, or the model call threw/timed out. The
|
|
94
|
+
* card flips to "❌ <reason>" instead of being left as an eternal "…" (or worse,
|
|
95
|
+
* finalized to a misleading "✓ Done"). Scoped to cc-openclaw's own vantage; the
|
|
96
|
+
* gateway's recovery=none stalls that never throw here are out of M4's reach.
|
|
97
|
+
* Best-effort: a fail-render failure must not mask the original error.
|
|
98
|
+
*/
|
|
99
|
+
export declare function failActiveCards(reason: string): Promise<void>;
|
|
83
100
|
/**
|
|
84
101
|
* Test-only — reset module-level repaint state. Card state lives in
|
|
85
102
|
* card-state.ts so import that and clear directly if your test needs it.
|