@pellux/goodvibes-tui 0.18.12 → 0.18.13

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.
Files changed (157) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +1 -1
  3. package/docs/foundation-artifacts/operator-contract.json +1 -1
  4. package/package.json +2 -2
  5. package/src/config/index.ts +1 -138
  6. package/src/config/subscription-providers.ts +1 -127
  7. package/src/core/conversation-rendering.ts +3 -3
  8. package/src/core/conversation.ts +176 -423
  9. package/src/core/history.ts +45 -0
  10. package/src/core/orchestrator.ts +3 -735
  11. package/src/core/system-message-router.ts +19 -58
  12. package/src/input/handler-content-actions.ts +2 -2
  13. package/src/input/handler-feed.ts +1 -1
  14. package/src/input/handler-modal-token-routes.ts +1 -1
  15. package/src/input/handler-ui-state.ts +1 -1
  16. package/src/input/handler.ts +1 -1
  17. package/src/input/search.ts +1 -1
  18. package/src/input/selection.ts +2 -2
  19. package/src/main.ts +1 -1
  20. package/src/panels/agent-inspector-panel.ts +3 -3
  21. package/src/panels/agent-logs-panel.ts +3 -3
  22. package/src/panels/approval-panel.ts +2 -2
  23. package/src/panels/automation-control-panel.ts +3 -3
  24. package/src/panels/base-panel.ts +14 -14
  25. package/src/panels/builtin/operations.ts +1 -1
  26. package/src/panels/builtin/session.ts +1 -1
  27. package/src/panels/builtin/shared.ts +3 -3
  28. package/src/panels/cockpit-panel.ts +2 -2
  29. package/src/panels/communication-panel.ts +3 -3
  30. package/src/panels/context-visualizer-panel.ts +2 -2
  31. package/src/panels/control-plane-panel.ts +3 -3
  32. package/src/panels/cost-tracker-panel.ts +3 -3
  33. package/src/panels/debug-panel.ts +2 -2
  34. package/src/panels/diff-panel.ts +2 -2
  35. package/src/panels/docs-panel.ts +1 -1
  36. package/src/panels/eval-panel.ts +2 -2
  37. package/src/panels/file-explorer-panel.ts +3 -3
  38. package/src/panels/file-preview-panel.ts +3 -3
  39. package/src/panels/forensics-panel.ts +2 -2
  40. package/src/panels/git-panel.ts +1 -1
  41. package/src/panels/hooks-panel.ts +3 -3
  42. package/src/panels/incident-review-panel.ts +1 -1
  43. package/src/panels/intelligence-panel.ts +2 -2
  44. package/src/panels/knowledge-panel.ts +1 -1
  45. package/src/panels/local-auth-panel.ts +2 -2
  46. package/src/panels/marketplace-panel.ts +1 -1
  47. package/src/panels/mcp-panel.ts +3 -3
  48. package/src/panels/memory-panel.ts +1 -1
  49. package/src/panels/ops-control-panel.ts +3 -3
  50. package/src/panels/ops-strategy-panel.ts +2 -2
  51. package/src/panels/orchestration-panel.ts +2 -2
  52. package/src/panels/panel-list-panel.ts +6 -6
  53. package/src/panels/plan-dashboard-panel.ts +1 -1
  54. package/src/panels/plugins-panel.ts +2 -2
  55. package/src/panels/policy-panel.ts +2 -2
  56. package/src/panels/polish.ts +3 -3
  57. package/src/panels/provider-accounts-panel.ts +2 -2
  58. package/src/panels/provider-health-panel.ts +2 -2
  59. package/src/panels/provider-stats-panel.ts +3 -3
  60. package/src/panels/remote-panel.ts +3 -3
  61. package/src/panels/routes-panel.ts +3 -3
  62. package/src/panels/sandbox-panel.ts +2 -2
  63. package/src/panels/schedule-panel.ts +1 -1
  64. package/src/panels/security-panel.ts +2 -2
  65. package/src/panels/services-panel.ts +2 -2
  66. package/src/panels/session-browser-panel.ts +2 -2
  67. package/src/panels/settings-sync-panel.ts +2 -2
  68. package/src/panels/skills-panel.ts +6 -6
  69. package/src/panels/subscription-panel.ts +2 -2
  70. package/src/panels/symbol-outline-panel.ts +3 -3
  71. package/src/panels/system-messages-panel.ts +4 -4
  72. package/src/panels/tasks-panel.ts +2 -2
  73. package/src/panels/thinking-panel.ts +3 -3
  74. package/src/panels/token-budget-panel.ts +1 -1
  75. package/src/panels/tool-inspector-panel.ts +3 -3
  76. package/src/panels/types.ts +5 -5
  77. package/src/panels/watchers-panel.ts +3 -3
  78. package/src/panels/welcome-panel.ts +1 -1
  79. package/src/panels/worktree-panel.ts +2 -2
  80. package/src/panels/wrfc-panel.ts +3 -3
  81. package/src/permissions/prompt.ts +3 -22
  82. package/src/plugins/loader.ts +15 -304
  83. package/src/renderer/agent-detail-modal.ts +1 -1
  84. package/src/renderer/autocomplete-overlay.ts +2 -2
  85. package/src/renderer/bookmark-modal.ts +1 -1
  86. package/src/renderer/bottom-bar.ts +2 -2
  87. package/src/renderer/buffer.ts +1 -1
  88. package/src/renderer/code-block.ts +2 -2
  89. package/src/renderer/compositor.ts +2 -2
  90. package/src/renderer/context-inspector.ts +1 -1
  91. package/src/renderer/conversation-layout.ts +2 -2
  92. package/src/renderer/conversation-overlays.ts +1 -1
  93. package/src/renderer/conversation-surface.ts +2 -2
  94. package/src/renderer/diff-view.ts +2 -2
  95. package/src/renderer/diff.ts +1 -1
  96. package/src/renderer/file-picker-overlay.ts +2 -2
  97. package/src/renderer/file-tree.ts +2 -2
  98. package/src/renderer/help-overlay.ts +1 -1
  99. package/src/renderer/history-search-overlay.ts +2 -2
  100. package/src/renderer/live-tail-modal.ts +1 -1
  101. package/src/renderer/markdown.ts +2 -2
  102. package/src/renderer/modal-factory.ts +3 -3
  103. package/src/renderer/model-picker-overlay.ts +2 -2
  104. package/src/renderer/overlay-box.ts +2 -2
  105. package/src/renderer/panel-composite.ts +1 -1
  106. package/src/renderer/panel-picker-overlay.ts +2 -2
  107. package/src/renderer/panel-tab-bar.ts +1 -1
  108. package/src/renderer/panel-workspace-bar.ts +1 -1
  109. package/src/renderer/process-indicator.ts +2 -2
  110. package/src/renderer/process-modal.ts +1 -1
  111. package/src/renderer/profile-picker-modal.ts +2 -2
  112. package/src/renderer/progress.ts +2 -2
  113. package/src/renderer/search-overlay.ts +2 -2
  114. package/src/renderer/selection-modal-overlay.ts +2 -2
  115. package/src/renderer/session-picker-modal.ts +2 -2
  116. package/src/renderer/settings-modal.ts +2 -2
  117. package/src/renderer/shell-surface.ts +1 -1
  118. package/src/renderer/system-message.ts +1 -1
  119. package/src/renderer/tab-strip.ts +2 -2
  120. package/src/renderer/text-layout.ts +1 -1
  121. package/src/renderer/thinking.ts +1 -1
  122. package/src/renderer/tool-call.ts +2 -2
  123. package/src/renderer/ui-factory.ts +2 -2
  124. package/src/runtime/bootstrap-command-context.ts +4 -5
  125. package/src/runtime/bootstrap-command-parts.ts +1 -3
  126. package/src/runtime/bootstrap-core.ts +3 -2
  127. package/src/runtime/bootstrap-hook-bridge.ts +15 -174
  128. package/src/runtime/bootstrap-shell.ts +4 -4
  129. package/src/runtime/bootstrap.ts +1 -1
  130. package/src/runtime/context.ts +4 -20
  131. package/src/runtime/diagnostics/panels/index.ts +1 -1
  132. package/src/runtime/diagnostics/panels/ops.ts +1 -1
  133. package/src/runtime/diagnostics/panels/panel-resources.ts +118 -0
  134. package/src/runtime/perf/panel-contracts.ts +32 -0
  135. package/src/runtime/perf/panel-health-monitor.ts +18 -0
  136. package/src/runtime/services.ts +4 -4
  137. package/src/runtime/store/domains/conversation.ts +1 -181
  138. package/src/runtime/store/domains/permissions.ts +1 -143
  139. package/src/runtime/store/helpers/reducers/conversation.ts +1 -228
  140. package/src/runtime/store/helpers/reducers/lifecycle.ts +1 -440
  141. package/src/runtime/store/selectors/index.ts +11 -6
  142. package/src/runtime/store/state.ts +12 -4
  143. package/src/runtime/ui-events.ts +46 -0
  144. package/src/runtime/ui-services.ts +1 -1
  145. package/src/shell/ui-openers.ts +1 -1
  146. package/src/tools/index.ts +1 -186
  147. package/src/types/grid.ts +48 -0
  148. package/src/utils/clipboard.ts +21 -0
  149. package/src/utils/splash-lines.ts +1 -1
  150. package/src/utils/terminal-width.ts +185 -0
  151. package/src/version.ts +1 -1
  152. package/src/daemon/facade-composition.ts +0 -398
  153. package/src/daemon/facade.ts +0 -638
  154. package/src/daemon/surface-policy.ts +0 -60
  155. package/src/daemon/types.ts +0 -191
  156. package/src/runtime/ui-read-models-core.ts +0 -95
  157. package/src/runtime/ui-read-models-operations.ts +0 -203
@@ -1,60 +0,0 @@
1
- import type { ConfigManager } from '@pellux/goodvibes-sdk/platform/config/manager';
2
-
3
- type SurfaceDeliveryTarget =
4
- | 'slack'
5
- | 'discord'
6
- | 'ntfy'
7
- | 'webhook'
8
- | 'telegram'
9
- | 'google-chat'
10
- | 'signal'
11
- | 'whatsapp'
12
- | 'imessage'
13
- | 'msteams'
14
- | 'bluebubbles'
15
- | 'mattermost'
16
- | 'matrix';
17
-
18
- export function isSurfaceDeliveryEnabled(
19
- configManager: ConfigManager,
20
- surface: SurfaceDeliveryTarget,
21
- ): boolean {
22
- if (surface === 'slack') {
23
- return Boolean(configManager.get('surfaces.slack.enabled') || process.env.SLACK_BOT_TOKEN || process.env.SLACK_APP_TOKEN || process.env.SLACK_WEBHOOK_URL);
24
- }
25
- if (surface === 'discord') {
26
- return Boolean(configManager.get('surfaces.discord.enabled') || process.env.DISCORD_BOT_TOKEN || process.env.DISCORD_WEBHOOK_URL);
27
- }
28
- if (surface === 'webhook') {
29
- return Boolean(configManager.get('surfaces.webhook.enabled') || configManager.get('surfaces.webhook.defaultTarget'));
30
- }
31
- if (surface === 'ntfy') {
32
- return Boolean(configManager.get('surfaces.ntfy.enabled') || configManager.get('surfaces.ntfy.topic') || process.env.NTFY_ACCESS_TOKEN);
33
- }
34
- const surfaces = configManager.getCategory('surfaces');
35
- if (surface === 'telegram') {
36
- return Boolean(surfaces.telegram.enabled || surfaces.telegram.botToken || surfaces.telegram.defaultChatId || process.env.TELEGRAM_BOT_TOKEN);
37
- }
38
- if (surface === 'google-chat') {
39
- return Boolean(surfaces.googleChat.enabled || surfaces.googleChat.webhookUrl || surfaces.googleChat.spaceId || process.env.GOOGLE_CHAT_WEBHOOK_URL);
40
- }
41
- if (surface === 'signal') {
42
- return Boolean(surfaces.signal.enabled || surfaces.signal.bridgeUrl || surfaces.signal.account || process.env.SIGNAL_BRIDGE_TOKEN);
43
- }
44
- if (surface === 'whatsapp') {
45
- return Boolean(surfaces.whatsapp.enabled || surfaces.whatsapp.accessToken || surfaces.whatsapp.phoneNumberId || process.env.WHATSAPP_ACCESS_TOKEN);
46
- }
47
- if (surface === 'imessage') {
48
- return Boolean(surfaces.imessage.enabled || surfaces.imessage.bridgeUrl || surfaces.imessage.account || process.env.IMESSAGE_BRIDGE_TOKEN);
49
- }
50
- if (surface === 'msteams') {
51
- return Boolean(surfaces.msteams.enabled || surfaces.msteams.appId || surfaces.msteams.defaultConversationId || process.env.MSTEAMS_APP_ID);
52
- }
53
- if (surface === 'bluebubbles') {
54
- return Boolean(surfaces.bluebubbles.enabled || surfaces.bluebubbles.serverUrl || surfaces.bluebubbles.defaultChatGuid || process.env.BLUEBUBBLES_SERVER_URL);
55
- }
56
- if (surface === 'mattermost') {
57
- return Boolean(surfaces.mattermost.enabled || surfaces.mattermost.baseUrl || surfaces.mattermost.defaultChannelId || process.env.MATTERMOST_BASE_URL);
58
- }
59
- return Boolean(surfaces.matrix.enabled || surfaces.matrix.homeserverUrl || surfaces.matrix.defaultRoomId || process.env.MATRIX_HOMESERVER);
60
- }
@@ -1,191 +0,0 @@
1
- import type { RuntimeEventDomain } from '@pellux/goodvibes-sdk/platform/runtime/events/index';
2
- import type { ChannelSurface } from '@pellux/goodvibes-sdk/platform/channels/index';
3
- import type { ConfigManager } from '@pellux/goodvibes-sdk/platform/config/manager';
4
- import type { ServiceRegistry } from '../config/service-registry.ts';
5
- import type { UserAuthManager } from '@pellux/goodvibes-sdk/platform/security/user-auth';
6
- import type { AgentManager } from '@pellux/goodvibes-sdk/platform/tools/agent/index';
7
- import type { AutomationDeliveryManager, AutomationManager } from '@pellux/goodvibes-sdk/platform/automation/index';
8
- import type { ApprovalBroker, ControlPlaneGateway, SharedSessionBroker } from '@pellux/goodvibes-sdk/platform/control-plane/index';
9
- import type { GatewayMethodCatalog, GatewayMethodDescriptor } from '@pellux/goodvibes-sdk/platform/control-plane/index';
10
- import type { ProviderRegistry } from '@pellux/goodvibes-sdk/platform/providers/registry';
11
- import type { RouteBindingManager, ChannelPolicyManager, ChannelPluginRegistry, ChannelReplyPipeline, ChannelProviderRuntimeManager, SurfaceRegistry, BuiltinChannelRuntime } from '@pellux/goodvibes-sdk/platform/channels/index';
12
- import type { RuntimeEventBus } from '@pellux/goodvibes-sdk/platform/runtime/events/index';
13
- import type { IntegrationHelperService } from '@pellux/goodvibes-sdk/platform/runtime/integration/helpers';
14
- import type { DomainDispatch, RuntimeStore } from '../runtime/store/index.ts';
15
- import type { RuntimeServices } from '../runtime/services.ts';
16
- import type { DistributedRuntimeManager } from '@pellux/goodvibes-sdk/platform/runtime/remote/index';
17
- import type { WatcherRegistry } from '@pellux/goodvibes-sdk/platform/watchers/index';
18
- import type { VoiceService } from '@pellux/goodvibes-sdk/platform/voice/index';
19
- import type { WebSearchService } from '@pellux/goodvibes-sdk/platform/web-search/index';
20
- import type { KnowledgeGraphqlService, KnowledgeService } from '@pellux/goodvibes-sdk/platform/knowledge/index';
21
- import type { MediaProviderRegistry } from '@pellux/goodvibes-sdk/platform/media/index';
22
- import type { MultimodalService } from '@pellux/goodvibes-sdk/platform/multimodal/index';
23
- import type { ArtifactStore } from '@pellux/goodvibes-sdk/platform/artifacts/index';
24
- import type { AutomationExecutionPolicy, AutomationExternalContentSource, AutomationWakeMode } from '@pellux/goodvibes-sdk/platform/automation/index';
25
- import type { AutomationJob } from '@pellux/goodvibes-sdk/platform/automation/jobs';
26
- import type { SurfaceAdapterContext, GenericWebhookAdapterContext } from '@pellux/goodvibes-sdk/platform/adapters/index';
27
- import type { SharedApprovalRecord } from '@pellux/goodvibes-sdk/platform/control-plane/index';
28
- import type { DistributedPeerAuth } from '@pellux/goodvibes-sdk/platform/runtime/remote/index';
29
- import type { HookCategory, HookEventPath, HookPhase } from '@pellux/goodvibes-sdk/platform/hooks/types';
30
- import type { RuntimeEventBus as EventBus } from '@pellux/goodvibes-sdk/platform/runtime/events/index';
31
- import type { EmitterContext } from '@pellux/goodvibes-sdk/platform/runtime/emitters/index';
32
- import type { MemoryEmbeddingProviderRegistry, MemoryRegistry } from '@pellux/goodvibes-sdk/platform/state/index';
33
-
34
- export interface DaemonConfig {
35
- port?: number;
36
- host?: string;
37
- workingDir?: string;
38
- homeDirectory?: string;
39
- configManager?: ConfigManager;
40
- githubWebhookSecret?: string;
41
- agentManager?: AgentManager;
42
- serveFactory?: typeof Bun.serve;
43
- userAuth?: UserAuthManager;
44
- runtimeBus?: RuntimeEventBus | null;
45
- runtimeServices?: RuntimeServices;
46
- }
47
-
48
- export interface DaemonDangerConfig {
49
- daemon: boolean;
50
- }
51
-
52
- export interface ControlPlaneWebSocketData {
53
- readonly channel: 'control-plane';
54
- readonly authToken: string;
55
- readonly principalId: string;
56
- readonly principalKind: 'user' | 'bot' | 'service' | 'token';
57
- readonly admin: boolean;
58
- readonly scopes: readonly string[];
59
- readonly domains: readonly RuntimeEventDomain[];
60
- readonly clientKind:
61
- | 'tui'
62
- | 'web'
63
- | 'slack'
64
- | 'discord'
65
- | 'ntfy'
66
- | 'webhook'
67
- | 'telegram'
68
- | 'google-chat'
69
- | 'signal'
70
- | 'whatsapp'
71
- | 'imessage'
72
- | 'msteams'
73
- | 'bluebubbles'
74
- | 'mattermost'
75
- | 'matrix'
76
- | 'daemon';
77
- readonly remoteAddress?: string;
78
- clientId?: string;
79
- }
80
-
81
- export interface PendingSurfaceReply {
82
- readonly agentId: string;
83
- readonly surfaceKind: ChannelSurface;
84
- readonly task: string;
85
- readonly createdAt: number;
86
- readonly sessionId?: string;
87
- readonly routeId?: string;
88
- readonly responseUrl?: string;
89
- readonly channelId?: string;
90
- readonly applicationId?: string;
91
- readonly interactionToken?: string;
92
- readonly topic?: string;
93
- readonly callbackUrl?: string;
94
- readonly callbackSecret?: string;
95
- readonly callbackSignature?: 'shared-secret' | 'hmac-sha256';
96
- readonly callbackCorrelationId?: string;
97
- readonly targetAddress?: string;
98
- readonly threadId?: string;
99
- [key: string]: unknown;
100
- lastProgressAt?: number;
101
- lastProgress?: string;
102
- }
103
-
104
- export interface DaemonRouteContext {
105
- readonly configManager: ConfigManager;
106
- readonly serviceRegistry: ServiceRegistry;
107
- readonly userAuth: UserAuthManager;
108
- readonly agentManager: AgentManager;
109
- readonly automationManager: AutomationManager;
110
- readonly automationDeliveryManager: AutomationDeliveryManager;
111
- readonly approvalBroker: ApprovalBroker;
112
- readonly controlPlaneGateway: ControlPlaneGateway;
113
- readonly gatewayMethods: GatewayMethodCatalog;
114
- readonly providerRegistry: ProviderRegistry;
115
- readonly sessionBroker: SharedSessionBroker;
116
- readonly routeBindings: RouteBindingManager;
117
- readonly channelPolicy: ChannelPolicyManager;
118
- readonly channelPlugins: ChannelPluginRegistry;
119
- readonly channelReplyPipeline: ChannelReplyPipeline;
120
- readonly providerRuntime: ChannelProviderRuntimeManager;
121
- readonly builtinChannels: BuiltinChannelRuntime;
122
- readonly surfaceRegistry: SurfaceRegistry;
123
- readonly runtimeBus: EventBus | null;
124
- readonly distributedRuntime: DistributedRuntimeManager;
125
- readonly watcherRegistry: WatcherRegistry;
126
- readonly voiceService: VoiceService;
127
- readonly webSearchService: WebSearchService;
128
- readonly knowledgeService: KnowledgeService;
129
- readonly knowledgeGraphqlService: KnowledgeGraphqlService;
130
- readonly mediaProviders: MediaProviderRegistry;
131
- readonly multimodalService: MultimodalService;
132
- readonly artifactStore: ArtifactStore;
133
- readonly memoryRegistry: MemoryRegistry;
134
- readonly memoryEmbeddingRegistry: MemoryEmbeddingProviderRegistry;
135
- readonly integrationHelpers: IntegrationHelperService | null;
136
- readonly runtimeStore: RuntimeStore | null;
137
- readonly runtimeDispatch: DomainDispatch | null;
138
- readonly githubWebhookSecret: string | null;
139
- readonly authToken: string | null;
140
- readonly host: string;
141
- readonly port: number;
142
- readonly tlsTrustProxy: boolean;
143
- readonly pendingSurfaceReplies: Map<string, PendingSurfaceReply>;
144
- readonly buildSurfaceAdapterContext: () => SurfaceAdapterContext;
145
- readonly buildGenericWebhookAdapterContext: () => GenericWebhookAdapterContext;
146
- readonly authorizeSurfaceIngress: (input: unknown) => Promise<unknown>;
147
- readonly extractAuthToken: (req: Request) => string;
148
- readonly checkAuth: (req: Request) => boolean;
149
- readonly requireAuthenticatedSession: (req: Request) => { username: string; roles: readonly string[] } | null;
150
- readonly requireAdmin: (req: Request) => Response | null;
151
- readonly requireRemotePeer: (req: Request, scope?: string) => Promise<DistributedPeerAuth | Response>;
152
- readonly describeAuthenticatedPrincipal: (token: string) => { principalId: string; principalKind: 'user' | 'bot' | 'service' | 'token'; admin: boolean; scopes: readonly string[] } | null;
153
- readonly getGrantedGatewayScopes: (includeWrite: boolean) => readonly string[];
154
- readonly validateGatewayInvocation: (descriptor: GatewayMethodDescriptor, context?: { readonly principalKind?: 'user' | 'bot' | 'service' | 'token' | 'remote-peer'; readonly scopes?: readonly string[]; readonly admin?: boolean; }) => { status: number; ok: false; body: Record<string, unknown> } | null;
155
- readonly parseJsonBody: (req: Request) => Promise<Record<string, unknown> | Response>;
156
- readonly parseOptionalJsonBody: (req: Request) => Promise<Record<string, unknown> | null | Response>;
157
- readonly parseJsonText: (rawBody: string) => Record<string, unknown> | Response;
158
- readonly recordApiResponse: (req: Request, path: string, response: Response, clientKind?: 'web' | 'slack' | 'discord' | 'ntfy' | 'webhook' | 'telegram' | 'google-chat' | 'signal' | 'whatsapp' | 'imessage' | 'msteams' | 'bluebubbles' | 'mattermost' | 'matrix' | 'daemon') => Response;
159
- readonly queueSurfaceReplyFromBinding: (binding: import('@pellux/goodvibes-sdk/platform/automation/routes').AutomationRouteBinding | undefined, input: { readonly agentId: string; readonly task: string; readonly sessionId?: string; }) => void;
160
- readonly queueWebhookReply: (input: { readonly agentId: string; readonly task: string; readonly sessionId?: string; readonly routeId?: string; readonly callbackUrl?: string; readonly callbackCorrelationId?: string; readonly callbackSignature?: PendingSurfaceReply['callbackSignature']; }) => void;
161
- readonly parseSurfaceControlCommand: (text: string) => { readonly action: 'status' | 'cancel' | 'retry'; readonly id: string } | null;
162
- readonly performSurfaceControlCommand: (command: { readonly action: 'status' | 'cancel' | 'retry'; readonly id: string }) => Promise<string>;
163
- readonly performInteractiveSurfaceAction: (actionId: string, surface: 'slack' | 'discord', req: Request) => Promise<string>;
164
- readonly trySpawnAgent: (input: { mode: 'spawn'; task: string; model?: string; tools?: readonly string[]; provider?: string; context?: string }, logLabel: string, sessionId?: string) => import('@pellux/goodvibes-sdk/platform/tools/agent/index').AgentRecord | Response;
165
- readonly syncSpawnedAgentTask: (record: import('@pellux/goodvibes-sdk/platform/tools/agent/index').AgentRecord, sessionId?: string) => void;
166
- readonly syncFinishedAgentTask: (record: import('@pellux/goodvibes-sdk/platform/tools/agent/index').AgentRecord) => void;
167
- readonly findSchedule: (id: string) => AutomationJob | undefined;
168
- readonly surfaceDeliveryEnabled: (surface: 'slack' | 'discord' | 'ntfy' | 'webhook' | 'telegram' | 'google-chat' | 'signal' | 'whatsapp' | 'imessage' | 'msteams' | 'bluebubbles' | 'mattermost' | 'matrix') => boolean;
169
- readonly pollPendingSurfaceReplies: () => Promise<void>;
170
- readonly deliverSurfaceProgress: (pending: PendingSurfaceReply, progress: string) => Promise<void>;
171
- readonly deliverSlackAgentReply: (pending: PendingSurfaceReply, message: string) => Promise<void>;
172
- readonly deliverDiscordAgentReply: (pending: PendingSurfaceReply, message: string) => Promise<void>;
173
- readonly deliverNtfyAgentReply: (pending: PendingSurfaceReply, message: string) => Promise<void>;
174
- readonly deliverWebhookAgentReply: (pending: PendingSurfaceReply, message: string) => Promise<void>;
175
- readonly deliverSlackApprovalUpdate: (approval: SharedApprovalRecord, binding: import('@pellux/goodvibes-sdk/platform/automation/routes').AutomationRouteBinding) => Promise<void>;
176
- readonly deliverDiscordApprovalUpdate: (approval: SharedApprovalRecord, binding: import('@pellux/goodvibes-sdk/platform/automation/routes').AutomationRouteBinding) => Promise<void>;
177
- readonly deliverNtfyApprovalUpdate: (approval: SharedApprovalRecord, binding: import('@pellux/goodvibes-sdk/platform/automation/routes').AutomationRouteBinding) => Promise<void>;
178
- readonly deliverWebhookApprovalUpdate: (approval: SharedApprovalRecord, binding: import('@pellux/goodvibes-sdk/platform/automation/routes').AutomationRouteBinding) => Promise<void>;
179
- readonly notifyApprovalUpdate: (approval: SharedApprovalRecord) => Promise<void>;
180
- readonly controlPlaneWebUrl: (input: { readonly approvalId?: string; readonly sessionId?: string }) => string | undefined;
181
- readonly signWebhookPayload: (body: string, secret: string) => string;
182
- readonly transportId: () => string;
183
- readonly transportScheme: () => 'http' | 'https';
184
- readonly transportEndpoint: () => string;
185
- readonly emitterContext: () => EmitterContext;
186
- readonly emitTransportInitializing: () => void;
187
- readonly emitTransportConnected: () => void;
188
- readonly emitTransportDisconnected: (reason: string, willRetry: boolean) => void;
189
- readonly emitTransportTerminalFailure: (error: string) => void;
190
- readonly fireTransportHook: (specific: string, payload: Record<string, unknown>) => Promise<void>;
191
- }
@@ -1,95 +0,0 @@
1
- import type { RuntimeServices } from './services.ts';
2
- import type { RuntimeTask } from '@pellux/goodvibes-sdk/platform/runtime/store/domains/tasks';
3
- import type { RuntimeAgent } from '@pellux/goodvibes-sdk/platform/runtime/store/domains/agents';
4
- import type { SessionDomainState } from '@pellux/goodvibes-sdk/platform/runtime/store/domains/session';
5
- import type { TurnState } from '@pellux/goodvibes-sdk/platform/runtime/store/domains/conversation';
6
- import { createStoreBackedReadModel, listProviderIds } from '@pellux/goodvibes-sdk/platform/runtime/ui-read-model-helpers';
7
- import type { UiReadModel } from '@pellux/goodvibes-sdk/platform/runtime/ui-read-models-base';
8
-
9
- export interface UiProvidersSnapshot {
10
- readonly providerIds: readonly string[];
11
- }
12
-
13
- export interface UiSessionSnapshot {
14
- readonly session: SessionDomainState;
15
- readonly totalTurns: number;
16
- readonly messageCount: number;
17
- readonly estimatedContextTokens: number;
18
- readonly contextWindow: number;
19
- readonly turnState: TurnState;
20
- readonly streamToolPreview?: string;
21
- readonly contextWarningActive: boolean;
22
- readonly pendingApproval: boolean;
23
- readonly denialCount: number;
24
- }
25
-
26
- export interface UiAgentsSnapshot {
27
- readonly active: readonly RuntimeAgent[];
28
- readonly totalSpawned: number;
29
- readonly totalCompleted: number;
30
- readonly totalFailed: number;
31
- }
32
-
33
- export interface UiTasksSnapshot {
34
- readonly tasks: readonly RuntimeTask[];
35
- }
36
-
37
- export interface UiCoreReadModels {
38
- readonly providers: UiReadModel<UiProvidersSnapshot>;
39
- readonly session: UiReadModel<UiSessionSnapshot>;
40
- readonly agents: UiReadModel<UiAgentsSnapshot>;
41
- readonly tasks: UiReadModel<UiTasksSnapshot>;
42
- }
43
-
44
- export function createCoreReadModels(runtimeServices: RuntimeServices): UiCoreReadModels {
45
- const { runtimeStore } = runtimeServices;
46
-
47
- return {
48
- providers: {
49
- getSnapshot() {
50
- return {
51
- providerIds: listProviderIds(runtimeServices),
52
- };
53
- },
54
- subscribe(listener) {
55
- return runtimeServices.runtimeBus.on('PROVIDERS_CHANGED', listener);
56
- },
57
- },
58
- session: createStoreBackedReadModel(runtimeServices, () => {
59
- const state = runtimeStore.getState();
60
- return {
61
- session: state.session,
62
- totalTurns: state.conversation.totalTurns,
63
- messageCount: state.conversation.messageCount,
64
- estimatedContextTokens: state.conversation.estimatedContextTokens,
65
- contextWindow: state.model.tokenLimits.contextWindow,
66
- turnState: state.conversation.turnState,
67
- streamToolPreview: state.conversation.stream.partialToolPreview,
68
- contextWarningActive: state.conversation.contextWarningActive,
69
- pendingApproval: state.permissions.awaitingDecision,
70
- denialCount: state.permissions.denialCount,
71
- };
72
- }),
73
- agents: createStoreBackedReadModel(runtimeServices, () => {
74
- const state = runtimeStore.getState().agents;
75
- const active = state.activeAgentIds
76
- .map((id) => state.agents.get(id))
77
- .filter((agent): agent is RuntimeAgent => agent !== undefined);
78
- return {
79
- active,
80
- totalSpawned: state.totalSpawned,
81
- totalCompleted: state.totalCompleted,
82
- totalFailed: state.totalFailed,
83
- };
84
- }),
85
- tasks: createStoreBackedReadModel(runtimeServices, () => {
86
- const tasksState = runtimeStore.getState().tasks;
87
- const tasks = [...tasksState.tasks.values()].sort((a, b) => {
88
- const aTime = a.startedAt ?? a.queuedAt;
89
- const bTime = b.startedAt ?? b.queuedAt;
90
- return bTime - aTime || a.title.localeCompare(b.title);
91
- });
92
- return { tasks };
93
- }),
94
- };
95
- }
@@ -1,203 +0,0 @@
1
- import type { ControlPlaneRecentEvent, SharedApprovalRecord, SharedSessionRecord } from '@pellux/goodvibes-sdk/platform/control-plane/index';
2
- import type { RuntimeServices } from './services.ts';
3
- import type { AutomationJob } from '@pellux/goodvibes-sdk/platform/automation/jobs';
4
- import type { AutomationRun } from '@pellux/goodvibes-sdk/platform/automation/runs';
5
- import type { AutomationRouteBinding } from '@pellux/goodvibes-sdk/platform/automation/routes';
6
- import type { WatcherRecord } from '@pellux/goodvibes-sdk/platform/runtime/store/domains/watchers';
7
- import type { OrchestrationGraphRecord } from '@pellux/goodvibes-sdk/platform/runtime/store/domains/orchestration';
8
- import type { RuntimeCommunicationRecord } from '@pellux/goodvibes-sdk/platform/runtime/store/domains/communication';
9
- import type { ControlPlaneClientRecord } from '@pellux/goodvibes-sdk/platform/runtime/store/domains/control-plane';
10
- import type { AcpConnection } from '@pellux/goodvibes-sdk/platform/runtime/store/domains/acp';
11
- import { combineSubscriptions, createStoreBackedReadModel } from '@pellux/goodvibes-sdk/platform/runtime/ui-read-model-helpers';
12
- import type { UiReadModel } from '@pellux/goodvibes-sdk/platform/runtime/ui-read-models-base';
13
-
14
- export interface UiAutomationSnapshot {
15
- readonly jobs: readonly AutomationJob[];
16
- readonly runs: readonly AutomationRun[];
17
- readonly totalJobs: number;
18
- readonly totalRuns: number;
19
- readonly activeRunIds: readonly string[];
20
- readonly totalFailed: number;
21
- readonly sourceCount: number;
22
- readonly deliveryTotals: {
23
- readonly succeeded: number;
24
- readonly failed: number;
25
- readonly deadLettered: number;
26
- };
27
- }
28
-
29
- export interface UiRoutesSnapshot {
30
- readonly bindings: readonly AutomationRouteBinding[];
31
- readonly bindingIdsBySurface: Readonly<Record<string, readonly string[]>>;
32
- readonly totalBindings: number;
33
- readonly activeBindingIds: readonly string[];
34
- readonly totalResolved: number;
35
- readonly totalFailures: number;
36
- }
37
-
38
- export interface UiWatchersSnapshot {
39
- readonly watchers: readonly WatcherRecord[];
40
- readonly totalWatchers: number;
41
- readonly activeWatcherIds: readonly string[];
42
- readonly totalDegraded: number;
43
- readonly totalLagged: number;
44
- }
45
-
46
- export interface UiOrchestrationSnapshot {
47
- readonly graphs: readonly OrchestrationGraphRecord[];
48
- readonly totalGraphs: number;
49
- readonly activeGraphIds: readonly string[];
50
- readonly totalCompletedGraphs: number;
51
- readonly totalFailedGraphs: number;
52
- readonly recursionGuardTrips: number;
53
- }
54
-
55
- export interface UiCommunicationSnapshot {
56
- readonly records: readonly RuntimeCommunicationRecord[];
57
- readonly totalSent: number;
58
- readonly totalDelivered: number;
59
- readonly totalBlocked: number;
60
- }
61
-
62
- export interface UiControlPlaneSnapshot {
63
- readonly connectionState: string;
64
- readonly activeClientIds: readonly string[];
65
- readonly requestCount: number;
66
- readonly errorCount: number;
67
- readonly host: string;
68
- readonly port: number;
69
- readonly clients: readonly ControlPlaneClientRecord[];
70
- readonly approvals: readonly SharedApprovalRecord[];
71
- readonly sessions: readonly SharedSessionRecord[];
72
- readonly recentEvents: readonly ControlPlaneRecentEvent[];
73
- }
74
-
75
- export interface UiOperationsReadModels {
76
- readonly automation: UiReadModel<UiAutomationSnapshot>;
77
- readonly routes: UiReadModel<UiRoutesSnapshot>;
78
- readonly watchers: UiReadModel<UiWatchersSnapshot>;
79
- readonly orchestration: UiReadModel<UiOrchestrationSnapshot>;
80
- readonly communication: UiReadModel<UiCommunicationSnapshot>;
81
- readonly controlPlane: UiReadModel<UiControlPlaneSnapshot>;
82
- }
83
-
84
- export interface UiOperationsReadModelOptions {
85
- readonly getControlPlaneRecentEvents?: (limit: number) => readonly ControlPlaneRecentEvent[];
86
- }
87
-
88
- export function createOperationsReadModels(
89
- runtimeServices: RuntimeServices,
90
- options: UiOperationsReadModelOptions = {},
91
- ): UiOperationsReadModels {
92
- const { runtimeStore } = runtimeServices;
93
-
94
- return {
95
- automation: createStoreBackedReadModel(runtimeServices, () => {
96
- const state = runtimeStore.getState();
97
- const jobs = state.automation.jobIds
98
- .map((id) => state.automation.jobs.get(id))
99
- .filter((job): job is AutomationJob => job !== undefined)
100
- .sort((a, b) => (b.nextRunAt ?? 0) - (a.nextRunAt ?? 0) || a.name.localeCompare(b.name));
101
- const runs = state.automation.runIds
102
- .map((id) => state.automation.runs.get(id))
103
- .filter((run): run is AutomationRun => run !== undefined)
104
- .sort((a, b) => b.queuedAt - a.queuedAt || a.id.localeCompare(b.id));
105
- return {
106
- jobs,
107
- runs,
108
- totalJobs: state.automation.totalJobs,
109
- totalRuns: state.automation.totalRuns,
110
- activeRunIds: state.automation.activeRunIds,
111
- totalFailed: state.automation.totalFailed,
112
- sourceCount: state.automation.sourceIds.length,
113
- deliveryTotals: {
114
- succeeded: state.deliveries.totalSucceeded,
115
- failed: state.deliveries.totalFailed,
116
- deadLettered: state.deliveries.totalDeadLettered,
117
- },
118
- };
119
- }),
120
- routes: createStoreBackedReadModel(runtimeServices, () => {
121
- const state = runtimeStore.getState().routes;
122
- const bindings = state.bindingIds
123
- .map((id) => state.bindings.get(id))
124
- .filter((binding): binding is AutomationRouteBinding => binding !== undefined)
125
- .sort((a, b) => b.lastSeenAt - a.lastSeenAt || a.id.localeCompare(b.id));
126
- return {
127
- bindings,
128
- bindingIdsBySurface: state.bindingIdsBySurface,
129
- totalBindings: state.totalBindings,
130
- activeBindingIds: state.activeBindingIds,
131
- totalResolved: state.totalResolved,
132
- totalFailures: state.totalFailures,
133
- };
134
- }),
135
- watchers: createStoreBackedReadModel(runtimeServices, () => {
136
- const state = runtimeStore.getState().watchers;
137
- const watchers = state.watcherIds
138
- .map((id) => state.watchers.get(id))
139
- .filter((watcher): watcher is WatcherRecord => watcher !== undefined)
140
- .sort((a, b) => (b.lastHeartbeatAt ?? 0) - (a.lastHeartbeatAt ?? 0) || a.id.localeCompare(b.id));
141
- return {
142
- watchers,
143
- totalWatchers: state.watcherIds.length,
144
- activeWatcherIds: state.activeWatcherIds,
145
- totalDegraded: state.totalDegraded,
146
- totalLagged: state.totalLagged,
147
- };
148
- }),
149
- orchestration: createStoreBackedReadModel(runtimeServices, () => {
150
- const state = runtimeStore.getState().orchestration;
151
- const graphs = [...state.graphs.values()].sort((a, b) => b.createdAt - a.createdAt);
152
- return {
153
- graphs,
154
- totalGraphs: state.totalGraphs,
155
- activeGraphIds: state.activeGraphIds,
156
- totalCompletedGraphs: state.totalCompletedGraphs,
157
- totalFailedGraphs: state.totalFailedGraphs,
158
- recursionGuardTrips: state.recursionGuardTrips,
159
- };
160
- }),
161
- communication: createStoreBackedReadModel(runtimeServices, () => {
162
- const state = runtimeStore.getState().communication;
163
- const records = state.recentRecordIds
164
- .map((id) => state.records.get(id))
165
- .filter((record): record is RuntimeCommunicationRecord => record !== undefined)
166
- .sort((a, b) => b.timestamp - a.timestamp);
167
- return {
168
- records,
169
- totalSent: state.totalSent,
170
- totalDelivered: state.totalDelivered,
171
- totalBlocked: state.totalBlocked,
172
- };
173
- }),
174
- controlPlane: {
175
- getSnapshot() {
176
- const state = runtimeStore.getState().controlPlane;
177
- const clients = state.clientIds
178
- .map((id) => state.clients.get(id))
179
- .filter((client): client is ControlPlaneClientRecord => client !== undefined)
180
- .sort((a, b) => (b.lastSeenAt ?? 0) - (a.lastSeenAt ?? 0) || a.id.localeCompare(b.id));
181
- return {
182
- connectionState: state.connectionState,
183
- activeClientIds: state.activeClientIds,
184
- requestCount: state.requestCount,
185
- errorCount: state.errorCount,
186
- host: state.host,
187
- port: state.port,
188
- clients,
189
- approvals: runtimeServices.approvalBroker.listApprovals(6),
190
- sessions: runtimeServices.sessionBroker.listSessions(6),
191
- recentEvents: options.getControlPlaneRecentEvents?.(6) ?? [],
192
- };
193
- },
194
- subscribe(listener) {
195
- const unsubs = [
196
- runtimeStore.subscribe(listener),
197
- runtimeServices.approvalBroker.subscribe(listener),
198
- ];
199
- return combineSubscriptions(...unsubs);
200
- },
201
- },
202
- };
203
- }