@pellux/goodvibes-tui 0.18.10 → 0.18.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/README.md +1 -1
- package/docs/foundation-artifacts/operator-contract.json +1 -1
- package/package.json +2 -2
- package/src/core/conversation-rendering.ts +2 -2
- package/src/core/conversation.ts +5 -5
- package/src/core/orchestrator.ts +13 -11
- package/src/daemon/facade-composition.ts +8 -8
- package/src/daemon/facade.ts +8 -8
- package/src/daemon/types.ts +3 -3
- package/src/input/command-registry.ts +3 -3
- package/src/input/commands/session-content.ts +2 -2
- package/src/input/commands/session-workflow.ts +1 -1
- package/src/input/handler-feed.ts +1 -1
- package/src/input/session-picker-modal.ts +1 -1
- package/src/panels/builtin/agent.ts +1 -0
- package/src/panels/builtin/operations.ts +1 -0
- package/src/panels/builtin/session.ts +1 -1
- package/src/panels/builtin/shared.ts +2 -2
- package/src/panels/context-visualizer-panel.ts +4 -1
- package/src/panels/provider-health-domains.ts +5 -1
- package/src/panels/provider-health-panel.ts +5 -1
- package/src/panels/session-browser-panel.ts +1 -1
- package/src/panels/token-budget-panel.ts +6 -2
- package/src/plugins/loader.ts +2 -2
- package/src/runtime/bootstrap-command-context.ts +3 -3
- package/src/runtime/bootstrap-command-parts.ts +3 -3
- package/src/runtime/bootstrap-core.ts +2 -2
- package/src/runtime/bootstrap-hook-bridge.ts +1 -1
- package/src/runtime/bootstrap-shell.ts +1 -1
- package/src/runtime/bootstrap.ts +5 -4
- package/src/runtime/services.ts +2 -2
- package/src/runtime/ui-read-models-observability-security.ts +2 -2
- package/src/runtime/ui-read-models-observability-system.ts +1 -1
- package/src/runtime/ui-service-queries.ts +1 -1
- package/src/tools/index.ts +1 -1
- package/src/version.ts +1 -1
- package/src/acp/connection.ts +0 -447
- package/src/acp/index.ts +0 -7
- package/src/acp/manager.ts +0 -1
- package/src/adapters/bluebubbles/index.ts +0 -127
- package/src/adapters/discord/index.ts +0 -297
- package/src/adapters/github/index.ts +0 -73
- package/src/adapters/google-chat/index.ts +0 -119
- package/src/adapters/imessage/index.ts +0 -92
- package/src/adapters/index.ts +0 -15
- package/src/adapters/matrix/index.ts +0 -116
- package/src/adapters/mattermost/index.ts +0 -151
- package/src/adapters/msteams/index.ts +0 -180
- package/src/adapters/ntfy/index.ts +0 -118
- package/src/adapters/signal/index.ts +0 -92
- package/src/adapters/slack/index.ts +0 -323
- package/src/adapters/telegram/index.ts +0 -160
- package/src/adapters/types.ts +0 -97
- package/src/adapters/webhook/index.ts +0 -178
- package/src/adapters/whatsapp/index.ts +0 -135
- package/src/agents/message-bus-core.ts +0 -312
- package/src/agents/message-bus.ts +0 -2
- package/src/agents/orchestrator-prompts.ts +0 -351
- package/src/agents/orchestrator-runner.ts +0 -668
- package/src/agents/orchestrator.ts +0 -438
- package/src/agents/session.ts +0 -108
- package/src/agents/worktree.ts +0 -153
- package/src/agents/wrfc-config.ts +0 -47
- package/src/agents/wrfc-controller.ts +0 -747
- package/src/agents/wrfc-gate-runtime.ts +0 -75
- package/src/agents/wrfc-reporting.ts +0 -284
- package/src/agents/wrfc-runtime-events.ts +0 -150
- package/src/agents/wrfc-types.ts +0 -67
- package/src/automation/delivery-manager.ts +0 -368
- package/src/automation/index.ts +0 -72
- package/src/automation/manager-runtime-delivery.ts +0 -139
- package/src/automation/manager-runtime-events.ts +0 -131
- package/src/automation/manager-runtime-execution.ts +0 -511
- package/src/automation/manager-runtime-helpers.ts +0 -433
- package/src/automation/manager-runtime-job-mutations.ts +0 -175
- package/src/automation/manager-runtime-reconcile.ts +0 -148
- package/src/automation/manager-runtime-scheduling.ts +0 -189
- package/src/automation/manager-runtime-sync.ts +0 -54
- package/src/automation/manager-runtime.ts +0 -721
- package/src/automation/manager.ts +0 -10
- package/src/automation/service.ts +0 -242
- package/src/channels/builtin/account-actions.ts +0 -490
- package/src/channels/builtin/accounts.ts +0 -433
- package/src/channels/builtin/contracts.ts +0 -405
- package/src/channels/builtin/plugins.ts +0 -308
- package/src/channels/builtin/rendering.ts +0 -174
- package/src/channels/builtin/setup-schema.ts +0 -504
- package/src/channels/builtin/shared.ts +0 -96
- package/src/channels/builtin/surfaces.ts +0 -57
- package/src/channels/builtin/targets.ts +0 -693
- package/src/channels/builtin-runtime.ts +0 -443
- package/src/channels/delivery/shared.ts +0 -199
- package/src/channels/delivery/strategies-bridge.ts +0 -246
- package/src/channels/delivery/strategies-core.ts +0 -299
- package/src/channels/delivery/strategies-enterprise.ts +0 -178
- package/src/channels/delivery/types.ts +0 -59
- package/src/channels/delivery-router.ts +0 -127
- package/src/channels/index.ts +0 -77
- package/src/channels/plugin-registry.ts +0 -551
- package/src/channels/provider-runtime.ts +0 -330
- package/src/channels/reply-pipeline.ts +0 -522
- package/src/channels/route-manager.ts +0 -340
- package/src/channels/surface-registry.ts +0 -186
- package/src/config/helper-model.ts +0 -1
- package/src/config/manager.ts +0 -8
- package/src/config/subscription-auth.ts +0 -31
- package/src/config/tool-llm.ts +0 -110
- package/src/control-plane/approval-broker.ts +0 -351
- package/src/control-plane/gateway.ts +0 -1
- package/src/control-plane/index.ts +0 -54
- package/src/control-plane/media-contract-schemas.ts +0 -1
- package/src/control-plane/method-catalog-admin.ts +0 -1
- package/src/control-plane/method-catalog-channels.ts +0 -1
- package/src/control-plane/method-catalog-control-automation.ts +0 -1
- package/src/control-plane/method-catalog-control-core.ts +0 -1
- package/src/control-plane/method-catalog-control.ts +0 -1
- package/src/control-plane/method-catalog-events.ts +0 -1
- package/src/control-plane/method-catalog-knowledge.ts +0 -1
- package/src/control-plane/method-catalog-media.ts +0 -1
- package/src/control-plane/method-catalog-runtime.ts +0 -1
- package/src/control-plane/method-catalog-shared.ts +0 -1
- package/src/control-plane/method-catalog.ts +0 -1
- package/src/control-plane/operator-contract-schemas-admin.ts +0 -1
- package/src/control-plane/operator-contract-schemas-channels.ts +0 -1
- package/src/control-plane/operator-contract-schemas-control.ts +0 -1
- package/src/control-plane/operator-contract-schemas-domains.ts +0 -1
- package/src/control-plane/operator-contract-schemas-knowledge.ts +0 -1
- package/src/control-plane/operator-contract-schemas-media.ts +0 -1
- package/src/control-plane/operator-contract-schemas-permissions.ts +0 -1
- package/src/control-plane/operator-contract-schemas-remote.ts +0 -1
- package/src/control-plane/operator-contract-schemas-runtime.ts +0 -1
- package/src/control-plane/operator-contract-schemas-shared.ts +0 -1
- package/src/control-plane/operator-contract-schemas-telemetry.ts +0 -1
- package/src/control-plane/operator-contract-schemas.ts +0 -1
- package/src/control-plane/operator-contract.ts +0 -165
- package/src/control-plane/session-broker.ts +0 -780
- package/src/core/compaction-sections.ts +0 -492
- package/src/core/compaction-types.ts +0 -147
- package/src/core/context-compaction.ts +0 -542
- package/src/core/conversation-compaction.ts +0 -68
- package/src/core/conversation-diff.ts +0 -55
- package/src/core/conversation-utils.ts +0 -72
- package/src/core/event-replay.ts +0 -287
- package/src/core/orchestrator-context-runtime.ts +0 -407
- package/src/core/orchestrator-follow-up-runtime.ts +0 -134
- package/src/core/orchestrator-runtime.ts +0 -132
- package/src/core/orchestrator-tool-runtime.ts +0 -468
- package/src/core/orchestrator-turn-helpers.ts +0 -355
- package/src/core/orchestrator-turn-loop.ts +0 -443
- package/src/core/plan-command-handler.ts +0 -169
- package/src/core/transcript-events/classify.ts +0 -95
- package/src/core/transcript-events/index.ts +0 -15
- package/src/daemon/control-plane.ts +0 -522
- package/src/daemon/helpers.ts +0 -74
- package/src/daemon/http/router-route-contexts.ts +0 -370
- package/src/daemon/http/router.ts +0 -531
- package/src/daemon/http-listener.ts +0 -301
- package/src/daemon/index.ts +0 -1
- package/src/daemon/server.ts +0 -1
- package/src/daemon/service-manager.ts +0 -413
- package/src/daemon/surface-actions.ts +0 -183
- package/src/daemon/surface-delivery.ts +0 -530
- package/src/daemon/transport-events.ts +0 -110
- package/src/export/markdown.ts +0 -213
- package/src/export/session-export.ts +0 -1
- package/src/git/index.ts +0 -1
- package/src/git/service.ts +0 -414
- package/src/hooks/chain-engine.ts +0 -414
- package/src/hooks/dispatcher.ts +0 -414
- package/src/hooks/hook-api.ts +0 -170
- package/src/hooks/index.ts +0 -48
- package/src/hooks/runners/agent.ts +0 -93
- package/src/hooks/runners/prompt.ts +0 -69
- package/src/hooks/workbench.ts +0 -360
- package/src/integrations/index.ts +0 -42
- package/src/integrations/notifier.ts +0 -206
- package/src/integrations/webhooks.ts +0 -1
- package/src/knowledge/consolidation.ts +0 -346
- package/src/knowledge/graphql.ts +0 -324
- package/src/knowledge/index.ts +0 -60
- package/src/knowledge/ingest-compile.ts +0 -386
- package/src/knowledge/ingest-context.ts +0 -18
- package/src/knowledge/ingest-inputs.ts +0 -387
- package/src/knowledge/ingest.ts +0 -1
- package/src/knowledge/internal.ts +0 -257
- package/src/knowledge/knowledge-api.ts +0 -432
- package/src/knowledge/lint.ts +0 -121
- package/src/knowledge/memory-sync.ts +0 -62
- package/src/knowledge/packet.ts +0 -370
- package/src/knowledge/scheduling.ts +0 -283
- package/src/knowledge/service.ts +0 -715
- package/src/mcp/client.ts +0 -383
- package/src/mcp/index.ts +0 -12
- package/src/mcp/mcp-api.ts +0 -90
- package/src/mcp/registry.ts +0 -1
- package/src/media/builtin-image-understanding.ts +0 -303
- package/src/media/builtin-providers.ts +0 -26
- package/src/media/index.ts +0 -18
- package/src/multimodal/index.ts +0 -13
- package/src/multimodal/service.ts +0 -492
- package/src/permissions/briefs/build.ts +0 -88
- package/src/permissions/manager.ts +0 -1
- package/src/plugins/api.ts +0 -383
- package/src/plugins/manager.ts +0 -481
- package/src/profiles/shape.ts +0 -58
- package/src/providers/amazon-bedrock-mantle.ts +0 -50
- package/src/providers/amazon-bedrock.ts +0 -61
- package/src/providers/anthropic-compat.ts +0 -373
- package/src/providers/anthropic-sdk-provider.ts +0 -230
- package/src/providers/anthropic-vertex.ts +0 -59
- package/src/providers/anthropic.ts +0 -469
- package/src/providers/auto-register.ts +0 -417
- package/src/providers/builtin-catalog.ts +0 -326
- package/src/providers/builtin-registry.ts +0 -575
- package/src/providers/cache-planner.ts +0 -258
- package/src/providers/capabilities.ts +0 -1
- package/src/providers/custom-loader.ts +0 -425
- package/src/providers/discovered-compat.ts +0 -7
- package/src/providers/discovered-factory.ts +0 -61
- package/src/providers/discovered-traits.ts +0 -138
- package/src/providers/gemini.ts +0 -462
- package/src/providers/github-copilot.ts +0 -254
- package/src/providers/index.ts +0 -1
- package/src/providers/interface.ts +0 -185
- package/src/providers/llama-cpp.ts +0 -402
- package/src/providers/lm-studio-helpers.ts +0 -367
- package/src/providers/lm-studio.ts +0 -484
- package/src/providers/model-catalog-cache.ts +0 -221
- package/src/providers/model-catalog-notifications.ts +0 -97
- package/src/providers/model-catalog-synthetic.ts +0 -202
- package/src/providers/model-catalog.ts +0 -211
- package/src/providers/model-limits.ts +0 -1
- package/src/providers/ollama.ts +0 -469
- package/src/providers/openai-codex.ts +0 -472
- package/src/providers/openai-compat.ts +0 -615
- package/src/providers/openai.ts +0 -231
- package/src/providers/optimizer.ts +0 -1
- package/src/providers/provider-api.ts +0 -1
- package/src/providers/registry-helpers.ts +0 -34
- package/src/providers/registry-models.ts +0 -77
- package/src/providers/registry-types.ts +0 -67
- package/src/providers/registry.ts +0 -1
- package/src/providers/runtime-metadata.ts +0 -149
- package/src/providers/runtime-snapshot.ts +0 -130
- package/src/providers/synthetic.ts +0 -561
- package/src/providers/tier-prompts.ts +0 -84
- package/src/providers/tool-formats.ts +0 -414
- package/src/runtime/auth/inspection.ts +0 -125
- package/src/runtime/bootstrap-background.ts +0 -157
- package/src/runtime/bootstrap-helpers.ts +0 -88
- package/src/runtime/bootstrap-runtime-events.ts +0 -254
- package/src/runtime/bootstrap-services.ts +0 -197
- package/src/runtime/compaction/index.ts +0 -1
- package/src/runtime/compaction/lifecycle.ts +0 -1
- package/src/runtime/compaction/manager.ts +0 -474
- package/src/runtime/compaction/quality-score.ts +0 -1
- package/src/runtime/compaction/resume-repair.ts +0 -1
- package/src/runtime/compaction/strategies/autocompact.ts +0 -1
- package/src/runtime/compaction/strategies/boundary-commit.ts +0 -1
- package/src/runtime/compaction/strategies/collapse.ts +0 -1
- package/src/runtime/compaction/strategies/index.ts +0 -1
- package/src/runtime/compaction/strategies/microcompact.ts +0 -1
- package/src/runtime/compaction/strategies/reactive.ts +0 -1
- package/src/runtime/compaction/types.ts +0 -1
- package/src/runtime/ecosystem/recommendations.ts +0 -117
- package/src/runtime/emitters/agents.ts +0 -96
- package/src/runtime/emitters/automation.ts +0 -112
- package/src/runtime/emitters/communication.ts +0 -53
- package/src/runtime/emitters/compaction.ts +0 -161
- package/src/runtime/emitters/control-plane.ts +0 -65
- package/src/runtime/emitters/deliveries.ts +0 -65
- package/src/runtime/emitters/forensics.ts +0 -17
- package/src/runtime/emitters/index.ts +0 -59
- package/src/runtime/emitters/knowledge.ts +0 -129
- package/src/runtime/emitters/mcp.ts +0 -95
- package/src/runtime/emitters/ops.ts +0 -163
- package/src/runtime/emitters/orchestration.ts +0 -87
- package/src/runtime/emitters/permissions.ts +0 -98
- package/src/runtime/emitters/planner.ts +0 -23
- package/src/runtime/emitters/plugins.ts +0 -78
- package/src/runtime/emitters/providers.ts +0 -30
- package/src/runtime/emitters/routes.ts +0 -57
- package/src/runtime/emitters/security.ts +0 -53
- package/src/runtime/emitters/session.ts +0 -93
- package/src/runtime/emitters/surfaces.ts +0 -57
- package/src/runtime/emitters/tasks.ts +0 -69
- package/src/runtime/emitters/tools.ts +0 -140
- package/src/runtime/emitters/transport.ts +0 -78
- package/src/runtime/emitters/turn.ts +0 -155
- package/src/runtime/emitters/ui.ts +0 -57
- package/src/runtime/emitters/watchers.ts +0 -57
- package/src/runtime/emitters/workflows.ts +0 -79
- package/src/runtime/eval/index.ts +0 -48
- package/src/runtime/eval/runner.ts +0 -163
- package/src/runtime/eval/suites.ts +0 -264
- package/src/runtime/events/domain-map.ts +0 -148
- package/src/runtime/events/index.ts +0 -1
- package/src/runtime/events/turn.ts +0 -1
- package/src/runtime/events/workflows.ts +0 -1
- package/src/runtime/forensics/collector.ts +0 -693
- package/src/runtime/forensics/index.ts +0 -23
- package/src/runtime/foundation-clients.ts +0 -78
- package/src/runtime/foundation-services.ts +0 -96
- package/src/runtime/guidance.ts +0 -183
- package/src/runtime/health/effect-handlers.ts +0 -189
- package/src/runtime/health/index.ts +0 -70
- package/src/runtime/health/wiring.ts +0 -115
- package/src/runtime/integration/helpers.ts +0 -640
- package/src/runtime/lifecycle.ts +0 -107
- package/src/runtime/mcp/index.ts +0 -68
- package/src/runtime/mcp/manager.ts +0 -513
- package/src/runtime/network/inbound.ts +0 -131
- package/src/runtime/network/index.ts +0 -30
- package/src/runtime/network/outbound.ts +0 -292
- package/src/runtime/network/shared.ts +0 -82
- package/src/runtime/operator-client.ts +0 -235
- package/src/runtime/ops/control-plane.ts +0 -363
- package/src/runtime/ops/index.ts +0 -122
- package/src/runtime/ops/playbooks/index.ts +0 -10
- package/src/runtime/ops/playbooks/session-unrecoverable.ts +0 -196
- package/src/runtime/ops/playbooks/stuck-turn.ts +0 -197
- package/src/runtime/ops/runtime-context.ts +0 -100
- package/src/runtime/ops-api.ts +0 -27
- package/src/runtime/orchestration/spawn-policy.ts +0 -83
- package/src/runtime/peer-client.ts +0 -404
- package/src/runtime/perf/index.ts +0 -57
- package/src/runtime/perf/slo-collector.ts +0 -375
- package/src/runtime/permissions/index.ts +0 -190
- package/src/runtime/permissions/policy-runtime.ts +0 -1
- package/src/runtime/permissions/preflight.ts +0 -101
- package/src/runtime/permissions/rule-suggestions.ts +0 -36
- package/src/runtime/plugins/hot-reload.ts +0 -221
- package/src/runtime/plugins/index.ts +0 -84
- package/src/runtime/plugins/lifecycle.ts +0 -95
- package/src/runtime/plugins/manager.ts +0 -474
- package/src/runtime/plugins/manifest.ts +0 -167
- package/src/runtime/plugins/quarantine.ts +0 -202
- package/src/runtime/plugins/trust.ts +0 -291
- package/src/runtime/plugins/types.ts +0 -205
- package/src/runtime/provider-accounts/registry.ts +0 -326
- package/src/runtime/remote/distributed-runtime-contract-schemas.ts +0 -386
- package/src/runtime/remote/index.ts +0 -488
- package/src/runtime/remote/runner-registry.ts +0 -438
- package/src/runtime/remote/supervisor.ts +0 -70
- package/src/runtime/runtime-hook-api.ts +0 -5
- package/src/runtime/runtime-knowledge-api.ts +0 -14
- package/src/runtime/runtime-mcp-api.ts +0 -5
- package/src/runtime/runtime-ops-api.ts +0 -86
- package/src/runtime/runtime-provider-api.ts +0 -18
- package/src/runtime/session-maintenance.ts +0 -188
- package/src/runtime/session-persistence.ts +0 -288
- package/src/runtime/session-return-context.ts +0 -195
- package/src/runtime/settings/control-plane-store.ts +0 -258
- package/src/runtime/settings/control-plane.ts +0 -599
- package/src/runtime/shell-command-extensions.ts +0 -54
- package/src/runtime/shell-command-ops.ts +0 -207
- package/src/runtime/shell-command-platform.ts +0 -47
- package/src/runtime/shell-command-services.ts +0 -143
- package/src/runtime/shell-command-workspace.ts +0 -31
- package/src/runtime/tasks/adapters/acp-adapter.ts +0 -211
- package/src/runtime/tasks/adapters/agent-adapter.ts +0 -208
- package/src/runtime/tasks/adapters/index.ts +0 -16
- package/src/runtime/tasks/adapters/process-adapter.ts +0 -214
- package/src/runtime/tasks/adapters/scheduler-adapter.ts +0 -193
- package/src/runtime/tasks/index.ts +0 -68
- package/src/runtime/tasks/manager.ts +0 -415
- package/src/runtime/telemetry/api-helpers.ts +0 -517
- package/src/runtime/telemetry/api.ts +0 -768
- package/src/runtime/telemetry/index.ts +0 -178
- package/src/runtime/telemetry/instrumentation/domain-bridge-agent-session.ts +0 -440
- package/src/runtime/telemetry/instrumentation/domain-bridge-plugin-mcp.ts +0 -200
- package/src/runtime/telemetry/instrumentation/domain-bridge-shared.ts +0 -18
- package/src/runtime/telemetry/instrumentation/domain-bridge-transport-task.ts +0 -204
- package/src/runtime/telemetry/instrumentation/domain-bridge.ts +0 -125
- package/src/runtime/telemetry/instrumentation/index.ts +0 -67
- package/src/runtime/tools/context.ts +0 -114
- package/src/runtime/tools/index.ts +0 -46
- package/src/runtime/tools/phased-executor.ts +0 -448
- package/src/runtime/tools/phases/budget.ts +0 -130
- package/src/runtime/tools/phases/execute.ts +0 -69
- package/src/runtime/tools/phases/index.ts +0 -13
- package/src/runtime/tools/phases/map-output.ts +0 -98
- package/src/runtime/tools/phases/permission.ts +0 -133
- package/src/runtime/tools/phases/posthook.ts +0 -57
- package/src/runtime/tools/phases/prehook.ts +0 -68
- package/src/runtime/tools/phases/validate.ts +0 -53
- package/src/runtime/transports/direct.ts +0 -73
- package/src/runtime/transports/http-helpers.ts +0 -218
- package/src/runtime/transports/http-types.ts +0 -364
- package/src/runtime/transports/http.ts +0 -629
- package/src/runtime/transports/realtime.ts +0 -50
- package/src/runtime/transports/remote-events.ts +0 -16
- package/src/runtime/transports/shared.ts +0 -39
- package/src/runtime/transports/ui-runtime-events.ts +0 -35
- package/src/runtime/ui-events.ts +0 -46
- package/src/runtime/worktree/registry.ts +0 -252
- package/src/sessions/manager.ts +0 -14
- package/src/state/file-watcher.ts +0 -294
- package/src/state/index.ts +0 -56
- package/src/state/knowledge-injection.ts +0 -214
- package/src/state/memory-embedding-http.ts +0 -642
- package/src/state/memory-embeddings.ts +0 -312
- package/src/state/memory-ingest.ts +0 -132
- package/src/state/memory-registry.ts +0 -111
- package/src/state/memory-store-helpers.ts +0 -160
- package/src/state/memory-store.ts +0 -728
- package/src/state/memory-vector-store.ts +0 -418
- package/src/templates/manager.ts +0 -187
- package/src/tools/agent/index.ts +0 -610
- package/src/tools/agent/manager.ts +0 -476
- package/src/tools/analyze/git-modes.ts +0 -380
- package/src/tools/analyze/index.ts +0 -128
- package/src/tools/channel/agent-tools.ts +0 -16
- package/src/tools/channel/index.ts +0 -268
- package/src/tools/control/index.ts +0 -90
- package/src/tools/edit/core.ts +0 -619
- package/src/tools/edit/index.ts +0 -4
- package/src/tools/edit/phased.ts +0 -33
- package/src/tools/fetch/index.ts +0 -3
- package/src/tools/fetch/phased.ts +0 -34
- package/src/tools/fetch/runtime.ts +0 -499
- package/src/tools/mcp/index.ts +0 -190
- package/src/tools/remote-trigger/index.ts +0 -130
- package/src/tools/shared/auto-heal.ts +0 -282
- package/src/tools/state/index.ts +0 -688
- package/src/tools/web-search/index.ts +0 -38
- package/src/tools/write/index.ts +0 -604
- package/src/tools/write/phased.ts +0 -41
- package/src/types/generated/foundation-client-types.ts +0 -22
- package/src/watchers/index.ts +0 -11
- package/src/watchers/registry.ts +0 -517
- package/src/web-search/index.ts +0 -26
- package/src/web-search/provider-registry.ts +0 -64
- package/src/web-search/providers/brave.ts +0 -100
- package/src/web-search/providers/duckduckgo.ts +0 -270
- package/src/web-search/providers/exa.ts +0 -77
- package/src/web-search/providers/firecrawl.ts +0 -90
- package/src/web-search/providers/perplexity.ts +0 -86
- package/src/web-search/providers/searxng.ts +0 -88
- package/src/web-search/providers/shared.ts +0 -249
- package/src/web-search/providers/tavily.ts +0 -90
- package/src/web-search/service.ts +0 -142
|
@@ -1,551 +0,0 @@
|
|
|
1
|
-
import type { AutomationRouteBinding } from '@pellux/goodvibes-sdk/platform/automation/routes';
|
|
2
|
-
import type { SharedApprovalRecord } from '@pellux/goodvibes-sdk/platform/control-plane/index';
|
|
3
|
-
import type { Tool } from '@pellux/goodvibes-sdk/platform/types/tools';
|
|
4
|
-
import type {
|
|
5
|
-
ChannelAdapterDescriptor,
|
|
6
|
-
ChannelAllowlistEditInput,
|
|
7
|
-
ChannelAllowlistEditResult,
|
|
8
|
-
ChannelAllowlistResolution,
|
|
9
|
-
ChannelAccountRecord,
|
|
10
|
-
ChannelAccountLifecycleAction,
|
|
11
|
-
ChannelAccountLifecycleResult,
|
|
12
|
-
ChannelActorAuthorizationRequest,
|
|
13
|
-
ChannelActorAuthorizationResult,
|
|
14
|
-
ChannelCapabilityDescriptor,
|
|
15
|
-
ChannelCapability,
|
|
16
|
-
ChannelConversationKind,
|
|
17
|
-
ChannelDirectoryEntry,
|
|
18
|
-
ChannelDirectoryQueryOptions,
|
|
19
|
-
ChannelDoctorReport,
|
|
20
|
-
ChannelLifecycleState,
|
|
21
|
-
ChannelOperatorActionDescriptor,
|
|
22
|
-
ChannelRenderPolicy,
|
|
23
|
-
ChannelRenderRequest,
|
|
24
|
-
ChannelRenderResult,
|
|
25
|
-
ChannelResolvedTarget,
|
|
26
|
-
ChannelRepairAction,
|
|
27
|
-
ChannelSetupSchema,
|
|
28
|
-
ChannelStatusSnapshot,
|
|
29
|
-
ChannelSurface,
|
|
30
|
-
ChannelTargetResolveOptions,
|
|
31
|
-
ChannelToolDescriptor,
|
|
32
|
-
} from '@pellux/goodvibes-sdk/platform/channels/types';
|
|
33
|
-
|
|
34
|
-
export interface ChannelPlugin {
|
|
35
|
-
readonly id: string;
|
|
36
|
-
readonly surface: ChannelSurface;
|
|
37
|
-
readonly displayName: string;
|
|
38
|
-
readonly capabilities: readonly ChannelCapability[];
|
|
39
|
-
readonly setupVersion?: number;
|
|
40
|
-
readonly webhookPath?: string;
|
|
41
|
-
readonly handleInbound?: (req: Request) => Promise<Response>;
|
|
42
|
-
readonly renderPolicy?: () => ChannelRenderPolicy | Promise<ChannelRenderPolicy>;
|
|
43
|
-
readonly renderEvent?: (request: ChannelRenderRequest) => Promise<ChannelRenderResult | void>;
|
|
44
|
-
readonly deliverReply?: (pending: unknown, message: string) => Promise<void>;
|
|
45
|
-
readonly deliverProgress?: (pending: unknown, progress: string) => Promise<void>;
|
|
46
|
-
readonly notifyApproval?: (approval: SharedApprovalRecord, binding: AutomationRouteBinding) => Promise<void>;
|
|
47
|
-
readonly getSetupSchema?: (accountId?: string) => Promise<ChannelSetupSchema> | ChannelSetupSchema;
|
|
48
|
-
readonly doctor?: (accountId?: string) => Promise<ChannelDoctorReport> | ChannelDoctorReport;
|
|
49
|
-
readonly listRepairActions?: (accountId?: string) => Promise<readonly ChannelRepairAction[]> | readonly ChannelRepairAction[];
|
|
50
|
-
readonly getLifecycleState?: (accountId?: string) => Promise<ChannelLifecycleState> | ChannelLifecycleState;
|
|
51
|
-
readonly migrateLifecycle?: (accountId?: string, input?: Record<string, unknown>) => Promise<ChannelLifecycleState> | ChannelLifecycleState;
|
|
52
|
-
readonly resolveAllowlist?: (input: ChannelAllowlistEditInput) => Promise<ChannelAllowlistResolution> | ChannelAllowlistResolution;
|
|
53
|
-
readonly editAllowlist?: (input: ChannelAllowlistEditInput) => Promise<ChannelAllowlistEditResult> | ChannelAllowlistEditResult;
|
|
54
|
-
readonly getStatus?: () => Promise<ChannelStatusSnapshot>;
|
|
55
|
-
readonly listAccounts?: () => Promise<readonly ChannelAccountRecord[]>;
|
|
56
|
-
readonly getAccount?: (accountId: string) => Promise<ChannelAccountRecord | null>;
|
|
57
|
-
readonly startAccount?: (accountId?: string, input?: Record<string, unknown>) => Promise<ChannelAccountLifecycleResult>;
|
|
58
|
-
readonly stopAccount?: (accountId?: string, input?: Record<string, unknown>) => Promise<ChannelAccountLifecycleResult>;
|
|
59
|
-
readonly loginAccount?: (accountId?: string, input?: Record<string, unknown>) => Promise<ChannelAccountLifecycleResult>;
|
|
60
|
-
readonly loginWithQrStart?: (accountId?: string, input?: Record<string, unknown>) => Promise<ChannelAccountLifecycleResult>;
|
|
61
|
-
readonly loginWithQrWait?: (accountId?: string, input?: Record<string, unknown>) => Promise<ChannelAccountLifecycleResult>;
|
|
62
|
-
readonly logoutAccount?: (accountId?: string, input?: Record<string, unknown>) => Promise<ChannelAccountLifecycleResult>;
|
|
63
|
-
readonly runAccountAction?: (
|
|
64
|
-
action: ChannelAccountLifecycleAction,
|
|
65
|
-
accountId?: string,
|
|
66
|
-
input?: Record<string, unknown>,
|
|
67
|
-
) => Promise<ChannelAccountLifecycleResult>;
|
|
68
|
-
readonly authorizeActorAction?: (request: ChannelActorAuthorizationRequest) => Promise<ChannelActorAuthorizationResult>;
|
|
69
|
-
readonly getActionAvailabilityState?: (request: ChannelActorAuthorizationRequest) => Promise<ChannelActorAuthorizationResult>;
|
|
70
|
-
readonly listCapabilities?: () => Promise<readonly ChannelCapabilityDescriptor[]> | readonly ChannelCapabilityDescriptor[];
|
|
71
|
-
readonly listTools?: () => Promise<readonly ChannelToolDescriptor[]> | readonly ChannelToolDescriptor[];
|
|
72
|
-
readonly runTool?: (toolId: string, input?: Record<string, unknown>) => Promise<unknown>;
|
|
73
|
-
readonly listOperatorActions?: () => Promise<readonly ChannelOperatorActionDescriptor[]> | readonly ChannelOperatorActionDescriptor[];
|
|
74
|
-
readonly runOperatorAction?: (actionId: string, input?: Record<string, unknown>) => Promise<unknown>;
|
|
75
|
-
readonly lookupDirectory?: (query: string, options?: ChannelDirectoryQueryOptions) => Promise<readonly ChannelDirectoryEntry[]>;
|
|
76
|
-
readonly queryDirectory?: (query: ChannelDirectoryQueryOptions) => Promise<readonly ChannelDirectoryEntry[]>;
|
|
77
|
-
readonly listGroupMembers?: (groupId: string, options?: ChannelDirectoryQueryOptions) => Promise<readonly ChannelDirectoryEntry[]>;
|
|
78
|
-
readonly parseExplicitTarget?: (input: string, options?: ChannelTargetResolveOptions) => Promise<ChannelResolvedTarget | null> | ChannelResolvedTarget | null;
|
|
79
|
-
readonly inferTargetConversationKind?: (input: string, options?: ChannelTargetResolveOptions) => Promise<ChannelConversationKind | null> | ChannelConversationKind | null;
|
|
80
|
-
readonly resolveTarget?: (options: ChannelTargetResolveOptions) => Promise<ChannelResolvedTarget | null>;
|
|
81
|
-
readonly resolveSessionTarget?: (target: ChannelResolvedTarget, options?: ChannelTargetResolveOptions) => Promise<string | null> | string | null;
|
|
82
|
-
readonly resolveParentConversationCandidates?: (options: ChannelTargetResolveOptions) => Promise<readonly ChannelResolvedTarget[]>;
|
|
83
|
-
readonly listAgentTools?: () => readonly Tool[];
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export class ChannelPluginRegistry {
|
|
87
|
-
private readonly plugins = new Map<string, ChannelPlugin>();
|
|
88
|
-
private readonly pluginsBySurface = new Map<ChannelSurface, ChannelPlugin>();
|
|
89
|
-
private readonly pluginsByPath = new Map<string, ChannelPlugin>();
|
|
90
|
-
private version = 0;
|
|
91
|
-
|
|
92
|
-
register(plugin: ChannelPlugin): void {
|
|
93
|
-
const existingById = this.plugins.get(plugin.id);
|
|
94
|
-
if (existingById?.webhookPath) {
|
|
95
|
-
this.pluginsByPath.delete(existingById.webhookPath);
|
|
96
|
-
}
|
|
97
|
-
if (existingById && this.pluginsBySurface.get(existingById.surface)?.id === existingById.id) {
|
|
98
|
-
this.pluginsBySurface.delete(existingById.surface);
|
|
99
|
-
}
|
|
100
|
-
const existingBySurface = this.pluginsBySurface.get(plugin.surface);
|
|
101
|
-
if (existingBySurface && existingBySurface.id !== plugin.id) {
|
|
102
|
-
this.plugins.delete(existingBySurface.id);
|
|
103
|
-
if (existingBySurface.webhookPath) this.pluginsByPath.delete(existingBySurface.webhookPath);
|
|
104
|
-
}
|
|
105
|
-
this.plugins.set(plugin.id, plugin);
|
|
106
|
-
this.pluginsBySurface.set(plugin.surface, plugin);
|
|
107
|
-
if (plugin.webhookPath) {
|
|
108
|
-
this.pluginsByPath.set(plugin.webhookPath, plugin);
|
|
109
|
-
}
|
|
110
|
-
this.version += 1;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
unregister(pluginId: string): boolean {
|
|
114
|
-
const plugin = this.plugins.get(pluginId);
|
|
115
|
-
if (!plugin) return false;
|
|
116
|
-
this.plugins.delete(pluginId);
|
|
117
|
-
if (this.pluginsBySurface.get(plugin.surface)?.id === pluginId) {
|
|
118
|
-
this.pluginsBySurface.delete(plugin.surface);
|
|
119
|
-
}
|
|
120
|
-
if (plugin.webhookPath && this.pluginsByPath.get(plugin.webhookPath)?.id === pluginId) {
|
|
121
|
-
this.pluginsByPath.delete(plugin.webhookPath);
|
|
122
|
-
}
|
|
123
|
-
this.version += 1;
|
|
124
|
-
return true;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
getVersion(): number {
|
|
128
|
-
return this.version;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
list(): ChannelPlugin[] {
|
|
132
|
-
return [...this.plugins.values()].sort((a, b) => a.displayName.localeCompare(b.displayName));
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
listDescriptors(): ChannelAdapterDescriptor[] {
|
|
136
|
-
return this.list().map((plugin) => ({
|
|
137
|
-
id: plugin.id,
|
|
138
|
-
surface: plugin.surface,
|
|
139
|
-
displayName: plugin.displayName,
|
|
140
|
-
capabilities: [...plugin.capabilities],
|
|
141
|
-
...(plugin.setupVersion ? { setupVersion: plugin.setupVersion } : {}),
|
|
142
|
-
}));
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
getBySurface(surface: ChannelSurface): ChannelPlugin | null {
|
|
146
|
-
return this.pluginsBySurface.get(surface) ?? null;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
get(pluginId: string): ChannelPlugin | null {
|
|
150
|
-
return this.plugins.get(pluginId) ?? null;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
getByPath(pathname: string): ChannelPlugin | null {
|
|
154
|
-
return this.pluginsByPath.get(pathname) ?? null;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
async handleInbound(pathname: string, req: Request): Promise<Response | null> {
|
|
158
|
-
const plugin = this.getByPath(pathname);
|
|
159
|
-
if (!plugin?.handleInbound) return null;
|
|
160
|
-
return plugin.handleInbound(req);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
async deliverReply(surface: ChannelSurface, pending: unknown, message: string): Promise<boolean> {
|
|
164
|
-
const plugin = this.getBySurface(surface);
|
|
165
|
-
if (!plugin?.deliverReply) return false;
|
|
166
|
-
await plugin.deliverReply(pending, message);
|
|
167
|
-
return true;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
async deliverProgress(surface: ChannelSurface, pending: unknown, progress: string): Promise<boolean> {
|
|
171
|
-
const plugin = this.getBySurface(surface);
|
|
172
|
-
if (!plugin?.deliverProgress) return false;
|
|
173
|
-
await plugin.deliverProgress(pending, progress);
|
|
174
|
-
return true;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
async notifyApproval(surface: ChannelSurface, approval: SharedApprovalRecord, binding: AutomationRouteBinding): Promise<boolean> {
|
|
178
|
-
const plugin = this.getBySurface(surface);
|
|
179
|
-
if (!plugin?.notifyApproval) return false;
|
|
180
|
-
await plugin.notifyApproval(approval, binding);
|
|
181
|
-
return true;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
async getRenderPolicy(surface: ChannelSurface): Promise<ChannelRenderPolicy | null> {
|
|
185
|
-
const plugin = this.getBySurface(surface);
|
|
186
|
-
if (!plugin?.renderPolicy) return null;
|
|
187
|
-
return plugin.renderPolicy();
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
async render(surface: ChannelSurface, request: ChannelRenderRequest): Promise<ChannelRenderResult | null> {
|
|
191
|
-
const plugin = this.getBySurface(surface);
|
|
192
|
-
if (!plugin) return null;
|
|
193
|
-
if (plugin.renderEvent) {
|
|
194
|
-
const result = await plugin.renderEvent(request);
|
|
195
|
-
if (result) return result;
|
|
196
|
-
return { delivered: true, metadata: { surface, pluginId: plugin.id } };
|
|
197
|
-
}
|
|
198
|
-
if (request.phase === 'final' && plugin.deliverReply) {
|
|
199
|
-
await plugin.deliverReply(request.pending, request.text);
|
|
200
|
-
return { delivered: true, metadata: { surface, pluginId: plugin.id, fallback: 'deliverReply' } };
|
|
201
|
-
}
|
|
202
|
-
if (request.phase === 'progress' && plugin.deliverProgress) {
|
|
203
|
-
await plugin.deliverProgress(request.pending, request.text);
|
|
204
|
-
return { delivered: true, metadata: { surface, pluginId: plugin.id, fallback: 'deliverProgress' } };
|
|
205
|
-
}
|
|
206
|
-
return null;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
async getSetupSchema(surface: ChannelSurface, accountId?: string): Promise<ChannelSetupSchema | null> {
|
|
210
|
-
const plugin = this.getBySurface(surface);
|
|
211
|
-
if (!plugin?.getSetupSchema) return null;
|
|
212
|
-
return plugin.getSetupSchema(accountId);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
async doctor(surface: ChannelSurface, accountId?: string): Promise<ChannelDoctorReport | null> {
|
|
216
|
-
const plugin = this.getBySurface(surface);
|
|
217
|
-
if (!plugin?.doctor) return null;
|
|
218
|
-
return plugin.doctor(accountId);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
async listRepairActions(surface: ChannelSurface, accountId?: string): Promise<readonly ChannelRepairAction[]> {
|
|
222
|
-
const plugin = this.getBySurface(surface);
|
|
223
|
-
if (!plugin?.listRepairActions) return [];
|
|
224
|
-
return plugin.listRepairActions(accountId);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
async getLifecycleState(surface: ChannelSurface, accountId?: string): Promise<ChannelLifecycleState | null> {
|
|
228
|
-
const plugin = this.getBySurface(surface);
|
|
229
|
-
if (!plugin?.getLifecycleState) return null;
|
|
230
|
-
return plugin.getLifecycleState(accountId);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
async migrateLifecycle(
|
|
234
|
-
surface: ChannelSurface,
|
|
235
|
-
accountId?: string,
|
|
236
|
-
input?: Record<string, unknown>,
|
|
237
|
-
): Promise<ChannelLifecycleState | null> {
|
|
238
|
-
const plugin = this.getBySurface(surface);
|
|
239
|
-
if (!plugin?.migrateLifecycle) return null;
|
|
240
|
-
return plugin.migrateLifecycle(accountId, input);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
async resolveAllowlist(surface: ChannelSurface, input: ChannelAllowlistEditInput): Promise<ChannelAllowlistResolution | null> {
|
|
244
|
-
const plugin = this.getBySurface(surface);
|
|
245
|
-
if (!plugin?.resolveAllowlist) return null;
|
|
246
|
-
return plugin.resolveAllowlist(input);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
async editAllowlist(surface: ChannelSurface, input: ChannelAllowlistEditInput): Promise<ChannelAllowlistEditResult | null> {
|
|
250
|
-
const plugin = this.getBySurface(surface);
|
|
251
|
-
if (!plugin?.editAllowlist) return null;
|
|
252
|
-
return plugin.editAllowlist(input);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
async listStatus(): Promise<ChannelStatusSnapshot[]> {
|
|
256
|
-
const snapshots: ChannelStatusSnapshot[] = [];
|
|
257
|
-
for (const plugin of this.list()) {
|
|
258
|
-
if (!plugin.getStatus) continue;
|
|
259
|
-
snapshots.push(await plugin.getStatus());
|
|
260
|
-
}
|
|
261
|
-
return snapshots.sort((a, b) => a.label.localeCompare(b.label));
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
async listAccounts(surface?: ChannelSurface): Promise<ChannelAccountRecord[]> {
|
|
265
|
-
const plugins = surface ? [this.getBySurface(surface)].filter((value): value is ChannelPlugin => value !== null) : this.list();
|
|
266
|
-
const accounts: ChannelAccountRecord[] = [];
|
|
267
|
-
for (const plugin of plugins) {
|
|
268
|
-
if (!plugin.listAccounts) continue;
|
|
269
|
-
accounts.push(...await plugin.listAccounts());
|
|
270
|
-
}
|
|
271
|
-
return accounts.sort((a, b) => a.surface.localeCompare(b.surface) || a.label.localeCompare(b.label) || a.id.localeCompare(b.id));
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
async getAccount(surface: ChannelSurface, accountId: string): Promise<ChannelAccountRecord | null> {
|
|
275
|
-
const plugin = this.getBySurface(surface);
|
|
276
|
-
if (!plugin) return null;
|
|
277
|
-
if (plugin.getAccount) {
|
|
278
|
-
return plugin.getAccount(accountId);
|
|
279
|
-
}
|
|
280
|
-
if (plugin.listAccounts) {
|
|
281
|
-
const accounts = await plugin.listAccounts();
|
|
282
|
-
return accounts.find((entry) => entry.id === accountId || entry.accountId === accountId) ?? null;
|
|
283
|
-
}
|
|
284
|
-
return null;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
async runAccountAction(
|
|
288
|
-
surface: ChannelSurface,
|
|
289
|
-
action: ChannelAccountLifecycleAction,
|
|
290
|
-
accountId?: string,
|
|
291
|
-
input?: Record<string, unknown>,
|
|
292
|
-
): Promise<ChannelAccountLifecycleResult | null> {
|
|
293
|
-
const plugin = this.getBySurface(surface);
|
|
294
|
-
if (!plugin) return null;
|
|
295
|
-
if (plugin.runAccountAction) return plugin.runAccountAction(action, accountId, input);
|
|
296
|
-
if (action === 'start' && plugin.startAccount) return plugin.startAccount(accountId, input);
|
|
297
|
-
if (action === 'stop' && plugin.stopAccount) return plugin.stopAccount(accountId, input);
|
|
298
|
-
if ((action === 'login' || action === 'connect') && plugin.loginAccount) return plugin.loginAccount(accountId, input);
|
|
299
|
-
if (action === 'setup' && plugin.loginWithQrStart) return plugin.loginWithQrStart(accountId, input);
|
|
300
|
-
if (action === 'wait_login' && plugin.loginWithQrWait) return plugin.loginWithQrWait(accountId, input);
|
|
301
|
-
if ((action === 'logout' || action === 'disconnect') && plugin.logoutAccount) return plugin.logoutAccount(accountId, input);
|
|
302
|
-
if (action === 'inspect') {
|
|
303
|
-
const account = accountId ? await this.getAccount(surface, accountId) : (await this.listAccounts(surface))[0] ?? null;
|
|
304
|
-
return {
|
|
305
|
-
surface,
|
|
306
|
-
...(accountId ? { accountId } : account?.accountId ? { accountId: account.accountId } : {}),
|
|
307
|
-
action,
|
|
308
|
-
ok: account !== null,
|
|
309
|
-
...(account ? { state: account.state, authState: account.authState } : {}),
|
|
310
|
-
account,
|
|
311
|
-
message: account ? 'Account posture inspected.' : 'No matching channel account was found.',
|
|
312
|
-
metadata: {},
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
return null;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
async authorizeActorAction(
|
|
319
|
-
surface: ChannelSurface,
|
|
320
|
-
request: ChannelActorAuthorizationRequest,
|
|
321
|
-
): Promise<ChannelActorAuthorizationResult | null> {
|
|
322
|
-
const plugin = this.getBySurface(surface);
|
|
323
|
-
if (!plugin) return null;
|
|
324
|
-
if (plugin.authorizeActorAction) return plugin.authorizeActorAction(request);
|
|
325
|
-
if (plugin.getActionAvailabilityState) return plugin.getActionAvailabilityState(request);
|
|
326
|
-
const account = request.accountId ? await this.getAccount(surface, request.accountId) : (await this.listAccounts(surface))[0] ?? null;
|
|
327
|
-
const allowed = Boolean(account?.enabled && account.configured);
|
|
328
|
-
return {
|
|
329
|
-
allowed,
|
|
330
|
-
reason: allowed ? 'Account is configured and enabled.' : 'No configured enabled account is available for this surface.',
|
|
331
|
-
account,
|
|
332
|
-
actionAvailable: allowed,
|
|
333
|
-
metadata: { fallback: true },
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
async listCapabilities(surface?: ChannelSurface): Promise<ChannelCapabilityDescriptor[]> {
|
|
338
|
-
const plugins = surface ? [this.getBySurface(surface)].filter((value): value is ChannelPlugin => value !== null) : this.list();
|
|
339
|
-
const capabilities: ChannelCapabilityDescriptor[] = [];
|
|
340
|
-
for (const plugin of plugins) {
|
|
341
|
-
if (!plugin.listCapabilities) continue;
|
|
342
|
-
capabilities.push(...await plugin.listCapabilities());
|
|
343
|
-
}
|
|
344
|
-
return capabilities.sort((a, b) => a.surface.localeCompare(b.surface) || a.scope.localeCompare(b.scope) || a.label.localeCompare(b.label));
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
async listTools(surface?: ChannelSurface): Promise<ChannelToolDescriptor[]> {
|
|
348
|
-
const plugins = surface ? [this.getBySurface(surface)].filter((value): value is ChannelPlugin => value !== null) : this.list();
|
|
349
|
-
const tools: ChannelToolDescriptor[] = [];
|
|
350
|
-
for (const plugin of plugins) {
|
|
351
|
-
if (!plugin.listTools) continue;
|
|
352
|
-
tools.push(...await plugin.listTools());
|
|
353
|
-
}
|
|
354
|
-
return tools.sort((a, b) => a.surface.localeCompare(b.surface) || a.name.localeCompare(b.name));
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
async runTool(
|
|
358
|
-
surface: ChannelSurface,
|
|
359
|
-
toolId: string,
|
|
360
|
-
input?: Record<string, unknown>,
|
|
361
|
-
): Promise<unknown> {
|
|
362
|
-
const plugin = this.getBySurface(surface);
|
|
363
|
-
if (!plugin?.runTool) return null;
|
|
364
|
-
return plugin.runTool(toolId, input);
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
async listOperatorActions(surface?: ChannelSurface): Promise<ChannelOperatorActionDescriptor[]> {
|
|
368
|
-
const plugins = surface ? [this.getBySurface(surface)].filter((value): value is ChannelPlugin => value !== null) : this.list();
|
|
369
|
-
const actions: ChannelOperatorActionDescriptor[] = [];
|
|
370
|
-
for (const plugin of plugins) {
|
|
371
|
-
if (!plugin.listOperatorActions) continue;
|
|
372
|
-
actions.push(...await plugin.listOperatorActions());
|
|
373
|
-
}
|
|
374
|
-
return actions.sort((a, b) => a.surface.localeCompare(b.surface) || a.label.localeCompare(b.label));
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
async runOperatorAction(
|
|
378
|
-
surface: ChannelSurface,
|
|
379
|
-
actionId: string,
|
|
380
|
-
input?: Record<string, unknown>,
|
|
381
|
-
): Promise<unknown> {
|
|
382
|
-
const plugin = this.getBySurface(surface);
|
|
383
|
-
if (!plugin?.runOperatorAction) return null;
|
|
384
|
-
return plugin.runOperatorAction(actionId, input);
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
listAgentTools(surface?: ChannelSurface): Tool[] {
|
|
388
|
-
const plugins = surface ? [this.getBySurface(surface)].filter((value): value is ChannelPlugin => value !== null) : this.list();
|
|
389
|
-
const tools: Tool[] = [];
|
|
390
|
-
const seen = new Set<string>();
|
|
391
|
-
for (const plugin of plugins) {
|
|
392
|
-
if (!plugin.listAgentTools) continue;
|
|
393
|
-
for (const tool of plugin.listAgentTools()) {
|
|
394
|
-
if (seen.has(tool.definition.name)) continue;
|
|
395
|
-
seen.add(tool.definition.name);
|
|
396
|
-
tools.push(tool);
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
return tools.sort((a, b) => a.definition.name.localeCompare(b.definition.name));
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
async resolveTarget(
|
|
403
|
-
surface: ChannelSurface,
|
|
404
|
-
options: ChannelTargetResolveOptions,
|
|
405
|
-
): Promise<ChannelResolvedTarget | null> {
|
|
406
|
-
const plugin = this.getBySurface(surface);
|
|
407
|
-
const input = options.input.trim();
|
|
408
|
-
if (!plugin || input.length === 0) return null;
|
|
409
|
-
if (plugin.resolveTarget) {
|
|
410
|
-
const resolved = await plugin.resolveTarget(options);
|
|
411
|
-
if (resolved) return resolved;
|
|
412
|
-
}
|
|
413
|
-
const explicit = plugin.parseExplicitTarget ? await plugin.parseExplicitTarget(input, options) : null;
|
|
414
|
-
if (explicit) return explicit;
|
|
415
|
-
const directory = await this.queryDirectory(surface, {
|
|
416
|
-
query: input,
|
|
417
|
-
limit: 1,
|
|
418
|
-
...(options.preferredKind === 'direct' ? { scope: 'users' as const } : {}),
|
|
419
|
-
...(options.preferredKind === 'group' || options.preferredKind === 'channel' ? { scope: 'groups' as const } : {}),
|
|
420
|
-
...(options.threadId ? { scope: 'threads' as const } : {}),
|
|
421
|
-
});
|
|
422
|
-
const entry = directory[0];
|
|
423
|
-
if (entry) {
|
|
424
|
-
const kind = entry.kind === 'user' || entry.kind === 'self' || entry.kind === 'member'
|
|
425
|
-
? 'direct'
|
|
426
|
-
: entry.kind === 'thread'
|
|
427
|
-
? 'thread'
|
|
428
|
-
: entry.kind === 'channel'
|
|
429
|
-
? 'channel'
|
|
430
|
-
: entry.kind === 'group'
|
|
431
|
-
? 'group'
|
|
432
|
-
: 'service';
|
|
433
|
-
const target: ChannelResolvedTarget = {
|
|
434
|
-
surface,
|
|
435
|
-
input: options.input,
|
|
436
|
-
normalized: input.toLowerCase(),
|
|
437
|
-
kind,
|
|
438
|
-
to: entry.handle ?? entry.id,
|
|
439
|
-
display: entry.label,
|
|
440
|
-
accountId: entry.accountId ?? options.accountId,
|
|
441
|
-
workspaceId: entry.workspaceId,
|
|
442
|
-
channelId: entry.kind === 'channel' || entry.kind === 'group' ? entry.groupId ?? entry.id : undefined,
|
|
443
|
-
groupId: entry.groupId,
|
|
444
|
-
threadId: options.threadId ?? entry.threadId,
|
|
445
|
-
parentId: entry.parentId,
|
|
446
|
-
directoryEntryId: entry.id,
|
|
447
|
-
source: 'directory',
|
|
448
|
-
sessionTarget: `channel:${surface}:${entry.id}`,
|
|
449
|
-
metadata: { directoryEntry: entry },
|
|
450
|
-
};
|
|
451
|
-
const sessionTarget = plugin.resolveSessionTarget ? await plugin.resolveSessionTarget(target, options) : null;
|
|
452
|
-
return sessionTarget ? { ...target, sessionTarget } : target;
|
|
453
|
-
}
|
|
454
|
-
const inferredKind = plugin.inferTargetConversationKind
|
|
455
|
-
? await plugin.inferTargetConversationKind(input, options)
|
|
456
|
-
: options.preferredKind ?? 'service';
|
|
457
|
-
if (!options.createIfMissing) {
|
|
458
|
-
return {
|
|
459
|
-
surface,
|
|
460
|
-
input: options.input,
|
|
461
|
-
normalized: input.toLowerCase(),
|
|
462
|
-
kind: inferredKind ?? options.preferredKind ?? 'service',
|
|
463
|
-
to: input,
|
|
464
|
-
accountId: options.accountId,
|
|
465
|
-
threadId: options.threadId,
|
|
466
|
-
sessionTarget: `channel:${surface}:${input.toLowerCase()}`,
|
|
467
|
-
source: 'miss',
|
|
468
|
-
metadata: { fallback: true },
|
|
469
|
-
};
|
|
470
|
-
}
|
|
471
|
-
return {
|
|
472
|
-
surface,
|
|
473
|
-
input: options.input,
|
|
474
|
-
normalized: input.toLowerCase(),
|
|
475
|
-
kind: inferredKind ?? options.preferredKind ?? 'service',
|
|
476
|
-
to: input,
|
|
477
|
-
accountId: options.accountId,
|
|
478
|
-
threadId: options.threadId,
|
|
479
|
-
sessionTarget: `channel:${surface}:${input.toLowerCase()}`,
|
|
480
|
-
source: 'synthetic',
|
|
481
|
-
metadata: { fallback: true },
|
|
482
|
-
};
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
async resolveSessionTarget(
|
|
486
|
-
surface: ChannelSurface,
|
|
487
|
-
target: ChannelResolvedTarget,
|
|
488
|
-
options?: ChannelTargetResolveOptions,
|
|
489
|
-
): Promise<string | null> {
|
|
490
|
-
const plugin = this.getBySurface(surface);
|
|
491
|
-
if (!plugin?.resolveSessionTarget) return target.sessionTarget ?? null;
|
|
492
|
-
return plugin.resolveSessionTarget(target, options);
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
async resolveParentConversationCandidates(
|
|
496
|
-
surface: ChannelSurface,
|
|
497
|
-
options: ChannelTargetResolveOptions,
|
|
498
|
-
): Promise<readonly ChannelResolvedTarget[]> {
|
|
499
|
-
const plugin = this.getBySurface(surface);
|
|
500
|
-
if (!plugin) return [];
|
|
501
|
-
if (plugin.resolveParentConversationCandidates) return plugin.resolveParentConversationCandidates(options);
|
|
502
|
-
const resolved = await this.resolveTarget(surface, options);
|
|
503
|
-
return resolved ? [resolved] : [];
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
async lookupDirectory(
|
|
507
|
-
surface: ChannelSurface,
|
|
508
|
-
query: string,
|
|
509
|
-
options?: ChannelDirectoryQueryOptions,
|
|
510
|
-
): Promise<readonly ChannelDirectoryEntry[]> {
|
|
511
|
-
const plugin = this.getBySurface(surface);
|
|
512
|
-
if (!plugin) return [];
|
|
513
|
-
if (plugin.lookupDirectory) return plugin.lookupDirectory(query, options);
|
|
514
|
-
if (plugin.queryDirectory) return plugin.queryDirectory({ ...options, query });
|
|
515
|
-
return [];
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
async queryDirectory(
|
|
519
|
-
surface: ChannelSurface,
|
|
520
|
-
options: ChannelDirectoryQueryOptions,
|
|
521
|
-
): Promise<readonly ChannelDirectoryEntry[]> {
|
|
522
|
-
const plugin = this.getBySurface(surface);
|
|
523
|
-
if (!plugin) return [];
|
|
524
|
-
if (options.scope === 'members' && options.groupId && plugin.listGroupMembers) {
|
|
525
|
-
return plugin.listGroupMembers(options.groupId, options);
|
|
526
|
-
}
|
|
527
|
-
if (plugin.queryDirectory) return plugin.queryDirectory(options);
|
|
528
|
-
if (plugin.lookupDirectory) return plugin.lookupDirectory(options.query ?? '', options);
|
|
529
|
-
return [];
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
async listGroupMembers(
|
|
533
|
-
surface: ChannelSurface,
|
|
534
|
-
groupId: string,
|
|
535
|
-
options: ChannelDirectoryQueryOptions = {},
|
|
536
|
-
): Promise<readonly ChannelDirectoryEntry[]> {
|
|
537
|
-
const plugin = this.getBySurface(surface);
|
|
538
|
-
if (!plugin) return [];
|
|
539
|
-
if (plugin.listGroupMembers) {
|
|
540
|
-
return plugin.listGroupMembers(groupId, options);
|
|
541
|
-
}
|
|
542
|
-
if (plugin.queryDirectory) {
|
|
543
|
-
return plugin.queryDirectory({
|
|
544
|
-
...options,
|
|
545
|
-
scope: 'members',
|
|
546
|
-
groupId,
|
|
547
|
-
});
|
|
548
|
-
}
|
|
549
|
-
return [];
|
|
550
|
-
}
|
|
551
|
-
}
|