@xopcai/xopc 0.0.82 → 0.0.83
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/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/outbound/media-load.js +2 -3
- package/dist/extensions/feishu/src/outbound/media-load.js.map +1 -1
- package/dist/extensions/feishu/src/schema/config-schema.d.ts +6 -6
- package/dist/extensions/telegram/src/config-schema.d.ts +6 -6
- package/dist/extensions/telegram/src/plugin.d.ts +1 -1
- package/dist/extensions/telegram/src/plugin.js +1 -1
- package/dist/extensions/telegram/src/routing-integration.js +2 -2
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/api/api.js +3 -3
- package/dist/extensions/weixin/src/auth/accounts.js +1 -1
- package/dist/extensions/weixin/src/cdn/upload.js +1 -1
- package/dist/extensions/weixin/src/config-schema.d.ts +3 -3
- package/dist/extensions/weixin/src/media/data-url.js +1 -1
- package/dist/extensions/weixin/src/messaging/debug-mode.js +1 -1
- package/dist/extensions/weixin/src/messaging/inbound.js +1 -1
- package/dist/extensions/weixin/src/messaging/process-message.js +1 -1
- package/dist/extensions/weixin/src/plugin.js +1 -1
- package/dist/extensions/weixin/src/storage/sync-buf.js +1 -1
- package/dist/gateway/static/root/assets/agents-CrpYTHJS.js +222 -0
- package/dist/gateway/static/root/assets/{apps-page-pJ27dsqn.js → apps-page-1mcKh5Rh.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-zd6QNKPx.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-D1KYmOmi.js → channels-status-swr-uRAuhiUo.js} +1 -1
- package/dist/gateway/static/root/assets/{cron-api-Y2wfSJVI.js → cron-api-O2Q_ruV6.js} +1 -1
- package/dist/gateway/static/root/assets/{cron-page-B97KU_RG.js → cron-page-By09AQD-.js} +1 -1
- package/dist/gateway/static/root/assets/{dist-CboA_Css.js → dist-BpQxde0t.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DN_zNmpo.js → extension-debug-page-CY27wj_p.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BUXtOzv5.js → extension-page-C-Ed5ZmP.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-C2dX4KCW.js → extension-settings-page-raLux7E7.js} +1 -1
- package/dist/gateway/static/root/assets/fetch-2iRFmd3n.js +3 -0
- package/dist/gateway/static/root/assets/{field-primitives-B9rOLqdm.js → field-primitives-fa_hiQcX.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-config-api-DvfiRVrc.js → heartbeat-config-api-BVl5VHvL.js} +1 -1
- package/dist/gateway/static/root/assets/index-BuFldCsB.css +1 -0
- package/dist/gateway/static/root/assets/{index-DQuaMye9.js → index-Y-iqo-gL.js} +94 -85
- package/dist/gateway/static/root/assets/{logs-page-BQuBpHcc.js → logs-page-BdH2n7ZW.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-Vpchzdp-.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-2Yu-FASs.js → settings-form-section-Kk1yAGBl.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-KBm0u6Dz.js +3 -0
- package/dist/gateway/static/root/assets/skills-page-BjeXXaOn.js +2 -0
- package/dist/gateway/static/root/assets/{theme-store-DnwYutiX.js → theme-store-D01dJt95.js} +1 -1
- package/dist/gateway/static/root/assets/{utils-D2Gn2qod.js → utils-DpTxN4AF.js} +1 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-CwO8Cf01.js +1 -0
- package/dist/gateway/static/root/index.html +4 -4
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-instance-gateway.d.ts +50 -0
- package/dist/src/agent/agent-instance-gateway.js +1 -0
- package/dist/src/agent/agent-manager.d.ts +20 -14
- package/dist/src/agent/agent-manager.js +74 -186
- package/dist/src/agent/agent-manager.js.map +1 -1
- package/dist/src/agent/background-review/coordinator.d.ts +61 -0
- package/dist/src/agent/background-review/coordinator.js +120 -0
- package/dist/src/agent/background-review/coordinator.js.map +1 -0
- package/dist/src/agent/bootstrap/load-bootstrap-files.js +1 -1
- package/dist/src/agent/child-agent-factory.d.ts +14 -0
- package/dist/src/agent/child-agent-factory.js +2 -8
- package/dist/src/agent/child-agent-factory.js.map +1 -1
- package/dist/src/agent/context/workspace-seed.js +3 -3
- package/dist/src/agent/embedded/index.d.ts +1 -2
- package/dist/src/agent/embedded/index.js +2 -3
- package/dist/src/agent/embedded/run-for-session.d.ts +2 -2
- package/dist/src/agent/embedded/run-for-session.js.map +1 -1
- package/dist/src/agent/embedded/runs.d.ts +32 -0
- package/dist/src/agent/embedded/runs.js +79 -19
- package/dist/src/agent/embedded/runs.js.map +1 -1
- package/dist/src/agent/embedded/session-manager-cache.d.ts +14 -0
- package/dist/src/agent/embedded/session-manager-cache.js +32 -11
- package/dist/src/agent/embedded/session-manager-cache.js.map +1 -1
- package/dist/src/agent/embedded/session-runner.d.ts +37 -7
- package/dist/src/agent/embedded/session-runner.js +184 -153
- package/dist/src/agent/embedded/session-runner.js.map +1 -1
- package/dist/src/agent/embedded/session-tool-result-guard.d.ts +57 -9
- package/dist/src/agent/embedded/session-tool-result-guard.js +159 -67
- package/dist/src/agent/embedded/session-tool-result-guard.js.map +1 -1
- package/dist/src/agent/goals/goal-run-store.js +4 -4
- package/dist/src/agent/goals/persistent-goal-service.d.ts +84 -0
- package/dist/src/agent/goals/persistent-goal-service.js +139 -0
- package/dist/src/agent/goals/persistent-goal-service.js.map +1 -0
- package/dist/src/agent/goals/post-turn.js +2 -2
- package/dist/src/agent/goals/state.d.ts +1 -1
- package/dist/src/agent/goals/state.js.map +1 -1
- package/dist/src/agent/image/load-image-media.js +1 -1
- package/dist/src/agent/inbound/inbound-loop.d.ts +77 -0
- package/dist/src/agent/inbound/inbound-loop.js +226 -0
- package/dist/src/agent/inbound/inbound-loop.js.map +1 -0
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +80 -0
- package/dist/src/agent/inbound/turn-dispatcher.js +138 -0
- package/dist/src/agent/inbound/turn-dispatcher.js.map +1 -0
- package/dist/src/agent/ipc/bus.js +1 -1
- package/dist/src/agent/ipc/inbox.js +2 -2
- package/dist/src/agent/ipc/socket.js +1 -1
- package/dist/src/agent/lifecycle/handlers/compaction.d.ts +1 -1
- package/dist/src/agent/lifecycle/handlers/compaction.js.map +1 -1
- package/dist/src/agent/lifecycle/manager.d.ts +1 -1
- package/dist/src/agent/lifecycle/manager.js.map +1 -1
- package/dist/src/agent/lifecycle/types.d.ts +1 -1
- package/dist/src/agent/memory/builtin-memory-store.js +1 -1
- package/dist/src/agent/memory/dreaming/deep-promotion.js +1 -1
- package/dist/src/agent/memory/dreaming/events.js +1 -1
- package/dist/src/agent/memory/dreaming/last-run.js +1 -1
- package/dist/src/agent/memory/dreaming/light-sweep.js +1 -1
- package/dist/src/agent/memory/dreaming/preview.js +1 -1
- package/dist/src/agent/memory/dreaming/rem-patterns.js +1 -1
- package/dist/src/agent/memory/dreaming/short-term-store.js +1 -1
- package/dist/src/agent/memory/dreaming/utils.d.ts +12 -2
- package/dist/src/agent/memory/dreaming/utils.js +1 -1
- package/dist/src/agent/memory/dreaming/utils.js.map +1 -1
- package/dist/src/agent/memory/index.js +3 -3
- package/dist/src/agent/memory/plugin-discovery.js +1 -1
- package/dist/src/agent/memory/prefetch-coordinator.d.ts +37 -0
- package/dist/src/agent/memory/prefetch-coordinator.js +45 -0
- package/dist/src/agent/memory/prefetch-coordinator.js.map +1 -0
- package/dist/src/agent/messaging/command-handler.d.ts +5 -1
- package/dist/src/agent/messaging/command-handler.js +24 -96
- package/dist/src/agent/messaging/command-handler.js.map +1 -1
- package/dist/src/agent/messaging/index.d.ts +1 -0
- package/dist/src/agent/messaging/index.js +2 -1
- package/dist/src/agent/messaging/message-router.d.ts +1 -1
- package/dist/src/agent/messaging/message-router.js.map +1 -1
- package/dist/src/agent/messaging/outbound-coordinator.d.ts +82 -0
- package/dist/src/agent/messaging/outbound-coordinator.js +123 -0
- package/dist/src/agent/messaging/outbound-coordinator.js.map +1 -0
- package/dist/src/agent/models/manager.js +1 -1
- package/dist/src/agent/orchestration/agent-event-handler.d.ts +36 -33
- package/dist/src/agent/orchestration/agent-event-handler.js +212 -174
- package/dist/src/agent/orchestration/agent-event-handler.js.map +1 -1
- package/dist/src/agent/orchestration/agent-orchestrator.d.ts +4 -4
- package/dist/src/agent/orchestration/agent-orchestrator.js +4 -8
- package/dist/src/agent/orchestration/agent-orchestrator.js.map +1 -1
- package/dist/src/agent/orchestration/index.d.ts +1 -1
- package/dist/src/agent/orchestration/index.js +2 -2
- package/dist/src/agent/prompt/service-prompt-builder.js +4 -4
- package/dist/src/agent/reply/post-compaction-context.js +1 -1
- package/dist/src/agent/reply/workspace-boundary-read.js +1 -1
- package/dist/src/agent/sandbox/path-policy.js +1 -1
- package/dist/src/agent/service/async-queue.d.ts +20 -0
- package/dist/src/agent/service/async-queue.js +53 -0
- package/dist/src/agent/service/async-queue.js.map +1 -0
- package/dist/src/agent/service/build-direct-message-content.d.ts +2 -2
- package/dist/src/agent/service/build-direct-message-content.js.map +1 -1
- package/dist/src/agent/service/direct-turn-helpers.d.ts +70 -0
- package/dist/src/agent/service/direct-turn-helpers.js +90 -0
- package/dist/src/agent/service/direct-turn-helpers.js.map +1 -0
- package/dist/src/agent/service/process-direct-one-shot.d.ts +3 -3
- package/dist/src/agent/service/process-direct-one-shot.js +17 -34
- package/dist/src/agent/service/process-direct-one-shot.js.map +1 -1
- package/dist/src/agent/service/process-direct-streaming.d.ts +2 -2
- package/dist/src/agent/service/process-direct-streaming.js +122 -168
- package/dist/src/agent/service/process-direct-streaming.js.map +1 -1
- package/dist/src/agent/service/webchat-tts.d.ts +2 -2
- package/dist/src/agent/service/webchat-tts.js +1 -1
- package/dist/src/agent/service/webchat-tts.js.map +1 -1
- package/dist/src/agent/service.d.ts +62 -167
- package/dist/src/agent/service.js +177 -786
- package/dist/src/agent/service.js.map +1 -1
- package/dist/src/agent/session/index.d.ts +4 -0
- package/dist/src/agent/session/index.js +5 -1
- package/dist/src/agent/session/session-config-service.d.ts +68 -0
- package/dist/src/agent/session/session-config-service.js +172 -0
- package/dist/src/agent/session/session-config-service.js.map +1 -0
- package/dist/src/agent/session/session-context.d.ts +27 -19
- package/dist/src/agent/session/session-context.js +39 -24
- package/dist/src/agent/session/session-context.js.map +1 -1
- package/dist/src/agent/session/session-hydrator.d.ts +42 -0
- package/dist/src/agent/session/session-hydrator.js +66 -0
- package/dist/src/agent/session/session-hydrator.js.map +1 -0
- package/dist/src/agent/session/session-inspector.d.ts +80 -0
- package/dist/src/agent/session/session-inspector.js +119 -0
- package/dist/src/agent/session/session-inspector.js.map +1 -0
- package/dist/src/agent/session/session-state-bag.d.ts +83 -0
- package/dist/src/agent/session/session-state-bag.js +192 -0
- package/dist/src/agent/session/session-state-bag.js.map +1 -0
- package/dist/src/agent/skills/config.js +1 -1
- package/dist/src/agent/skills/hub-hash.js +2 -2
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/skills/hub-pull.js +2 -2
- package/dist/src/agent/skills/index.d.ts +0 -2
- package/dist/src/agent/skills/index.js +3 -5
- package/dist/src/agent/skills/index.js.map +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/marketplace/adapters/clawhub/adapter.js +11 -6
- package/dist/src/agent/skills/marketplace/adapters/clawhub/adapter.js.map +1 -1
- package/dist/src/agent/skills/marketplace/adapters/skillhub/adapter.js +35 -7
- package/dist/src/agent/skills/marketplace/adapters/skillhub/adapter.js.map +1 -1
- package/dist/src/agent/skills/scanner.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +2 -2
- package/dist/src/agent/skills/skill-manager.js +1 -1
- package/dist/src/agent/tools/browser/tool/browser-use-tool.d.ts +7 -0
- package/dist/src/agent/tools/browser/tool/browser-use-tool.js +37 -0
- package/dist/src/agent/tools/browser/tool/browser-use-tool.js.map +1 -1
- package/dist/src/agent/tools/delegate-tool.d.ts +7 -0
- package/dist/src/agent/tools/delegate-tool.js +2 -1
- package/dist/src/agent/tools/delegate-tool.js.map +1 -1
- package/dist/src/agent/tools/dreaming-tool.js +1 -1
- package/dist/src/agent/tools/executor.d.ts +34 -15
- package/dist/src/agent/tools/executor.js +44 -79
- package/dist/src/agent/tools/executor.js.map +1 -1
- package/dist/src/agent/tools/factory.d.ts +6 -0
- package/dist/src/agent/tools/factory.js +63 -4
- package/dist/src/agent/tools/factory.js.map +1 -1
- package/dist/src/agent/tools/image-generate-tool.js +1 -1
- package/dist/src/agent/tools/send-media.js +1 -1
- package/dist/src/agent/tools/skill-manage-tool.js +1 -1
- package/dist/src/agent/tools/skills-tools.js +1 -1
- package/dist/src/agent/tools/tts-tool.js +1 -1
- package/dist/src/agent/tools/write.js +1 -1
- package/dist/src/agent/workspace-runtime/registry.d.ts +48 -0
- package/dist/src/agent/workspace-runtime/registry.js +59 -0
- package/dist/src/agent/workspace-runtime/registry.js.map +1 -0
- package/dist/src/auth/credentials.js +3 -3
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +1 -1
- package/dist/src/browser/cdp-local-launcher.js +4 -3
- package/dist/src/browser/cdp-local-launcher.js.map +1 -1
- package/dist/src/browser/index.d.ts +1 -0
- package/dist/src/browser/index.js +2 -1
- package/dist/src/browser/manager.js +3 -2
- package/dist/src/browser/manager.js.map +1 -1
- package/dist/src/browser/providers/browser-ext-install.js +4 -4
- package/dist/src/browser/providers/browser-use.js +2 -1
- package/dist/src/browser/providers/browser-use.js.map +1 -1
- package/dist/src/browser/providers/browserbase.js +2 -1
- package/dist/src/browser/providers/browserbase.js.map +1 -1
- package/dist/src/browser/providers/cloakbrowser.js +7 -6
- package/dist/src/browser/providers/cloakbrowser.js.map +1 -1
- package/dist/src/browser/providers/playwright-doctor.d.ts +2 -0
- package/dist/src/browser/providers/playwright-doctor.js +7 -3
- package/dist/src/browser/providers/playwright-doctor.js.map +1 -1
- package/dist/src/browser/readiness.d.ts +33 -0
- package/dist/src/browser/readiness.js +138 -0
- package/dist/src/browser/readiness.js.map +1 -0
- package/dist/src/browser/stealth.js +2 -2
- package/dist/src/channels/attachments/inbound-persist.js +1 -1
- package/dist/src/channels/attachments/outbound-tts-persist.js +1 -1
- package/dist/src/channels/channel-domain.d.ts +1 -1
- package/dist/src/channels/config-helpers.d.ts +1 -1
- package/dist/src/channels/config-helpers.js.map +1 -1
- package/dist/src/channels/heartbeat-scheduler.d.ts +40 -0
- package/dist/src/channels/heartbeat-scheduler.js +94 -0
- package/dist/src/channels/heartbeat-scheduler.js.map +1 -0
- package/dist/src/channels/lifecycle-supervisor.d.ts +81 -0
- package/dist/src/channels/lifecycle-supervisor.js +263 -0
- package/dist/src/channels/lifecycle-supervisor.js.map +1 -0
- package/dist/src/channels/manager.d.ts +34 -68
- package/dist/src/channels/manager.js +107 -477
- package/dist/src/channels/manager.js.map +1 -1
- package/dist/src/channels/outbound/deliver.d.ts +1 -1
- package/dist/src/channels/outbound/deliver.js.map +1 -1
- package/dist/src/channels/outbound/persist-store.js +1 -1
- package/dist/src/channels/outbound-sender.d.ts +51 -0
- package/dist/src/channels/outbound-sender.js +125 -0
- package/dist/src/channels/outbound-sender.js.map +1 -0
- package/dist/src/channels/pairing/allow-from-file.js +1 -1
- package/dist/src/channels/pairing/pairing-service.d.ts +3 -10
- package/dist/src/channels/pairing/pairing-service.js.map +1 -1
- package/dist/src/channels/pairing/pairing-store.js +2 -2
- package/dist/src/channels/pairing/pairing-types.d.ts +15 -0
- package/dist/src/channels/pairing/pairing-types.js +1 -0
- package/dist/src/channels/plugin-registry.d.ts +22 -0
- package/dist/src/channels/plugin-registry.js +44 -0
- package/dist/src/channels/plugin-registry.js.map +1 -0
- package/dist/src/channels/plugin-types.d.ts +1 -1
- package/dist/src/channels/plugins/types.adapters.d.ts +2 -2
- package/dist/src/channels/security-helpers.d.ts +1 -1
- package/dist/src/channels/security-helpers.js.map +1 -1
- package/dist/src/channels/setup-wizard.d.ts +1 -1
- package/dist/src/chat-commands/builtins/config.js +2 -2
- package/dist/src/chat-commands/context.js +1 -1
- package/dist/src/cli/commands/agent/stream-renderer.js +1 -1
- package/dist/src/cli/commands/agent/stream-renderer.js.map +1 -1
- package/dist/src/cli/commands/agent.js +4 -4
- package/dist/src/cli/commands/agent.js.map +1 -1
- package/dist/src/cli/commands/browser-cli-helpers.js +2 -1
- package/dist/src/cli/commands/browser-cli-helpers.js.map +1 -1
- package/dist/src/cli/commands/doctor/checks/config-health.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/doctor/checks/session-integrity.js +1 -1
- package/dist/src/cli/commands/doctor/checks/state-integrity.js +1 -1
- package/dist/src/cli/commands/doctor/checks/workspace-status.js +1 -1
- package/dist/src/cli/commands/extension-dev.js +2 -2
- package/dist/src/cli/commands/extension-dev.js.map +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +2 -2
- package/dist/src/cli/commands/extension-marketplace.js.map +1 -1
- package/dist/src/cli/commands/extension-pack.js +1 -1
- package/dist/src/cli/commands/gateway/call.js +1 -1
- package/dist/src/cli/commands/gateway/call.js.map +1 -1
- package/dist/src/cli/commands/gateway/health.js +1 -1
- package/dist/src/cli/commands/gateway/health.js.map +1 -1
- package/dist/src/cli/commands/gateway/lifecycle-core.d.ts +31 -12
- package/dist/src/cli/commands/gateway/lifecycle-core.js +167 -116
- package/dist/src/cli/commands/gateway/lifecycle-core.js.map +1 -1
- package/dist/src/cli/commands/gateway/lifecycle.d.ts +11 -0
- package/dist/src/cli/commands/gateway/lifecycle.js +102 -0
- package/dist/src/cli/commands/gateway/lifecycle.js.map +1 -0
- package/dist/src/cli/commands/gateway/logs.js +1 -1
- package/dist/src/cli/commands/gateway/logs.js.map +1 -1
- package/dist/src/cli/commands/gateway/probe.js +1 -1
- package/dist/src/cli/commands/gateway/probe.js.map +1 -1
- package/dist/src/cli/commands/gateway/restart-health.d.ts +12 -0
- package/dist/src/cli/commands/gateway/restart-health.js +45 -1
- package/dist/src/cli/commands/gateway/restart-health.js.map +1 -1
- package/dist/src/cli/commands/gateway/restart.js +3 -3
- package/dist/src/cli/commands/gateway/restart.js.map +1 -1
- package/dist/src/cli/commands/gateway/run-foreground.d.ts +0 -1
- package/dist/src/cli/commands/gateway/run-foreground.js +0 -35
- package/dist/src/cli/commands/gateway/run-foreground.js.map +1 -1
- package/dist/src/cli/commands/gateway/service.js +1 -1
- package/dist/src/cli/commands/gateway/service.js.map +1 -1
- package/dist/src/cli/commands/gateway/shared.d.ts +3 -0
- package/dist/src/cli/commands/gateway/shared.js +54 -0
- package/dist/src/cli/commands/gateway/shared.js.map +1 -0
- package/dist/src/cli/commands/gateway/status.js +1 -1
- package/dist/src/cli/commands/gateway/status.js.map +1 -1
- package/dist/src/cli/commands/gateway/stop.js +2 -2
- package/dist/src/cli/commands/gateway/stop.js.map +1 -1
- package/dist/src/cli/commands/gateway/token.js +1 -1
- package/dist/src/cli/commands/gateway/token.js.map +1 -1
- package/dist/src/cli/commands/gateway.js +5 -5
- package/dist/src/cli/commands/gateway.js.map +1 -1
- package/dist/src/cli/commands/image.js +2 -2
- package/dist/src/cli/commands/image.js.map +1 -1
- package/dist/src/cli/commands/init.js +4 -4
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/models.js.map +1 -1
- package/dist/src/cli/commands/onboard/gateway.d.ts +0 -8
- package/dist/src/cli/commands/onboard/gateway.js +48 -49
- package/dist/src/cli/commands/onboard/gateway.js.map +1 -1
- package/dist/src/cli/commands/onboard.js +9 -64
- package/dist/src/cli/commands/onboard.js.map +1 -1
- package/dist/src/cli/commands/session/utils.js +1 -1
- package/dist/src/cli/commands/session/utils.js.map +1 -1
- package/dist/src/cli/commands/skills.js +1 -1
- package/dist/src/cli/commands/tailscale.js +1 -1
- package/dist/src/cli/commands/tailscale.js.map +1 -1
- package/dist/src/cli/context.d.ts +20 -0
- package/dist/src/cli/context.js +23 -0
- package/dist/src/cli/context.js.map +1 -0
- package/dist/src/cli/extension-cli-register.js +3 -3
- package/dist/src/cli/gateway-run-argv.js +1 -4
- package/dist/src/cli/gateway-run-argv.js.map +1 -1
- package/dist/src/cli/gateway-run-fast-path.js +1 -1
- package/dist/src/cli/gateway-run-fast-path.js.map +1 -1
- package/dist/src/cli/index.d.ts +1 -7
- package/dist/src/cli/index.js +4 -6
- package/dist/src/cli/index.js.map +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +2 -2
- package/dist/src/config/commands.flags.d.ts +3 -0
- package/dist/src/config/commands.flags.js +11 -0
- package/dist/src/config/commands.flags.js.map +1 -0
- package/dist/src/config/index.d.ts +1 -0
- package/dist/src/config/index.js +6 -5
- package/dist/src/config/index.js.map +1 -1
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.js +2 -2
- package/dist/src/config/profile.js +2 -2
- package/dist/src/config/schema.d.ts +11 -4
- package/dist/src/config/schema.js +13 -12
- package/dist/src/config/schema.js.map +1 -1
- package/dist/src/config/workspace-path-helpers.d.ts +15 -0
- package/dist/src/config/workspace-path-helpers.js +14 -0
- package/dist/src/config/workspace-path-helpers.js.map +1 -0
- package/dist/src/cron/executor.js +4 -4
- package/dist/src/cron/executor.js.map +1 -1
- package/dist/src/cron/persistence.js +1 -1
- package/dist/src/cron/run-log-store.js +1 -1
- package/dist/src/daemon/index.d.ts +0 -1
- package/dist/src/daemon/index.js +1 -2
- package/dist/src/daemon/install-plan.js +3 -2
- package/dist/src/daemon/install-plan.js.map +1 -1
- package/dist/src/daemon/launchd.js +2 -2
- package/dist/src/daemon/systemd.js +2 -2
- package/dist/src/daemon/types.d.ts +0 -6
- package/dist/src/extensions/api.d.ts +1 -1
- package/dist/src/extensions/api.js +2 -2
- package/dist/src/extensions/api.js.map +1 -1
- package/dist/src/extensions/bundle-mcp.js +1 -1
- package/dist/src/extensions/discover-extensions.js +1 -1
- package/dist/src/extensions/extension-registry-impl.d.ts +51 -0
- package/dist/src/extensions/extension-registry-impl.js +117 -0
- package/dist/src/extensions/extension-registry-impl.js.map +1 -0
- package/dist/src/extensions/health.js +1 -1
- package/dist/src/extensions/index.js +3 -2
- package/dist/src/extensions/loader.d.ts +3 -43
- package/dist/src/extensions/loader.js +3 -110
- package/dist/src/extensions/loader.js.map +1 -1
- package/dist/src/extensions/lockfile.js +2 -2
- package/dist/src/extensions/sdk/index.js +2 -1
- package/dist/src/extensions/sdk/index.js.map +1 -1
- package/dist/src/extensions/types/events.d.ts +7 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/file-path-classifier.js +2 -2
- package/dist/src/gateway/heartbeat/service.js +2 -2
- package/dist/src/gateway/heartbeat/service.js.map +1 -1
- package/dist/src/gateway/hono/app.js +5 -53
- package/dist/src/gateway/hono/app.js.map +1 -1
- package/dist/src/gateway/hono/lib/extension-store.js +1 -1
- package/dist/src/gateway/hono/lib/static-ui.js +2 -2
- package/dist/src/gateway/hono/middleware/auth.d.ts +5 -14
- package/dist/src/gateway/hono/middleware/auth.js +89 -126
- package/dist/src/gateway/hono/middleware/auth.js.map +1 -1
- package/dist/src/gateway/hono/middleware/logger.js +1 -1
- package/dist/src/gateway/hono/middleware/logger.js.map +1 -1
- package/dist/src/gateway/hono/middleware/strict-rate-limit.d.ts +14 -0
- package/dist/src/gateway/hono/middleware/strict-rate-limit.js +62 -0
- package/dist/src/gateway/hono/middleware/strict-rate-limit.js.map +1 -0
- package/dist/src/gateway/hono/oauth.js +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +4 -4
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js.map +1 -1
- package/dist/src/gateway/hono/routes/browser.d.ts +20 -0
- package/dist/src/gateway/hono/routes/browser.js +626 -0
- package/dist/src/gateway/hono/routes/browser.js.map +1 -0
- package/dist/src/gateway/hono/routes/commands-skills.js +13 -13
- package/dist/src/gateway/hono/routes/commands-skills.js.map +1 -1
- package/dist/src/gateway/hono/routes/config-patch/agents.d.ts +18 -0
- package/dist/src/gateway/hono/routes/config-patch/agents.js +418 -0
- package/dist/src/gateway/hono/routes/config-patch/agents.js.map +1 -0
- package/dist/src/gateway/hono/routes/config-patch/channels.d.ts +12 -0
- package/dist/src/gateway/hono/routes/config-patch/channels.js +186 -0
- package/dist/src/gateway/hono/routes/config-patch/channels.js.map +1 -0
- package/dist/src/gateway/hono/routes/config-patch/gateway.d.ts +18 -0
- package/dist/src/gateway/hono/routes/config-patch/gateway.js +264 -0
- package/dist/src/gateway/hono/routes/config-patch/gateway.js.map +1 -0
- package/dist/src/gateway/hono/routes/config-patch/index.d.ts +9 -0
- package/dist/src/gateway/hono/routes/config-patch/index.js +6 -0
- package/dist/src/gateway/hono/routes/config-patch/misc.d.ts +23 -0
- package/dist/src/gateway/hono/routes/config-patch/misc.js +139 -0
- package/dist/src/gateway/hono/routes/config-patch/misc.js.map +1 -0
- package/dist/src/gateway/hono/routes/config-patch/result.d.ts +18 -0
- package/dist/src/gateway/hono/routes/config-patch/result.js +13 -0
- package/dist/src/gateway/hono/routes/config-patch/result.js.map +1 -0
- package/dist/src/gateway/hono/routes/config.js +20 -1764
- package/dist/src/gateway/hono/routes/config.js.map +1 -1
- package/dist/src/gateway/hono/routes/dreaming.js +2 -3
- package/dist/src/gateway/hono/routes/dreaming.js.map +1 -1
- package/dist/src/gateway/hono/routes/host-fs.js +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +10 -5
- package/dist/src/gateway/hono/routes/lazy-bundles.js.map +1 -1
- package/dist/src/gateway/hono/routes/mcp.js +1 -2
- package/dist/src/gateway/hono/routes/mcp.js.map +1 -1
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/sessions.js +32 -32
- package/dist/src/gateway/hono/routes/sessions.js.map +1 -1
- package/dist/src/gateway/hono/routes/shares.js +4 -4
- package/dist/src/gateway/hono/routes/shares.js.map +1 -1
- package/dist/src/gateway/hono/routes/tunnel.js +1 -1
- package/dist/src/gateway/hono/routes/tunnel.js.map +1 -1
- package/dist/src/gateway/hono/routes/workspace.js +6 -7
- package/dist/src/gateway/hono/routes/workspace.js.map +1 -1
- package/dist/src/gateway/hono/sse.js +2 -2
- package/dist/src/gateway/index.d.ts +1 -1
- package/dist/src/gateway/index.js +4 -2
- package/dist/src/gateway/lock.js +3 -3
- package/dist/src/gateway/rate-limit/auth-policy.d.ts +34 -0
- package/dist/src/gateway/rate-limit/auth-policy.js +49 -0
- package/dist/src/gateway/rate-limit/auth-policy.js.map +1 -0
- package/dist/src/gateway/rate-limit/buckets.d.ts +63 -0
- package/dist/src/gateway/rate-limit/buckets.js +143 -0
- package/dist/src/gateway/rate-limit/buckets.js.map +1 -0
- package/dist/src/gateway/rate-limit/env-flags.d.ts +13 -0
- package/dist/src/gateway/rate-limit/env-flags.js +16 -0
- package/dist/src/gateway/rate-limit/env-flags.js.map +1 -0
- package/dist/src/gateway/rate-limit/index.d.ts +3 -0
- package/dist/src/gateway/rate-limit/index.js +4 -0
- package/dist/src/gateway/run-loop.d.ts +1 -1
- package/dist/src/gateway/run-loop.js +24 -4
- package/dist/src/gateway/run-loop.js.map +1 -1
- package/dist/src/gateway/runtime-config.js +2 -1
- package/dist/src/gateway/runtime-config.js.map +1 -1
- package/dist/src/gateway/security/audit.js +2 -1
- package/dist/src/gateway/security/audit.js.map +1 -1
- package/dist/src/gateway/security/index.d.ts +0 -1
- package/dist/src/gateway/security/index.js +1 -2
- package/dist/src/gateway/security/loopback.d.ts +13 -0
- package/dist/src/gateway/security/loopback.js +45 -0
- package/dist/src/gateway/security/loopback.js.map +1 -0
- package/dist/src/gateway/service/agent-runner.d.ts +108 -0
- package/dist/src/gateway/service/agent-runner.js +184 -0
- package/dist/src/gateway/service/agent-runner.js.map +1 -0
- package/dist/src/gateway/service/config-coordinator.d.ts +119 -0
- package/dist/src/gateway/service/config-coordinator.js +351 -0
- package/dist/src/gateway/service/config-coordinator.js.map +1 -0
- package/dist/src/gateway/service/marketplace-service.d.ts +85 -0
- package/dist/src/gateway/service/marketplace-service.js +239 -0
- package/dist/src/gateway/service/marketplace-service.js.map +1 -0
- package/dist/src/gateway/service/run-gateway-agent.js +5 -5
- package/dist/src/gateway/service/run-gateway-agent.js.map +1 -1
- package/dist/src/gateway/service/sessions-api.d.ts +125 -0
- package/dist/src/gateway/service/sessions-api.js +135 -0
- package/dist/src/gateway/service/sessions-api.js.map +1 -0
- package/dist/src/gateway/service.d.ts +30 -360
- package/dist/src/gateway/service.js +121 -903
- package/dist/src/gateway/service.js.map +1 -1
- package/dist/src/gateway/workspace-fs-file-list.js +1 -1
- package/dist/src/gateway/workspace-heartbeat-path.js +1 -2
- package/dist/src/gateway/workspace-heartbeat-path.js.map +1 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/infra/gateway-process-argv.d.ts +4 -0
- package/dist/src/infra/gateway-process-argv.js +26 -0
- package/dist/src/infra/gateway-process-argv.js.map +1 -0
- package/dist/src/infra/gateway-processes.d.ts +5 -0
- package/dist/src/infra/gateway-processes.js +65 -0
- package/dist/src/infra/gateway-processes.js.map +1 -0
- package/dist/src/infra/rate-limit/failure-limiter.d.ts +50 -0
- package/dist/src/infra/rate-limit/failure-limiter.js +100 -0
- package/dist/src/infra/rate-limit/failure-limiter.js.map +1 -0
- package/dist/src/infra/rate-limit/index.d.ts +5 -0
- package/dist/src/infra/rate-limit/index.js +3 -0
- package/dist/src/infra/rate-limit/keyed-store.d.ts +34 -0
- package/dist/src/infra/rate-limit/keyed-store.js +44 -0
- package/dist/src/infra/rate-limit/keyed-store.js.map +1 -0
- package/dist/src/infra/rate-limit/rate-limiter.d.ts +39 -0
- package/dist/src/infra/rate-limit/rate-limiter.js +65 -0
- package/dist/src/infra/rate-limit/rate-limiter.js.map +1 -0
- package/dist/src/infra/restart.d.ts +21 -0
- package/dist/src/infra/restart.js +122 -0
- package/dist/src/infra/restart.js.map +1 -0
- package/dist/src/infra/update-check.js +1 -1
- package/dist/src/infra/update-lock.js +3 -3
- package/dist/src/infra/update-runner.js +1 -1
- package/dist/src/infra/update-startup.js +2 -2
- package/dist/src/infra/write-file-atomic.js +2 -2
- package/dist/src/mcp/channel-bridge.d.ts +0 -6
- package/dist/src/mcp/channel-bridge.js +1 -5
- package/dist/src/mcp/channel-bridge.js.map +1 -1
- package/dist/src/media-shared/http/ssrf-guard.js +1 -1
- package/dist/src/providers/auth-runtime/auth-profile-store.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/session/config-store.js +2 -2
- package/dist/src/session/parity/jsonl-transcript-io.js +2 -2
- package/dist/src/session/parity/sessions-json-file-read.d.ts +2 -1
- package/dist/src/session/parity/sessions-json-file-read.js.map +1 -1
- package/dist/src/session/parity/sessions-json-file.js +1 -1
- package/dist/src/session/parity/transcript-file-lock.js +2 -2
- package/dist/src/session/parity/transcript-paths.js +1 -1
- package/dist/src/session/search-index-cache.js +1 -1
- package/dist/src/session/search-index.js +1 -1
- package/dist/src/session/session-title.js +1 -1
- package/dist/src/session/store.js +5 -5
- package/dist/src/share/share-rate-limit.d.ts +10 -2
- package/dist/src/share/share-rate-limit.js +33 -42
- package/dist/src/share/share-rate-limit.js.map +1 -1
- package/dist/src/share/share-store.js +3 -3
- package/dist/src/tui/backends/embedded-backend.js +16 -12
- package/dist/src/tui/backends/embedded-backend.js.map +1 -1
- package/dist/src/tui/clipboard-image.js +2 -2
- package/dist/src/tui/extension-host/load-extensions.js +1 -1
- package/dist/src/tui/format-tui-hotkeys.js +1 -1
- package/dist/src/tui/theme-manager.js +1 -1
- package/dist/src/tui/tui-keybindings-file.js +1 -1
- package/dist/src/tui/tui-scoped-models.js +1 -1
- package/dist/src/tui/tui-settings.js +1 -1
- package/dist/src/tui/tui-skills-autocomplete.js +1 -1
- package/dist/src/tui/tui.js +1 -2
- package/dist/src/tui/tui.js.map +1 -1
- package/dist/src/tui/xopc-tui-keybindings.d.ts +0 -1
- package/dist/src/tui/xopc-tui-keybindings.js +1 -2
- package/dist/src/tui/xopc-tui-keybindings.js.map +1 -1
- package/dist/src/tunnel/frpc-binary.js +2 -2
- package/dist/src/tunnel/frpc-config.js +1 -1
- package/dist/src/tunnel/frpc-extract.js +1 -1
- package/dist/src/tunnel/pairing-rate-limit.d.ts +10 -2
- package/dist/src/tunnel/pairing-rate-limit.js +19 -15
- package/dist/src/tunnel/pairing-rate-limit.js.map +1 -1
- package/dist/src/tunnel/tunnel-rate-limit.d.ts +6 -3
- package/dist/src/tunnel/tunnel-rate-limit.js +11 -22
- package/dist/src/tunnel/tunnel-rate-limit.js.map +1 -1
- package/dist/src/tunnel/tunnel-state.js +1 -1
- package/dist/src/utils/logger/audit.js +1 -1
- package/dist/src/utils/logger/log-store.js +1 -1
- package/dist/src/utils/logger/rotation.js +1 -1
- package/dist/src/utils/logger/stats.d.ts +1 -1
- package/dist/src/voice/tts/audio.js +1 -1
- package/dist/src/voice/tts/factory.js +1 -1
- package/dist/src/voice/tts/index.js +2 -2
- package/dist/src/voice/tts/merge-config.js +1 -1
- package/dist/src/voice/tts/providers/edge-speech.js +1 -1
- package/dist/src/voice/tts/service.js +1 -1
- package/dist/src/voice/tts/service.js.map +1 -1
- package/dist/src/voice/tts/speak-core.js +1 -1
- package/package.json +10 -5
- package/dist/gateway/static/root/assets/agents-Cqh1ts38.js +0 -222
- package/dist/gateway/static/root/assets/channels-settings-wTiWStg9.js +0 -1
- package/dist/gateway/static/root/assets/fetch-BAAh_kXG.js +0 -3
- package/dist/gateway/static/root/assets/index-C8yHX-AA.css +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BeiFm0Ms.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-RPAz_Wg_.js +0 -3
- package/dist/gateway/static/root/assets/skills-page-Wu4aNWDx.js +0 -2
- package/dist/gateway/static/root/assets/voice-api-key-field-BxIGhhEL.js +0 -1
- package/dist/src/agent/embedded/session-raw-append-message.d.ts +0 -11
- package/dist/src/agent/embedded/session-raw-append-message.js +0 -15
- package/dist/src/agent/embedded/session-raw-append-message.js.map +0 -1
- package/dist/src/agent/embedded/session-tool-result-guard-wrapper.d.ts +0 -15
- package/dist/src/agent/embedded/session-tool-result-guard-wrapper.js +0 -24
- package/dist/src/agent/embedded/session-tool-result-guard-wrapper.js.map +0 -1
- package/dist/src/agent/embedded/session-tool-result-state.d.ts +0 -17
- package/dist/src/agent/embedded/session-tool-result-state.js +0 -26
- package/dist/src/agent/embedded/session-tool-result-state.js.map +0 -1
- package/dist/src/daemon/launchd-restart-handoff.d.ts +0 -25
- package/dist/src/daemon/launchd-restart-handoff.js +0 -132
- package/dist/src/daemon/launchd-restart-handoff.js.map +0 -1
- package/dist/src/gateway/auth-rate-limit.d.ts +0 -71
- package/dist/src/gateway/auth-rate-limit.js +0 -192
- package/dist/src/gateway/auth-rate-limit.js.map +0 -1
- package/dist/src/gateway/restart-handler.d.ts +0 -14
- package/dist/src/gateway/restart-handler.js +0 -64
- package/dist/src/gateway/restart-handler.js.map +0 -1
- package/dist/src/gateway/security/flood-guard.d.ts +0 -28
- package/dist/src/gateway/security/flood-guard.js +0 -42
- package/dist/src/gateway/security/flood-guard.js.map +0 -1
- package/dist/src/infra/rate-limit.d.ts +0 -38
- package/dist/src/infra/rate-limit.js +0 -60
- package/dist/src/infra/rate-limit.js.map +0 -1
- package/dist/src/infra/restart-intent.d.ts +0 -13
- package/dist/src/infra/restart-intent.js +0 -40
- package/dist/src/infra/restart-intent.js.map +0 -1
- package/dist/src/infra/restart-sentinel.d.ts +0 -23
- package/dist/src/infra/restart-sentinel.js +0 -75
- package/dist/src/infra/restart-sentinel.js.map +0 -1
- package/skills/creative/canvas-design/LICENSE.txt +0 -202
- package/skills/creative/canvas-design/SKILL-zh.md +0 -130
- package/skills/creative/canvas-design/SKILL.md +0 -130
- package/skills/creative/canvas-design/canvas-fonts/ArsenalSC-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/ArsenalSC-Regular.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/BigShoulders-Bold.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/BigShoulders-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/BigShoulders-Regular.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/Boldonse-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/Boldonse-Regular.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/BricolageGrotesque-Bold.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/BricolageGrotesque-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/BricolageGrotesque-Regular.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/CrimsonPro-Bold.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/CrimsonPro-Italic.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/CrimsonPro-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/CrimsonPro-Regular.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/DMMono-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/DMMono-Regular.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/EricaOne-OFL.txt +0 -94
- package/skills/creative/canvas-design/canvas-fonts/EricaOne-Regular.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/GeistMono-Bold.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/GeistMono-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/GeistMono-Regular.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/Gloock-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/Gloock-Regular.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/IBMPlexMono-Bold.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/IBMPlexMono-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/IBMPlexMono-Regular.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/IBMPlexSerif-Bold.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/IBMPlexSerif-BoldItalic.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/IBMPlexSerif-Italic.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/IBMPlexSerif-Regular.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/InstrumentSans-Bold.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/InstrumentSans-BoldItalic.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/InstrumentSans-Italic.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/InstrumentSans-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/InstrumentSans-Regular.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/InstrumentSerif-Italic.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/InstrumentSerif-Regular.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/Italiana-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/Italiana-Regular.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/JetBrainsMono-Bold.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/JetBrainsMono-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/JetBrainsMono-Regular.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/Jura-Light.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/Jura-Medium.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/Jura-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/LibreBaskerville-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/LibreBaskerville-Regular.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/Lora-Bold.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/Lora-BoldItalic.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/Lora-Italic.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/Lora-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/Lora-Regular.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/NationalPark-Bold.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/NationalPark-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/NationalPark-Regular.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/NothingYouCouldDo-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/NothingYouCouldDo-Regular.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/Outfit-Bold.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/Outfit-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/Outfit-Regular.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/PixelifySans-Medium.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/PixelifySans-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/PoiretOne-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/PoiretOne-Regular.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/RedHatMono-Bold.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/RedHatMono-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/RedHatMono-Regular.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/Silkscreen-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/Silkscreen-Regular.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/SmoochSans-Medium.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/SmoochSans-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/Tektur-Medium.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/Tektur-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/Tektur-Regular.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/WorkSans-Bold.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/WorkSans-BoldItalic.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/WorkSans-Italic.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/WorkSans-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/WorkSans-Regular.ttf +0 -0
- package/skills/creative/canvas-design/canvas-fonts/YoungSerif-OFL.txt +0 -93
- package/skills/creative/canvas-design/canvas-fonts/YoungSerif-Regular.ttf +0 -0
|
@@ -1,440 +1,100 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
-
import { mergeTtsConfigFromAppConfig } from "../voice/tts/merge-config.js";
|
|
4
|
-
import { maybeApplyTtsToPayload } from "../voice/tts/payload.js";
|
|
5
|
-
import "./internal-outbound.js";
|
|
6
3
|
import { ChannelHealthMonitor } from "./health-monitor.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
4
|
+
import { ChannelHeartbeatScheduler } from "./heartbeat-scheduler.js";
|
|
5
|
+
import { ChannelPluginRegistry } from "./plugin-registry.js";
|
|
6
|
+
import { ChannelOutboundSender } from "./outbound-sender.js";
|
|
7
|
+
import { ChannelLifecycleSupervisor } from "./lifecycle-supervisor.js";
|
|
11
8
|
//#region src/channels/manager.ts
|
|
12
9
|
init_logger();
|
|
13
10
|
const log = createLogger("ChannelManager");
|
|
14
|
-
function asChannelConfig(raw) {
|
|
15
|
-
if (raw && typeof raw === "object" && !Array.isArray(raw)) return raw;
|
|
16
|
-
}
|
|
17
11
|
var ChannelManager = class {
|
|
18
|
-
plugins = /* @__PURE__ */ new Map();
|
|
19
|
-
/** Plugins that completed `init()` successfully (skipped channels are not listed). */
|
|
20
|
-
initializedPluginIds = /* @__PURE__ */ new Set();
|
|
21
|
-
bus;
|
|
22
12
|
config;
|
|
23
|
-
|
|
24
|
-
running = false;
|
|
25
|
-
restartAttempts = /* @__PURE__ */ new Map();
|
|
26
|
-
/** When set, failed-start auto-restart is suppressed for that channel id. */
|
|
27
|
-
manuallyStopped = /* @__PURE__ */ new Set();
|
|
28
|
-
heartbeatTimers = /* @__PURE__ */ new Map();
|
|
29
|
-
outboundHooks;
|
|
30
|
-
persistStore;
|
|
31
|
-
_lastHeartbeatRestartAt = /* @__PURE__ */ new Map();
|
|
13
|
+
registry = new ChannelPluginRegistry();
|
|
32
14
|
healthMonitor = new ChannelHealthMonitor();
|
|
15
|
+
lifecycle;
|
|
16
|
+
heartbeat;
|
|
17
|
+
outbound;
|
|
33
18
|
sessionModelHooks;
|
|
34
|
-
/** Plugins that skipped `start()` until `startDeferredConnects()` (see `ChannelMeta.deferConnectUntilAfterListen`). */
|
|
35
|
-
deferredConnectPending = /* @__PURE__ */ new Set();
|
|
36
19
|
constructor(config, bus) {
|
|
37
|
-
this.bus = bus;
|
|
38
20
|
this.config = config;
|
|
21
|
+
this.heartbeat = new ChannelHeartbeatScheduler({
|
|
22
|
+
getConfig: () => this.config,
|
|
23
|
+
healthMonitor: this.healthMonitor,
|
|
24
|
+
requestSoftRestart: (channelId) => {
|
|
25
|
+
this.lifecycle.softRestart(channelId);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
this.lifecycle = new ChannelLifecycleSupervisor({
|
|
29
|
+
bus,
|
|
30
|
+
registry: this.registry,
|
|
31
|
+
getConfig: () => this.config,
|
|
32
|
+
getSessionModelHooks: () => this.sessionModelHooks,
|
|
33
|
+
onPluginStarted: (plugin) => this.heartbeat.schedule(plugin),
|
|
34
|
+
onPluginStopped: (pluginId) => this.heartbeat.clear(pluginId)
|
|
35
|
+
});
|
|
36
|
+
this.outbound = new ChannelOutboundSender({
|
|
37
|
+
registry: this.registry,
|
|
38
|
+
getConfig: () => this.config
|
|
39
|
+
});
|
|
39
40
|
}
|
|
40
41
|
setOutboundHooks(hooks) {
|
|
41
|
-
this.
|
|
42
|
+
this.outbound.setHooks(hooks);
|
|
42
43
|
}
|
|
43
|
-
/** Call before `initialize()` so plugins can persist per-session model overrides
|
|
44
|
+
/** Call before `initialize()` so plugins can persist per-session model overrides. */
|
|
44
45
|
setSessionModelHooks(hooks) {
|
|
45
46
|
this.sessionModelHooks = hooks;
|
|
46
47
|
}
|
|
47
48
|
enableOutboundPersistence(agentDir) {
|
|
48
|
-
this.
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Redeliver persisted outbound items (after channels are started). Best-effort; may duplicate if prior send succeeded but ack did not.
|
|
52
|
-
*/
|
|
53
|
-
async replayPendingOutboundMessages() {
|
|
54
|
-
if (!this.persistStore) return;
|
|
55
|
-
const pending = [...this.persistStore.peek()];
|
|
56
|
-
for (const p of pending) try {
|
|
57
|
-
await this.send(p.message, { skipPersist: true });
|
|
58
|
-
this.persistStore.ack(p.id);
|
|
59
|
-
} catch (err) {
|
|
60
|
-
log.error({
|
|
61
|
-
id: p.id,
|
|
62
|
-
err
|
|
63
|
-
}, "Failed to replay outbound message");
|
|
64
|
-
}
|
|
49
|
+
this.outbound.enablePersistence(agentDir);
|
|
65
50
|
}
|
|
66
51
|
registerPlugin(plugin) {
|
|
67
|
-
|
|
68
|
-
this.plugins.set(plugin.id, plugin);
|
|
69
|
-
syncChannelPluginsFromManager(this.getAllPlugins());
|
|
70
|
-
log.debug({ channel: plugin.id }, "Registered channel plugin");
|
|
52
|
+
this.registry.register(plugin);
|
|
71
53
|
}
|
|
72
54
|
getPlugin(id) {
|
|
73
|
-
return this.
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Optional channel hook before AgentService consumes an inbound message (e.g. Feishu card actions).
|
|
77
|
-
*/
|
|
78
|
-
async dispatchInboundMessageAction(msg) {
|
|
79
|
-
const handle = this.plugins.get(msg.channel)?.actions?.handleAction;
|
|
80
|
-
if (!handle) return;
|
|
81
|
-
const meta = msg.metadata;
|
|
82
|
-
if (msg.channel !== "feishu" || meta?.feishuEventType !== "card.action.trigger") return;
|
|
83
|
-
const cardAction = meta.cardAction;
|
|
84
|
-
const actionTag = cardAction && typeof cardAction.tag === "string" && cardAction.tag.trim() ? cardAction.tag.trim() : "feishu.card_action";
|
|
85
|
-
const cardCtx = meta.cardContext;
|
|
86
|
-
const openMsg = cardCtx && typeof cardCtx.open_message_id === "string" ? cardCtx.open_message_id.trim() : "";
|
|
87
|
-
const fallbackMsgId = typeof meta.messageId === "string" ? meta.messageId.trim() : "";
|
|
88
|
-
const messageId = openMsg || fallbackMsgId;
|
|
89
|
-
const accountId = typeof meta.accountId === "string" && meta.accountId.trim() ? meta.accountId.trim() : "default";
|
|
90
|
-
try {
|
|
91
|
-
await handle({
|
|
92
|
-
action: actionTag,
|
|
93
|
-
data: JSON.stringify({
|
|
94
|
-
cardAction: meta.cardAction,
|
|
95
|
-
cardContext: meta.cardContext,
|
|
96
|
-
cardActionText: meta.cardActionText
|
|
97
|
-
}),
|
|
98
|
-
messageId,
|
|
99
|
-
senderId: msg.sender_id,
|
|
100
|
-
chatId: msg.chat_id,
|
|
101
|
-
accountId,
|
|
102
|
-
metadata: {
|
|
103
|
-
feishuEventType: meta.feishuEventType,
|
|
104
|
-
raw: meta.raw,
|
|
105
|
-
sessionKey: meta.sessionKey,
|
|
106
|
-
userContent: msg.content
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
} catch (err) {
|
|
110
|
-
const em = err instanceof Error ? err.message : String(err);
|
|
111
|
-
log.error({
|
|
112
|
-
err,
|
|
113
|
-
channel: msg.channel,
|
|
114
|
-
accountId,
|
|
115
|
-
em
|
|
116
|
-
}, "dispatchInboundMessageAction failed");
|
|
117
|
-
}
|
|
55
|
+
return this.registry.get(id);
|
|
118
56
|
}
|
|
119
57
|
getAllPlugins() {
|
|
120
|
-
return
|
|
58
|
+
return this.registry.all();
|
|
121
59
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
const initPromises = [];
|
|
128
|
-
for (const [id, plugin] of this.plugins) {
|
|
129
|
-
const channelConfig = asChannelConfig(this.config.channels?.[id]);
|
|
130
|
-
const initPromise = this.initializePlugin(plugin, channelConfig ?? {});
|
|
131
|
-
initPromises.push(initPromise);
|
|
132
|
-
}
|
|
133
|
-
await Promise.allSettled(initPromises);
|
|
134
|
-
this.initialized = true;
|
|
135
|
-
log.info("All channel plugins initialized");
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Builtin channels require `channels.<id>.enabled`. Extension-managed channels run unless explicitly disabled.
|
|
139
|
-
*/
|
|
140
|
-
shouldRunChannelPlugin(plugin, channelConfig) {
|
|
141
|
-
if (plugin.extensionManagedConfig) return channelConfig?.enabled !== false;
|
|
142
|
-
return !!channelConfig?.enabled;
|
|
143
|
-
}
|
|
144
|
-
async initializePlugin(plugin, channelConfig) {
|
|
145
|
-
try {
|
|
146
|
-
const options = {
|
|
147
|
-
bus: this.bus,
|
|
148
|
-
config: this.config,
|
|
149
|
-
channelConfig,
|
|
150
|
-
sessionModel: this.sessionModelHooks
|
|
151
|
-
};
|
|
152
|
-
await plugin.init(options);
|
|
153
|
-
this.initializedPluginIds.add(plugin.id);
|
|
154
|
-
log.debug({ channel: plugin.id }, "Channel plugin initialized");
|
|
155
|
-
} catch (err) {
|
|
156
|
-
log.error({
|
|
157
|
-
channel: plugin.id,
|
|
158
|
-
err
|
|
159
|
-
}, "Failed to initialize channel plugin");
|
|
160
|
-
}
|
|
60
|
+
/** Backward-compat alias for `getAllPlugins`. */
|
|
61
|
+
getAllChannels() {
|
|
62
|
+
return this.registry.all();
|
|
161
63
|
}
|
|
162
|
-
/**
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
listDeferConnectChannelIds(cfg) {
|
|
166
|
-
const out = [];
|
|
167
|
-
for (const [id, plugin] of this.plugins) {
|
|
168
|
-
const channelConfig = asChannelConfig(cfg.channels?.[id]);
|
|
169
|
-
if (!this.shouldRunChannelPlugin(plugin, channelConfig)) continue;
|
|
170
|
-
if (plugin.meta.deferConnectUntilAfterListen === true) out.push(id);
|
|
171
|
-
}
|
|
172
|
-
return out;
|
|
64
|
+
/** Channel IDs whose runtime reports connected (e.g. Telegram polling active). */
|
|
65
|
+
getRunningChannels() {
|
|
66
|
+
return this.registry.runningChannelIds(this.config, (id) => this.lifecycle.isInitialized(id));
|
|
173
67
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
*/
|
|
177
|
-
async start(options) {
|
|
178
|
-
if (!this.initialized) throw new Error("Channels not initialized");
|
|
179
|
-
if (this.running) {
|
|
180
|
-
log.warn({ pluginCount: this.plugins.size }, "start() called while channels already running — skipping");
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
const deferIds = options?.deferConnectPluginIds ?? /* @__PURE__ */ new Set();
|
|
184
|
-
this.deferredConnectPending.clear();
|
|
185
|
-
const startPromises = [];
|
|
186
|
-
for (const [id, plugin] of this.plugins) {
|
|
187
|
-
const channelConfig = asChannelConfig(this.config.channels?.[id]);
|
|
188
|
-
if (!this.shouldRunChannelPlugin(plugin, channelConfig)) continue;
|
|
189
|
-
if (deferIds.has(id)) {
|
|
190
|
-
this.deferredConnectPending.add(id);
|
|
191
|
-
log.info({ channel: id }, "Channel connect deferred until HTTP listen");
|
|
192
|
-
continue;
|
|
193
|
-
}
|
|
194
|
-
const startPromise = this.startPlugin(plugin, {}).catch((err) => {
|
|
195
|
-
log.error({
|
|
196
|
-
channel: id,
|
|
197
|
-
err
|
|
198
|
-
}, "Failed to start channel plugin");
|
|
199
|
-
});
|
|
200
|
-
startPromises.push(startPromise);
|
|
201
|
-
}
|
|
202
|
-
await Promise.allSettled(startPromises);
|
|
203
|
-
this.running = true;
|
|
204
|
-
log.info({ deferred: [...this.deferredConnectPending] }, this.deferredConnectPending.size > 0 ? "Channel plugins started (deferred connects pending)" : "All channel plugins started");
|
|
68
|
+
initialize() {
|
|
69
|
+
return this.lifecycle.initialize();
|
|
205
70
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
if (this.deferredConnectPending.size === 0) return;
|
|
209
|
-
if (!this.running) {
|
|
210
|
-
log.warn("startDeferredConnects called before channel phase-1 start; skipping");
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
const ids = [...this.deferredConnectPending];
|
|
214
|
-
this.deferredConnectPending.clear();
|
|
215
|
-
const startPromises = [];
|
|
216
|
-
for (const id of ids) {
|
|
217
|
-
const plugin = this.plugins.get(id);
|
|
218
|
-
if (!plugin) continue;
|
|
219
|
-
const channelConfig = asChannelConfig(this.config.channels?.[id]);
|
|
220
|
-
if (!this.shouldRunChannelPlugin(plugin, channelConfig)) continue;
|
|
221
|
-
startPromises.push(this.startPlugin(plugin, {}).catch((err) => {
|
|
222
|
-
log.error({
|
|
223
|
-
channel: id,
|
|
224
|
-
err
|
|
225
|
-
}, "Failed to start deferred channel plugin");
|
|
226
|
-
}));
|
|
227
|
-
}
|
|
228
|
-
await Promise.allSettled(startPromises);
|
|
229
|
-
log.info({ channels: ids }, "Deferred channel connects completed");
|
|
71
|
+
start(options) {
|
|
72
|
+
return this.lifecycle.start(options);
|
|
230
73
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
try {
|
|
234
|
-
await plugin.start(options);
|
|
235
|
-
if (!opts.preserveRestartAttempts) this.restartAttempts.delete(plugin.id);
|
|
236
|
-
this._scheduleHeartbeat(plugin);
|
|
237
|
-
log.debug({ channel: plugin.id }, "Channel plugin started");
|
|
238
|
-
} catch (err) {
|
|
239
|
-
const attempt = (this.restartAttempts.get(plugin.id) ?? 0) + 1;
|
|
240
|
-
this.restartAttempts.set(plugin.id, attempt);
|
|
241
|
-
if (attempt <= CHANNEL_RESTART_POLICY.maxAttempts) {
|
|
242
|
-
const delayMs = computeBackoff(CHANNEL_RESTART_POLICY, attempt);
|
|
243
|
-
log.warn({
|
|
244
|
-
channel: plugin.id,
|
|
245
|
-
attempt,
|
|
246
|
-
delayMs,
|
|
247
|
-
err
|
|
248
|
-
}, "Channel failed to start, scheduling restart");
|
|
249
|
-
setTimeout(() => {
|
|
250
|
-
if (this.manuallyStopped.has(plugin.id)) {
|
|
251
|
-
log.debug({ channel: plugin.id }, "Skipping scheduled restart (manual stop)");
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
this.startPlugin(plugin, { preserveRestartAttempts: true }).catch((e) => {
|
|
255
|
-
log.error({
|
|
256
|
-
channel: plugin.id,
|
|
257
|
-
err: e
|
|
258
|
-
}, "Channel restart attempt failed");
|
|
259
|
-
});
|
|
260
|
-
}, delayMs);
|
|
261
|
-
} else log.error({
|
|
262
|
-
channel: plugin.id,
|
|
263
|
-
err
|
|
264
|
-
}, "Channel exceeded max restart attempts");
|
|
265
|
-
}
|
|
74
|
+
startDeferredConnects() {
|
|
75
|
+
return this.lifecycle.startDeferredConnects();
|
|
266
76
|
}
|
|
267
77
|
async stop() {
|
|
268
|
-
|
|
269
|
-
this.
|
|
270
|
-
const stopPromises = [];
|
|
271
|
-
for (const id of this.initializedPluginIds) {
|
|
272
|
-
const plugin = this.plugins.get(id);
|
|
273
|
-
if (!plugin) continue;
|
|
274
|
-
const stopPromise = this.stopPlugin(plugin).catch((err) => {
|
|
275
|
-
log.error({
|
|
276
|
-
channel: id,
|
|
277
|
-
err
|
|
278
|
-
}, "Failed to stop channel plugin");
|
|
279
|
-
});
|
|
280
|
-
stopPromises.push(stopPromise);
|
|
281
|
-
}
|
|
282
|
-
await Promise.allSettled(stopPromises);
|
|
283
|
-
this.running = false;
|
|
284
|
-
log.info("All channel plugins stopped");
|
|
78
|
+
await this.lifecycle.stop();
|
|
79
|
+
this.heartbeat.clearAll();
|
|
285
80
|
}
|
|
286
|
-
|
|
287
|
-
this.
|
|
288
|
-
await plugin.stop();
|
|
289
|
-
log.info({ channel: plugin.id }, "Channel plugin stopped");
|
|
81
|
+
stopChannel(channelId) {
|
|
82
|
+
return this.lifecycle.stopChannel(channelId);
|
|
290
83
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
for (const key of [...this.heartbeatTimers.keys()]) if (key.startsWith(prefix)) {
|
|
294
|
-
clearInterval(this.heartbeatTimers.get(key));
|
|
295
|
-
this.heartbeatTimers.delete(key);
|
|
296
|
-
}
|
|
84
|
+
startChannel(channelId) {
|
|
85
|
+
return this.lifecycle.startChannel(channelId);
|
|
297
86
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
if (!hb) return;
|
|
301
|
-
this._clearHeartbeatTimers(plugin.id);
|
|
302
|
-
let accountIds = [];
|
|
303
|
-
try {
|
|
304
|
-
accountIds = plugin.config.listAccountIds(this.config);
|
|
305
|
-
} catch (e) {
|
|
306
|
-
log.warn({
|
|
307
|
-
channel: plugin.id,
|
|
308
|
-
err: e
|
|
309
|
-
}, "Heartbeat: failed to list accounts");
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
for (const accountId of accountIds) {
|
|
313
|
-
const key = `${plugin.id}:${accountId}`;
|
|
314
|
-
const timer = setInterval(() => {
|
|
315
|
-
(async () => {
|
|
316
|
-
try {
|
|
317
|
-
const r = await hb.check({
|
|
318
|
-
cfg: this.config,
|
|
319
|
-
accountId
|
|
320
|
-
});
|
|
321
|
-
this.healthMonitor.set(plugin.id, accountId, {
|
|
322
|
-
healthy: r.healthy,
|
|
323
|
-
lastCheckAt: Date.now(),
|
|
324
|
-
detail: typeof r.details === "string" ? r.details : r.details != null ? JSON.stringify(r.details) : void 0
|
|
325
|
-
});
|
|
326
|
-
if (!r.healthy) {
|
|
327
|
-
log.warn({
|
|
328
|
-
channel: plugin.id,
|
|
329
|
-
accountId,
|
|
330
|
-
detail: r.details
|
|
331
|
-
}, "Channel heartbeat unhealthy");
|
|
332
|
-
const now = Date.now();
|
|
333
|
-
if (now - (this._lastHeartbeatRestartAt.get(plugin.id) ?? 0) < 6e4) return;
|
|
334
|
-
this._lastHeartbeatRestartAt.set(plugin.id, now);
|
|
335
|
-
this._softRestartChannel(plugin.id);
|
|
336
|
-
}
|
|
337
|
-
} catch (err) {
|
|
338
|
-
this.healthMonitor.set(plugin.id, accountId, {
|
|
339
|
-
healthy: false,
|
|
340
|
-
lastCheckAt: Date.now(),
|
|
341
|
-
detail: err instanceof Error ? err.message : String(err)
|
|
342
|
-
});
|
|
343
|
-
log.error({
|
|
344
|
-
channel: plugin.id,
|
|
345
|
-
accountId,
|
|
346
|
-
err
|
|
347
|
-
}, "Channel heartbeat check failed");
|
|
348
|
-
}
|
|
349
|
-
})();
|
|
350
|
-
}, hb.intervalMs);
|
|
351
|
-
this.heartbeatTimers.set(key, timer);
|
|
352
|
-
}
|
|
87
|
+
listDeferConnectChannelIds(cfg) {
|
|
88
|
+
return this.lifecycle.listDeferConnectChannelIds(cfg);
|
|
353
89
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
const plugin = this.plugins.get(channelId);
|
|
357
|
-
if (!plugin || !this.initializedPluginIds.has(channelId)) return;
|
|
358
|
-
this._clearHeartbeatTimers(channelId);
|
|
359
|
-
try {
|
|
360
|
-
await plugin.stop();
|
|
361
|
-
await this.startPlugin(plugin, {});
|
|
362
|
-
} catch (err) {
|
|
363
|
-
log.error({
|
|
364
|
-
channel: channelId,
|
|
365
|
-
err
|
|
366
|
-
}, "Channel soft restart after heartbeat failed");
|
|
367
|
-
}
|
|
90
|
+
send(msg, options) {
|
|
91
|
+
return this.outbound.send(msg, options);
|
|
368
92
|
}
|
|
369
|
-
|
|
370
|
-
return
|
|
371
|
-
}
|
|
372
|
-
async send(msg, options) {
|
|
373
|
-
log.debug({
|
|
374
|
-
type: msg.type,
|
|
375
|
-
channel: msg.channel,
|
|
376
|
-
chatId: msg.chat_id
|
|
377
|
-
}, "Received outbound message");
|
|
378
|
-
let processedMsg = await this.applyTtsIfNeeded(msg);
|
|
379
|
-
const queueId = !options?.skipPersist && this.persistStore ? this.persistStore.enqueue(this.cloneOutbound(processedMsg)) : null;
|
|
380
|
-
try {
|
|
381
|
-
if (this.outboundHooks) {
|
|
382
|
-
const hookResult = await this.outboundHooks.runMessageSending(processedMsg.chat_id, processedMsg.content ?? "", processedMsg.channel);
|
|
383
|
-
if (!hookResult.send) {
|
|
384
|
-
if (queueId) this.persistStore.ack(queueId);
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
processedMsg = {
|
|
388
|
-
...processedMsg,
|
|
389
|
-
content: hookResult.content ?? processedMsg.content
|
|
390
|
-
};
|
|
391
|
-
}
|
|
392
|
-
if (processedMsg.channel === "__xopc_internal") {
|
|
393
|
-
log.debug({ chatId: processedMsg.chat_id }, "Outbound dropped (internal session — not a real channel)");
|
|
394
|
-
if (queueId) this.persistStore.ack(queueId);
|
|
395
|
-
return;
|
|
396
|
-
}
|
|
397
|
-
const plugin = this.plugins.get(processedMsg.channel);
|
|
398
|
-
if (!plugin?.outbound) {
|
|
399
|
-
log.error({ channel: processedMsg.channel }, "Unknown channel or no outbound adapter");
|
|
400
|
-
if (queueId) this.persistStore.ack(queueId);
|
|
401
|
-
return;
|
|
402
|
-
}
|
|
403
|
-
const result = await deliverOutboundMessage({
|
|
404
|
-
cfg: this.config,
|
|
405
|
-
plugin,
|
|
406
|
-
processedMsg
|
|
407
|
-
});
|
|
408
|
-
if (this.outboundHooks) {
|
|
409
|
-
const err = result && !result.success ? result.error : void 0;
|
|
410
|
-
await this.outboundHooks.runMessageSent(processedMsg.chat_id, processedMsg.content ?? "", result?.success ?? false, err, processedMsg.channel);
|
|
411
|
-
}
|
|
412
|
-
if (!result) {
|
|
413
|
-
if (queueId) this.persistStore.ack(queueId);
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
if (result.success) log.info({
|
|
417
|
-
channel: processedMsg.channel,
|
|
418
|
-
chatId: processedMsg.chat_id,
|
|
419
|
-
messageId: result.messageId
|
|
420
|
-
}, "Message sent");
|
|
421
|
-
else log.error({
|
|
422
|
-
channel: processedMsg.channel,
|
|
423
|
-
chatId: processedMsg.chat_id,
|
|
424
|
-
error: result.error
|
|
425
|
-
}, "Failed to send message");
|
|
426
|
-
if (queueId) this.persistStore.ack(queueId);
|
|
427
|
-
} catch (err) {
|
|
428
|
-
log.error({
|
|
429
|
-
channel: processedMsg.channel,
|
|
430
|
-
chatId: processedMsg.chat_id,
|
|
431
|
-
err
|
|
432
|
-
}, "Outbound send threw");
|
|
433
|
-
if (!queueId) throw err;
|
|
434
|
-
}
|
|
93
|
+
replayPendingOutboundMessages() {
|
|
94
|
+
return this.outbound.replayPending();
|
|
435
95
|
}
|
|
436
96
|
startStream(channel, chatId, accountId, opts) {
|
|
437
|
-
const plugin = this.
|
|
97
|
+
const plugin = this.registry.get(channel);
|
|
438
98
|
if (!plugin) {
|
|
439
99
|
log.error({ channel }, "Unknown channel");
|
|
440
100
|
return null;
|
|
@@ -447,7 +107,7 @@ var ChannelManager = class {
|
|
|
447
107
|
}) ?? null;
|
|
448
108
|
}
|
|
449
109
|
async getChannelStatus(channel) {
|
|
450
|
-
const plugin = this.
|
|
110
|
+
const plugin = this.registry.get(channel);
|
|
451
111
|
if (!plugin) return { error: "Unknown channel" };
|
|
452
112
|
if (!plugin.status?.buildChannelSummary) return { status: "unknown" };
|
|
453
113
|
try {
|
|
@@ -468,100 +128,70 @@ var ChannelManager = class {
|
|
|
468
128
|
return { error: String(err) };
|
|
469
129
|
}
|
|
470
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Optional channel hook before `AgentService` consumes an inbound message
|
|
133
|
+
* (e.g. Feishu card-action triggers).
|
|
134
|
+
*/
|
|
135
|
+
async dispatchInboundMessageAction(msg) {
|
|
136
|
+
const handle = this.registry.get(msg.channel)?.actions?.handleAction;
|
|
137
|
+
if (!handle) return;
|
|
138
|
+
const meta = msg.metadata;
|
|
139
|
+
if (msg.channel !== "feishu" || meta?.feishuEventType !== "card.action.trigger") return;
|
|
140
|
+
const cardAction = meta.cardAction;
|
|
141
|
+
const actionTag = cardAction && typeof cardAction.tag === "string" && cardAction.tag.trim() ? cardAction.tag.trim() : "feishu.card_action";
|
|
142
|
+
const cardCtx = meta.cardContext;
|
|
143
|
+
const openMsg = cardCtx && typeof cardCtx.open_message_id === "string" ? cardCtx.open_message_id.trim() : "";
|
|
144
|
+
const fallbackMsgId = typeof meta.messageId === "string" ? meta.messageId.trim() : "";
|
|
145
|
+
const messageId = openMsg || fallbackMsgId;
|
|
146
|
+
const accountId = typeof meta.accountId === "string" && meta.accountId.trim() ? meta.accountId.trim() : "default";
|
|
147
|
+
try {
|
|
148
|
+
await handle({
|
|
149
|
+
action: actionTag,
|
|
150
|
+
data: JSON.stringify({
|
|
151
|
+
cardAction: meta.cardAction,
|
|
152
|
+
cardContext: meta.cardContext,
|
|
153
|
+
cardActionText: meta.cardActionText
|
|
154
|
+
}),
|
|
155
|
+
messageId,
|
|
156
|
+
senderId: msg.sender_id,
|
|
157
|
+
chatId: msg.chat_id,
|
|
158
|
+
accountId,
|
|
159
|
+
metadata: {
|
|
160
|
+
feishuEventType: meta.feishuEventType,
|
|
161
|
+
raw: meta.raw,
|
|
162
|
+
sessionKey: meta.sessionKey,
|
|
163
|
+
userContent: msg.content
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
} catch (err) {
|
|
167
|
+
const em = err instanceof Error ? err.message : String(err);
|
|
168
|
+
log.error({
|
|
169
|
+
err,
|
|
170
|
+
channel: msg.channel,
|
|
171
|
+
accountId,
|
|
172
|
+
em
|
|
173
|
+
}, "dispatchInboundMessageAction failed");
|
|
174
|
+
}
|
|
175
|
+
}
|
|
471
176
|
async updateConfig(config) {
|
|
472
177
|
this.config = config;
|
|
473
|
-
|
|
474
|
-
const plugin = this.plugins.get(id);
|
|
475
|
-
if (plugin?.onConfigUpdated) await Promise.resolve(plugin.onConfigUpdated(config));
|
|
476
|
-
}
|
|
178
|
+
await this.lifecycle.forwardConfigUpdate(config);
|
|
477
179
|
log.info("Channel config updated");
|
|
478
180
|
}
|
|
479
181
|
/** Replace in-memory config without running plugin `onConfigUpdated` hooks. */
|
|
480
182
|
setRuntimeConfig(config) {
|
|
481
183
|
this.config = config;
|
|
482
184
|
}
|
|
483
|
-
async applyTtsIfNeeded(msg) {
|
|
484
|
-
if (msg.type && msg.type !== "message") return msg;
|
|
485
|
-
if (!msg.content?.trim()) return msg;
|
|
486
|
-
if (msg.mediaUrl) return msg;
|
|
487
|
-
const ttsConfig = mergeTtsConfigFromAppConfig(this.config.messages?.tts);
|
|
488
|
-
if (!ttsConfig.enabled) return msg;
|
|
489
|
-
const inboundAudio = msg.metadata?.transcribedVoice === true;
|
|
490
|
-
return maybeApplyTtsToPayload(msg, {
|
|
491
|
-
config: ttsConfig,
|
|
492
|
-
channel: msg.channel,
|
|
493
|
-
inboundAudio,
|
|
494
|
-
appConfig: this.config
|
|
495
|
-
});
|
|
496
|
-
}
|
|
497
|
-
/**
|
|
498
|
-
* Stop a single channel and suppress automatic restart until `startChannel` is called.
|
|
499
|
-
*/
|
|
500
|
-
async stopChannel(channelId) {
|
|
501
|
-
this.manuallyStopped.add(channelId);
|
|
502
|
-
const plugin = this.plugins.get(channelId);
|
|
503
|
-
if (!plugin || !this.initializedPluginIds.has(channelId)) return;
|
|
504
|
-
await this.stopPlugin(plugin).catch((err) => {
|
|
505
|
-
log.error({
|
|
506
|
-
channel: channelId,
|
|
507
|
-
err
|
|
508
|
-
}, "Failed to stop channel plugin");
|
|
509
|
-
});
|
|
510
|
-
}
|
|
511
|
-
/**
|
|
512
|
-
* Clear manual-stop and start one channel (requires prior `initialize()`).
|
|
513
|
-
*/
|
|
514
|
-
async startChannel(channelId) {
|
|
515
|
-
this.manuallyStopped.delete(channelId);
|
|
516
|
-
const plugin = this.plugins.get(channelId);
|
|
517
|
-
if (!plugin) {
|
|
518
|
-
log.warn({ channel: channelId }, "Unknown channel");
|
|
519
|
-
return;
|
|
520
|
-
}
|
|
521
|
-
if (!this.initialized) {
|
|
522
|
-
log.warn({ channel: channelId }, "Channels not initialized");
|
|
523
|
-
return;
|
|
524
|
-
}
|
|
525
|
-
const channelConfig = asChannelConfig(this.config.channels?.[channelId]);
|
|
526
|
-
if (!this.shouldRunChannelPlugin(plugin, channelConfig)) {
|
|
527
|
-
log.debug({ channel: channelId }, "Channel disabled in config, skipping start");
|
|
528
|
-
return;
|
|
529
|
-
}
|
|
530
|
-
if (!this.initializedPluginIds.has(channelId)) {
|
|
531
|
-
log.warn({ channel: channelId }, "Channel was never initialized; call initialize() first");
|
|
532
|
-
return;
|
|
533
|
-
}
|
|
534
|
-
await this.startPlugin(plugin, {});
|
|
535
|
-
}
|
|
536
185
|
getRuntimeSnapshot() {
|
|
537
186
|
return {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
pluginIds: [...this.plugins.keys()],
|
|
541
|
-
initializedPluginIds: [...this.initializedPluginIds],
|
|
542
|
-
manuallyStopped: [...this.manuallyStopped],
|
|
543
|
-
restartAttempts: Object.fromEntries(this.restartAttempts),
|
|
187
|
+
...this.lifecycle.snapshot(),
|
|
188
|
+
pluginIds: this.registry.ids(),
|
|
544
189
|
channelHealth: this.healthMonitor.toJSON()
|
|
545
190
|
};
|
|
546
191
|
}
|
|
547
192
|
getHealthMonitor() {
|
|
548
193
|
return this.healthMonitor;
|
|
549
194
|
}
|
|
550
|
-
/**
|
|
551
|
-
* Channel IDs whose runtime reports connected (e.g. Telegram polling active).
|
|
552
|
-
*/
|
|
553
|
-
getRunningChannels() {
|
|
554
|
-
const result = [];
|
|
555
|
-
for (const id of this.initializedPluginIds) {
|
|
556
|
-
const plugin = this.plugins.get(id);
|
|
557
|
-
if (!plugin?.channelIsRunning) continue;
|
|
558
|
-
if (plugin.channelIsRunning(this.config)) result.push(id);
|
|
559
|
-
}
|
|
560
|
-
return result;
|
|
561
|
-
}
|
|
562
|
-
getAllChannels() {
|
|
563
|
-
return this.getAllPlugins();
|
|
564
|
-
}
|
|
565
195
|
};
|
|
566
196
|
function createChannelManager(config, bus) {
|
|
567
197
|
return new ChannelManager(config, bus);
|