@pellux/goodvibes-sdk 0.18.42 → 0.18.46

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 (82) hide show
  1. package/dist/_internal/daemon/runtime-route-types.d.ts +7 -0
  2. package/dist/_internal/daemon/runtime-route-types.d.ts.map +1 -1
  3. package/dist/_internal/daemon/runtime-session-routes.d.ts.map +1 -1
  4. package/dist/_internal/daemon/runtime-session-routes.js +43 -0
  5. package/dist/_internal/platform/companion/companion-chat-manager.d.ts +94 -0
  6. package/dist/_internal/platform/companion/companion-chat-manager.d.ts.map +1 -0
  7. package/dist/_internal/platform/companion/companion-chat-manager.js +291 -0
  8. package/dist/_internal/platform/companion/companion-chat-route-types.d.ts +31 -0
  9. package/dist/_internal/platform/companion/companion-chat-route-types.d.ts.map +1 -0
  10. package/dist/_internal/platform/companion/companion-chat-route-types.js +6 -0
  11. package/dist/_internal/platform/companion/companion-chat-routes.d.ts +23 -0
  12. package/dist/_internal/platform/companion/companion-chat-routes.d.ts.map +1 -0
  13. package/dist/_internal/platform/companion/companion-chat-routes.js +133 -0
  14. package/dist/_internal/platform/companion/companion-chat-types.d.ts +108 -0
  15. package/dist/_internal/platform/companion/companion-chat-types.d.ts.map +1 -0
  16. package/dist/_internal/platform/companion/companion-chat-types.js +11 -0
  17. package/dist/_internal/platform/companion/index.d.ts +6 -0
  18. package/dist/_internal/platform/companion/index.d.ts.map +1 -0
  19. package/dist/_internal/platform/companion/index.js +2 -0
  20. package/dist/_internal/platform/config/manager.d.ts +12 -0
  21. package/dist/_internal/platform/config/manager.d.ts.map +1 -1
  22. package/dist/_internal/platform/config/manager.js +30 -0
  23. package/dist/_internal/platform/control-plane/conversation-message.d.ts +29 -0
  24. package/dist/_internal/platform/control-plane/conversation-message.d.ts.map +1 -0
  25. package/dist/_internal/platform/control-plane/conversation-message.js +9 -0
  26. package/dist/_internal/platform/control-plane/index.d.ts +1 -0
  27. package/dist/_internal/platform/control-plane/index.d.ts.map +1 -1
  28. package/dist/_internal/platform/control-plane/session-broker.d.ts +7 -0
  29. package/dist/_internal/platform/control-plane/session-broker.d.ts.map +1 -1
  30. package/dist/_internal/platform/control-plane/session-broker.js +102 -11
  31. package/dist/_internal/platform/control-plane/session-types.d.ts +11 -1
  32. package/dist/_internal/platform/control-plane/session-types.d.ts.map +1 -1
  33. package/dist/_internal/platform/daemon/facade-composition.d.ts.map +1 -1
  34. package/dist/_internal/platform/daemon/facade-composition.js +7 -0
  35. package/dist/_internal/platform/daemon/facade.d.ts +21 -0
  36. package/dist/_internal/platform/daemon/facade.d.ts.map +1 -1
  37. package/dist/_internal/platform/daemon/facade.js +107 -1
  38. package/dist/_internal/platform/daemon/host-mode-watcher.d.ts +49 -0
  39. package/dist/_internal/platform/daemon/host-mode-watcher.d.ts.map +1 -0
  40. package/dist/_internal/platform/daemon/host-mode-watcher.js +41 -0
  41. package/dist/_internal/platform/daemon/http/router.d.ts +7 -0
  42. package/dist/_internal/platform/daemon/http/router.d.ts.map +1 -1
  43. package/dist/_internal/platform/daemon/http/router.js +34 -0
  44. package/dist/_internal/platform/daemon/http/runtime-route-types.d.ts +7 -0
  45. package/dist/_internal/platform/daemon/http/runtime-route-types.d.ts.map +1 -1
  46. package/dist/_internal/platform/daemon/http-listener.d.ts +17 -0
  47. package/dist/_internal/platform/daemon/http-listener.d.ts.map +1 -1
  48. package/dist/_internal/platform/daemon/http-listener.js +87 -1
  49. package/dist/_internal/platform/providers/auto-register.d.ts +2 -3
  50. package/dist/_internal/platform/providers/auto-register.d.ts.map +1 -1
  51. package/dist/_internal/platform/providers/auto-register.js +1 -8
  52. package/dist/_internal/platform/providers/index.d.ts +1 -0
  53. package/dist/_internal/platform/providers/index.d.ts.map +1 -1
  54. package/dist/_internal/platform/providers/index.js +1 -0
  55. package/dist/_internal/platform/providers/provider-api.d.ts +4 -0
  56. package/dist/_internal/platform/providers/provider-api.d.ts.map +1 -1
  57. package/dist/_internal/platform/providers/provider-not-found-error.d.ts +16 -0
  58. package/dist/_internal/platform/providers/provider-not-found-error.d.ts.map +1 -0
  59. package/dist/_internal/platform/providers/provider-not-found-error.js +24 -0
  60. package/dist/_internal/platform/providers/registry.d.ts +44 -2
  61. package/dist/_internal/platform/providers/registry.d.ts.map +1 -1
  62. package/dist/_internal/platform/providers/registry.js +73 -13
  63. package/dist/_internal/platform/runtime/contracts/migrations/event-envelope.d.ts +1 -1
  64. package/dist/_internal/platform/runtime/contracts/version.d.ts +1 -1
  65. package/dist/_internal/platform/runtime/contracts/version.js +1 -1
  66. package/dist/_internal/platform/runtime/events/domain-map.d.ts +10 -0
  67. package/dist/_internal/platform/runtime/events/domain-map.d.ts.map +1 -1
  68. package/dist/_internal/platform/runtime/events/index.d.ts +1 -1
  69. package/dist/_internal/platform/runtime/events/index.d.ts.map +1 -1
  70. package/dist/_internal/platform/runtime/index.d.ts +1 -1
  71. package/dist/_internal/platform/runtime/index.d.ts.map +1 -1
  72. package/dist/_internal/platform/runtime/tasks/adapters/agent-adapter.d.ts +12 -0
  73. package/dist/_internal/platform/runtime/tasks/adapters/agent-adapter.d.ts.map +1 -1
  74. package/dist/_internal/platform/runtime/tasks/adapters/agent-adapter.js +48 -0
  75. package/dist/_internal/platform/version.js +1 -1
  76. package/dist/_internal/transport-realtime/runtime-events.d.ts +3 -2
  77. package/dist/_internal/transport-realtime/runtime-events.d.ts.map +1 -1
  78. package/dist/client.d.ts +19 -3
  79. package/dist/client.d.ts.map +1 -1
  80. package/dist/index.d.ts +1 -1
  81. package/dist/index.d.ts.map +1 -1
  82. package/package.json +1 -1
@@ -0,0 +1,133 @@
1
+ /**
2
+ * companion-chat-routes.ts
3
+ *
4
+ * HTTP route handlers for the companion-app chat-mode API.
5
+ *
6
+ * Routes:
7
+ * POST /api/companion/chat/sessions
8
+ * GET /api/companion/chat/sessions/:sessionId
9
+ * DELETE /api/companion/chat/sessions/:sessionId
10
+ * POST /api/companion/chat/sessions/:sessionId/messages
11
+ * GET /api/companion/chat/sessions/:sessionId/events (SSE)
12
+ *
13
+ * All routes require the existing daemon bearer-token auth (enforced by the
14
+ * caller — DaemonHttpRouter.handleRequest already validates auth before
15
+ * dispatching to API routes).
16
+ */
17
+ // ---------------------------------------------------------------------------
18
+ // Route dispatch — called from DaemonHttpRouter.dispatchApiRoutes
19
+ // ---------------------------------------------------------------------------
20
+ /**
21
+ * Try to handle a companion chat route. Returns null if the path/method
22
+ * does not match, so the caller can fall through to other route groups.
23
+ */
24
+ export async function dispatchCompanionChatRoutes(req, context) {
25
+ const url = new URL(req.url);
26
+ const { pathname } = url;
27
+ // POST /api/companion/chat/sessions
28
+ if (pathname === '/api/companion/chat/sessions' && req.method === 'POST') {
29
+ return handleCreateSession(req, context);
30
+ }
31
+ const sessionMatch = pathname.match(/^\/api\/companion\/chat\/sessions\/([^/]+)(\/(.+))?$/);
32
+ if (!sessionMatch)
33
+ return null;
34
+ const sessionId = sessionMatch[1];
35
+ const sub = sessionMatch[3] ?? '';
36
+ // GET /api/companion/chat/sessions/:sessionId
37
+ if (!sub && req.method === 'GET') {
38
+ return handleGetSession(sessionId, context);
39
+ }
40
+ // DELETE /api/companion/chat/sessions/:sessionId
41
+ if (!sub && req.method === 'DELETE') {
42
+ return handleDeleteSession(sessionId, context);
43
+ }
44
+ // POST /api/companion/chat/sessions/:sessionId/messages
45
+ if (sub === 'messages' && req.method === 'POST') {
46
+ return handlePostMessage(req, sessionId, context);
47
+ }
48
+ // GET /api/companion/chat/sessions/:sessionId/events
49
+ if (sub === 'events' && req.method === 'GET') {
50
+ return handleGetEvents(req, sessionId, context);
51
+ }
52
+ return null;
53
+ }
54
+ // ---------------------------------------------------------------------------
55
+ // POST /api/companion/chat/sessions
56
+ // ---------------------------------------------------------------------------
57
+ async function handleCreateSession(req, context) {
58
+ const bodyOrResponse = await context.parseOptionalJsonBody(req);
59
+ if (bodyOrResponse instanceof Response)
60
+ return bodyOrResponse;
61
+ const body = (bodyOrResponse ?? {});
62
+ const input = {
63
+ title: typeof body['title'] === 'string' ? body['title'] : undefined,
64
+ model: typeof body['model'] === 'string' ? body['model'] : undefined,
65
+ provider: typeof body['provider'] === 'string' ? body['provider'] : undefined,
66
+ systemPrompt: typeof body['systemPrompt'] === 'string' ? body['systemPrompt'] : undefined,
67
+ };
68
+ const session = context.chatManager.createSession(input);
69
+ return Response.json({ sessionId: session.id, createdAt: session.createdAt }, { status: 201 });
70
+ }
71
+ // ---------------------------------------------------------------------------
72
+ // GET /api/companion/chat/sessions/:sessionId
73
+ // ---------------------------------------------------------------------------
74
+ async function handleGetSession(sessionId, context) {
75
+ const session = context.chatManager.getSession(sessionId);
76
+ if (!session) {
77
+ return Response.json({ error: 'Session not found', code: 'SESSION_NOT_FOUND' }, { status: 404 });
78
+ }
79
+ const messages = context.chatManager.getMessages(sessionId);
80
+ return Response.json({ session, messages });
81
+ }
82
+ // ---------------------------------------------------------------------------
83
+ // DELETE /api/companion/chat/sessions/:sessionId
84
+ // ---------------------------------------------------------------------------
85
+ async function handleDeleteSession(sessionId, context) {
86
+ const session = context.chatManager.closeSession(sessionId);
87
+ if (!session) {
88
+ return Response.json({ error: 'Session not found', code: 'SESSION_NOT_FOUND' }, { status: 404 });
89
+ }
90
+ return Response.json({ sessionId: session.id, status: session.status });
91
+ }
92
+ // ---------------------------------------------------------------------------
93
+ // POST /api/companion/chat/sessions/:sessionId/messages
94
+ // ---------------------------------------------------------------------------
95
+ async function handlePostMessage(req, sessionId, context) {
96
+ const bodyOrResponse = await context.parseJsonBody(req);
97
+ if (bodyOrResponse instanceof Response)
98
+ return bodyOrResponse;
99
+ const body = bodyOrResponse;
100
+ const input = {
101
+ content: typeof body['content'] === 'string' ? body['content'] : '',
102
+ metadata: typeof body['metadata'] === 'object' && body['metadata'] !== null
103
+ ? body['metadata']
104
+ : undefined,
105
+ };
106
+ if (!input.content.trim()) {
107
+ return Response.json({ error: 'content is required and must be a non-empty string', code: 'INVALID_INPUT' }, { status: 400 });
108
+ }
109
+ try {
110
+ const messageId = await context.chatManager.postMessage(sessionId, input.content);
111
+ return Response.json({ messageId }, { status: 202 });
112
+ }
113
+ catch (err) {
114
+ const e = err;
115
+ const status = e.status ?? 500;
116
+ return Response.json({ error: e.message ?? 'Internal error', code: e.code ?? 'INTERNAL_ERROR' }, { status });
117
+ }
118
+ }
119
+ // ---------------------------------------------------------------------------
120
+ // GET /api/companion/chat/sessions/:sessionId/events (SSE)
121
+ // ---------------------------------------------------------------------------
122
+ async function handleGetEvents(req, sessionId, context) {
123
+ const session = context.chatManager.getSession(sessionId);
124
+ if (!session) {
125
+ return Response.json({ error: 'Session not found', code: 'SESSION_NOT_FOUND' }, { status: 404 });
126
+ }
127
+ if (session.status === 'closed') {
128
+ return Response.json({ error: 'Session is closed', code: 'SESSION_CLOSED' }, { status: 410 });
129
+ }
130
+ // Delegate to the caller-provided SSE stream opener which wires up the
131
+ // gateway live-client registration and returns an SSE Response.
132
+ return context.openSessionEventStream(req, sessionId);
133
+ }
@@ -0,0 +1,108 @@
1
+ /**
2
+ * companion-chat-types.ts
3
+ *
4
+ * Types for companion-app chat-mode sessions. These are distinct from the
5
+ * TUI operator session and from task-submit (SharedSessionBroker) sessions.
6
+ * Chat sessions are managed by the CompanionChatManager and live entirely
7
+ * in memory (no persistence across daemon restart — v1 scope).
8
+ *
9
+ * TODO (follow-up): persist chat sessions to disk / database on daemon restart.
10
+ */
11
+ import type { ConversationMessageEnvelope } from '../control-plane/conversation-message.js';
12
+ /**
13
+ * Re-export the shared envelope so chat-mode code can import from one place.
14
+ * The envelope shape is the canonical message unit flowing through
15
+ * the control-plane gateway across both chat-mode and Problem-2 routing.
16
+ */
17
+ export type { ConversationMessageEnvelope } from '../control-plane/conversation-message.js';
18
+ export type CompanionChatSessionKind = 'companion-chat';
19
+ export type CompanionChatSessionStatus = 'active' | 'closed';
20
+ export type CompanionChatMessageRole = 'user' | 'assistant';
21
+ export interface CompanionChatMessage {
22
+ readonly id: string;
23
+ readonly sessionId: string;
24
+ readonly role: CompanionChatMessageRole;
25
+ readonly content: string;
26
+ readonly createdAt: number;
27
+ }
28
+ export interface CompanionChatSession {
29
+ readonly id: string;
30
+ readonly kind: CompanionChatSessionKind;
31
+ readonly title: string;
32
+ readonly model: string | null;
33
+ readonly provider: string | null;
34
+ readonly systemPrompt: string | null;
35
+ readonly status: CompanionChatSessionStatus;
36
+ readonly createdAt: number;
37
+ readonly updatedAt: number;
38
+ readonly closedAt: number | null;
39
+ readonly messageCount: number;
40
+ }
41
+ export interface CreateCompanionChatSessionInput {
42
+ readonly title?: string;
43
+ readonly model?: string;
44
+ readonly provider?: string;
45
+ readonly systemPrompt?: string;
46
+ }
47
+ export interface CreateCompanionChatSessionOutput {
48
+ readonly sessionId: string;
49
+ readonly createdAt: number;
50
+ }
51
+ export interface PostCompanionChatMessageInput {
52
+ readonly content: string;
53
+ readonly metadata?: Record<string, unknown>;
54
+ }
55
+ export interface PostCompanionChatMessageOutput {
56
+ readonly messageId: string;
57
+ }
58
+ export interface GetCompanionChatSessionOutput {
59
+ readonly session: CompanionChatSession;
60
+ readonly messages: CompanionChatMessage[];
61
+ }
62
+ export interface CompanionChatTurnStartedEvent {
63
+ readonly type: 'turn.started';
64
+ readonly sessionId: string;
65
+ readonly messageId: string;
66
+ readonly turnId: string;
67
+ /** Shared envelope for the user message that started this turn. */
68
+ readonly envelope: ConversationMessageEnvelope;
69
+ }
70
+ export interface CompanionChatTurnDeltaEvent {
71
+ readonly type: 'turn.delta';
72
+ readonly sessionId: string;
73
+ readonly turnId: string;
74
+ readonly delta: string;
75
+ }
76
+ export interface CompanionChatTurnToolCallEvent {
77
+ readonly type: 'turn.tool_call';
78
+ readonly sessionId: string;
79
+ readonly turnId: string;
80
+ readonly toolCallId: string;
81
+ readonly toolName: string;
82
+ readonly toolInput: unknown;
83
+ }
84
+ export interface CompanionChatTurnToolResultEvent {
85
+ readonly type: 'turn.tool_result';
86
+ readonly sessionId: string;
87
+ readonly turnId: string;
88
+ readonly toolCallId: string;
89
+ readonly toolName: string;
90
+ readonly result: unknown;
91
+ readonly isError: boolean;
92
+ }
93
+ export interface CompanionChatTurnCompletedEvent {
94
+ readonly type: 'turn.completed';
95
+ readonly sessionId: string;
96
+ readonly turnId: string;
97
+ readonly assistantMessageId: string;
98
+ /** Shared envelope for the assistant message produced by this turn. */
99
+ readonly envelope: ConversationMessageEnvelope;
100
+ }
101
+ export interface CompanionChatTurnErrorEvent {
102
+ readonly type: 'turn.error';
103
+ readonly sessionId: string;
104
+ readonly turnId: string;
105
+ readonly error: string;
106
+ }
107
+ export type CompanionChatTurnEvent = CompanionChatTurnStartedEvent | CompanionChatTurnDeltaEvent | CompanionChatTurnToolCallEvent | CompanionChatTurnToolResultEvent | CompanionChatTurnCompletedEvent | CompanionChatTurnErrorEvent;
108
+ //# sourceMappingURL=companion-chat-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"companion-chat-types.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/companion/companion-chat-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AAE5F;;;;GAIG;AACH,YAAY,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AAE5F,MAAM,MAAM,wBAAwB,GAAG,gBAAgB,CAAC;AAExD,MAAM,MAAM,0BAA0B,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE7D,MAAM,MAAM,wBAAwB,GAAG,MAAM,GAAG,WAAW,CAAC;AAE5D,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAC;IACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,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AAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,EAAE,2BAA2B,CAAC;CAChD;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,MAAM,sBAAsB,GAC9B,6BAA6B,GAC7B,2BAA2B,GAC3B,8BAA8B,GAC9B,gCAAgC,GAChC,+BAA+B,GAC/B,2BAA2B,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * companion-chat-types.ts
3
+ *
4
+ * Types for companion-app chat-mode sessions. These are distinct from the
5
+ * TUI operator session and from task-submit (SharedSessionBroker) sessions.
6
+ * Chat sessions are managed by the CompanionChatManager and live entirely
7
+ * in memory (no persistence across daemon restart — v1 scope).
8
+ *
9
+ * TODO (follow-up): persist chat sessions to disk / database on daemon restart.
10
+ */
11
+ export {};
@@ -0,0 +1,6 @@
1
+ export type { CompanionChatMessage, CompanionChatSession, CompanionChatSessionKind, CompanionChatSessionStatus, CompanionChatMessageRole, CompanionChatTurnEvent, CompanionChatTurnStartedEvent, CompanionChatTurnDeltaEvent, CompanionChatTurnToolCallEvent, CompanionChatTurnToolResultEvent, CompanionChatTurnCompletedEvent, CompanionChatTurnErrorEvent, CreateCompanionChatSessionInput, CreateCompanionChatSessionOutput, PostCompanionChatMessageInput, PostCompanionChatMessageOutput, GetCompanionChatSessionOutput, ConversationMessageEnvelope, } from './companion-chat-types.js';
2
+ export type { CompanionLLMProvider, CompanionChatEventPublisher, CompanionChatManagerConfig, CompanionProviderMessage, CompanionProviderChunk, } from './companion-chat-manager.js';
3
+ export { CompanionChatManager } from './companion-chat-manager.js';
4
+ export { dispatchCompanionChatRoutes } from './companion-chat-routes.js';
5
+ export type { CompanionChatRouteContext } from './companion-chat-route-types.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/companion/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACxB,sBAAsB,EACtB,6BAA6B,EAC7B,2BAA2B,EAC3B,8BAA8B,EAC9B,gCAAgC,EAChC,+BAA+B,EAC/B,2BAA2B,EAC3B,+BAA+B,EAC/B,gCAAgC,EAChC,6BAA6B,EAC7B,8BAA8B,EAC9B,6BAA6B,EAC7B,2BAA2B,GAC5B,MAAM,2BAA2B,CAAC;AAEnC,YAAY,EACV,oBAAoB,EACpB,2BAA2B,EAC3B,0BAA0B,EAC1B,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,YAAY,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { CompanionChatManager } from './companion-chat-manager.js';
2
+ export { dispatchCompanionChatRoutes } from './companion-chat-routes.js';
@@ -25,6 +25,10 @@ export type ConfigOverrides = ConfigCliOverrides & ({
25
25
  export interface ConfigSetOptions {
26
26
  bypassManagedLock?: boolean;
27
27
  }
28
+ /** Callback invoked when a watched config key changes. */
29
+ export type ConfigChangeCallback<K extends ConfigKey> = (newValue: ConfigValue<K>, oldValue: ConfigValue<K>) => void;
30
+ /** Unsubscribe handle returned by ConfigManager.subscribe(). */
31
+ export type ConfigUnsubscribe = () => void;
28
32
  /**
29
33
  * ConfigManager — Layered, mutable, persistent config system.
30
34
  *
@@ -39,6 +43,7 @@ export declare class ConfigManager {
39
43
  private readonly workingDirectory;
40
44
  private readonly homeDirectory;
41
45
  private hookDispatcher;
46
+ private readonly _listeners;
42
47
  constructor(overrides: ConfigOverrides);
43
48
  getControlPlaneConfigDir(): string;
44
49
  getWorkingDirectory(): string | null;
@@ -49,6 +54,13 @@ export declare class ConfigManager {
49
54
  get<K extends ConfigKey>(key: K): ConfigValue<K>;
50
55
  /** Set a config value by dot-path key and auto-save to disk. */
51
56
  set<K extends ConfigKey>(key: K, value: ConfigValue<K>, options?: ConfigSetOptions): void;
57
+ /**
58
+ * Subscribe to changes on a specific config key.
59
+ * Returns an unsubscribe function. Safe to call multiple times.
60
+ */
61
+ subscribe<K extends ConfigKey>(key: K, cb: ConfigChangeCallback<K>): ConfigUnsubscribe;
62
+ /** Notify synchronous subscribers of a key change. */
63
+ private notifyListeners;
52
64
  /**
53
65
  * Fire the Change:config hook for a config key change.
54
66
  * Best-effort: the hook dispatcher may not be initialised during startup.
@@ -1 +1 @@
1
- {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/config/manager.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAI3H,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAMxD,wFAAwF;AACxF,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI;IAC5B,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACzE,CAAC;AAEF,yEAAyE;AACzE,UAAU,kBAAkB;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB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AAI,QAAQ,CAAC,eAAe,CAAC;IAInC,8BAA8B;IAC9B,SAAS,IAAI,aAAa,EAAE;IAI5B,0DAA0D;IAC1D,IAAI,IAAI,IAAI;IASZ,yEAAyE;IACzE,WAAW,IAAI,IAAI;IAYnB,4FAA4F;IAC5F,IAAI,IAAI,IAAI;IAyBZ;;;;;;OAMG;IACH,aAAa,CAAC,CAAC,SAAS,MAAM,eAAe,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI;IAWrG;;;OAGG;IACH,KAAK,CAAC,GAAG,CAAC,EAAE,SAAS,GAAG,IAAI;CAY7B"}
@@ -65,6 +65,7 @@ export class ConfigManager {
65
65
  workingDirectory;
66
66
  homeDirectory;
67
67
  hookDispatcher = null;
68
+ _listeners = new Map();
68
69
  constructor(overrides) {
69
70
  const roots = overrides;
70
71
  const configDir = requireAbsoluteOwnedPath(roots.configDir, 'configDir');
@@ -157,8 +158,37 @@ export class ConfigManager {
157
158
  const previousValue = parent[field];
158
159
  parent[field] = value;
159
160
  this.save();
161
+ this.notifyListeners(key, previousValue, value);
160
162
  this.emitConfigHook(key, previousValue, value);
161
163
  }
164
+ /**
165
+ * Subscribe to changes on a specific config key.
166
+ * Returns an unsubscribe function. Safe to call multiple times.
167
+ */
168
+ subscribe(key, cb) {
169
+ if (!this._listeners.has(key)) {
170
+ this._listeners.set(key, new Set());
171
+ }
172
+ // Cast via unknown -> (n: unknown, o: unknown) => void to avoid deeply-recursive ConfigValue<K> comparison
173
+ // that exceeds TypeScript's stack depth limit on the 100-entry conditional type.
174
+ const wrapped = (newVal, oldVal) => cb(newVal, oldVal);
175
+ this._listeners.get(key).add(wrapped);
176
+ return () => {
177
+ this._listeners.get(key)?.delete(wrapped);
178
+ };
179
+ }
180
+ /** Notify synchronous subscribers of a key change. */
181
+ notifyListeners(key, oldValue, newValue) {
182
+ const set = this._listeners.get(key);
183
+ if (!set)
184
+ return;
185
+ for (const cb of set) {
186
+ try {
187
+ cb(newValue, oldValue);
188
+ }
189
+ catch { /* listener errors must not abort set() */ }
190
+ }
191
+ }
162
192
  /**
163
193
  * Fire the Change:config hook for a config key change.
164
194
  * Best-effort: the hook dispatcher may not be initialised during startup.
@@ -0,0 +1,29 @@
1
+ /**
2
+ * conversation-message.ts
3
+ *
4
+ * Shared envelope types for conversation messages flowing through the
5
+ * control-plane gateway. All consumers — SSE companion-chat streams,
6
+ * TUI-surface follow-up listeners, and web-UI clients — depend on this
7
+ * stable shape.
8
+ */
9
+ /**
10
+ * Provenance of a message/event flowing through a conversation.
11
+ * Used both for chat-mode (where the SDK owns the ConversationManager)
12
+ * and for companion follow-ups (where the TUI client owns it cross-process).
13
+ */
14
+ export type MessageSource = 'operator' | 'companion-chat-user' | 'companion-chat-assistant' | 'companion-followup' | 'system' | 'tool';
15
+ /**
16
+ * Stable envelope shape for any conversation-message-related event published
17
+ * through the control-plane gateway. All consumers (SSE companion chat stream,
18
+ * TUI surface follow-up listener, web-UI clients) can depend on this shape.
19
+ */
20
+ export interface ConversationMessageEnvelope {
21
+ readonly sessionId: string;
22
+ readonly messageId: string;
23
+ readonly body: string;
24
+ readonly source: MessageSource;
25
+ readonly timestamp: number;
26
+ /** Optional metadata for tool info, model id, etc. */
27
+ readonly metadata?: Readonly<Record<string, unknown>>;
28
+ }
29
+ //# sourceMappingURL=conversation-message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-message.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/control-plane/conversation-message.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;GAIG;AACH,MAAM,MAAM,aAAa,GACrB,UAAU,GACV,qBAAqB,GACrB,0BAA0B,GAC1B,oBAAoB,GACpB,QAAQ,GACR,MAAM,CAAC;AAEX;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,sDAAsD;IACtD,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACvD"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * conversation-message.ts
3
+ *
4
+ * Shared envelope types for conversation messages flowing through the
5
+ * control-plane gateway. All consumers — SSE companion-chat streams,
6
+ * TUI-surface follow-up listeners, and web-UI clients — depend on this
7
+ * stable shape.
8
+ */
9
+ export {};
@@ -9,4 +9,5 @@ export { SharedSessionBroker } from './session-broker.js';
9
9
  export type { SharedApprovalRecord, SharedApprovalAuditRecord, SharedApprovalStatus, RequestSharedApprovalInput, } from './approval-broker.js';
10
10
  export { ApprovalBroker } from './approval-broker.js';
11
11
  export type { ControlPlaneAuthMode, ControlPlaneAuthSnapshot } from '@pellux/goodvibes-sdk/platform/control-plane/auth-snapshot';
12
+ export type { MessageSource, ConversationMessageEnvelope } from './conversation-message.js';
12
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/control-plane/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,oDAAoD,CAAC;AAC5D,YAAY,EAAE,yBAAyB,EAAE,8BAA8B,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvH,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EACL,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,8BAA8B,EAC9B,wBAAwB,EACxB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,wBAAwB,EACxB,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,8BAA8B,EAC9B,+BAA+B,GAChC,MAAM,4DAA4D,CAAC;AACpE,YAAY,EACV,uBAAuB,EACvB,gCAAgC,EAChC,+BAA+B,EAC/B,gCAAgC,EAChC,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,8DAA8D,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EACV,oBAAoB,EACpB,yBAAyB,EACzB,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,YAAY,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,4DAA4D,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/control-plane/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,oDAAoD,CAAC;AAC5D,YAAY,EAAE,yBAAyB,EAAE,8BAA8B,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvH,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EACL,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,8BAA8B,EAC9B,wBAAwB,EACxB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,wBAAwB,EACxB,oBAAoB,EACpB,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,8BAA8B,EAC9B,+BAA+B,GAChC,MAAM,4DAA4D,CAAC;AACpE,YAAY,EACV,uBAAuB,EACvB,gCAAgC,EAChC,+BAA+B,EAC/B,gCAAgC,EAChC,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,8DAA8D,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EACV,oBAAoB,EACpB,yBAAyB,EACzB,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,YAAY,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,4DAA4D,CAAC;AACjI,YAAY,EAAE,aAAa,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC"}
@@ -18,6 +18,7 @@ export declare class SharedSessionBroker {
18
18
  private loaded;
19
19
  private _gcInterval;
20
20
  private _busUnsubs;
21
+ private _busAttached;
21
22
  /** Default idle threshold for zero-message sessions (ms). */
22
23
  private readonly _idleEmptyMs;
23
24
  /** Default idle threshold for sessions with content (ms). */
@@ -36,6 +37,11 @@ export declare class SharedSessionBroker {
36
37
  readonly idleLongMs?: number;
37
38
  });
38
39
  setEventPublisher(publisher: SharedSessionEventPublisher | null): void;
40
+ /**
41
+ * M3: Gracefully stop the broker — clears GC interval, tears down bus subscriptions,
42
+ * and persists state. Call from DaemonServer.stop().
43
+ */
44
+ stop(): Promise<void>;
39
45
  /**
40
46
  * Wire the broker to a RuntimeEventBus so agent terminal events automatically
41
47
  * reconcile session inputs and task state.
@@ -93,6 +99,7 @@ export declare class SharedSessionBroker {
93
99
  private claimNextQueuedInput;
94
100
  private finalizeAgentInputs;
95
101
  private runQueuedFollowUp;
102
+ private _touch;
96
103
  private refreshPendingInputCount;
97
104
  /**
98
105
  * Periodic idle-session GC sweep.
@@ -1 +1 @@
1
- {"version":3,"file":"session-broker.d.ts","sourceRoot":"","sources":["../../../../src/_internal/platform/control-plane/session-broker.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAC;AACxF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kDAAkD,CAAC;AAE/F,OAAO,KAAK,EACV,uBAAuB,EACvB,+BAA+B,EAE/B,wBAAwB,EACzB,MAAM,8DAA8D,CAAC;AACtE,OAAO,KAAK,EACV,wBAAwB,EACxB,oBAAoB,EAEpB,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,8BAA8B,EAC9B,+BAA+B,EAChC,MAAM,4DAA4D,CAAC;AACpE,OAAO,EAEL,KAAK,gCAAgC,EACrC,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAChC,MAAM,uEAAuE,CAAC;AAc/E,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA8C;IACpE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAsB;IACpD,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAmC;IACvE,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA6B;IAC3D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0C;IACnE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA6C;IACtE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiD;IACxE,OAAO,CAAC,cAAc,CAA4C;IAClE,OAAO,CAAC,kBAAkB,CAA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