@apia/ai 5.2.3 → 6.0.2

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 (86) hide show
  1. package/dist/assistant/index.d.d.ts +49 -0
  2. package/dist/assistant/index.d.d.ts.map +1 -0
  3. package/dist/assistant/index.js +154 -0
  4. package/dist/assistant/index.js.map +1 -0
  5. package/dist/assistant/runtime/conversationActivity.js +11 -0
  6. package/dist/assistant/runtime/conversationActivity.js.map +1 -0
  7. package/dist/assistant/runtime/conversationAnnotations.js +28 -0
  8. package/dist/assistant/runtime/conversationAnnotations.js.map +1 -0
  9. package/dist/assistant/runtime/conversationAttachmentPreview.js +33 -0
  10. package/dist/assistant/runtime/conversationAttachmentPreview.js.map +1 -0
  11. package/dist/assistant/runtime/conversationAttachments.js +24 -0
  12. package/dist/assistant/runtime/conversationAttachments.js.map +1 -0
  13. package/dist/assistant/runtime/conversationClient.d.d.ts +26 -0
  14. package/dist/assistant/runtime/conversationClient.d.d.ts.map +1 -0
  15. package/dist/assistant/runtime/conversationClient.js +599 -0
  16. package/dist/assistant/runtime/conversationClient.js.map +1 -0
  17. package/dist/assistant/runtime/conversationPlan.js +12 -0
  18. package/dist/assistant/runtime/conversationPlan.js.map +1 -0
  19. package/dist/assistant/runtime/conversationProjection.d.d.ts +8 -0
  20. package/dist/assistant/runtime/conversationProjection.d.d.ts.map +1 -0
  21. package/dist/assistant/runtime/conversationProjection.js +184 -0
  22. package/dist/assistant/runtime/conversationProjection.js.map +1 -0
  23. package/dist/assistant/runtime/coordinatorProxy.js +302 -0
  24. package/dist/assistant/runtime/coordinatorProxy.js.map +1 -0
  25. package/dist/chat/ChatController/ChatController.d.ts +13 -9
  26. package/dist/chat/ChatController/ChatController.js +103 -94
  27. package/dist/chat/ChatController/ChatController.js.map +1 -1
  28. package/dist/chat/ChatController/annotationStyles.js +1 -78
  29. package/dist/chat/ChatController/annotationStyles.js.map +1 -1
  30. package/dist/chat/ChatController/annotationTargets.d.ts +3 -1
  31. package/dist/chat/ChatController/annotationTargets.js +7 -1
  32. package/dist/chat/ChatController/annotationTargets.js.map +1 -1
  33. package/dist/chat/ChatController/components/AnnotationDraft.js +79 -0
  34. package/dist/chat/ChatController/components/AnnotationDraft.js.map +1 -0
  35. package/dist/chat/ChatController/components/AssistantMessageActions.d.ts +4 -0
  36. package/dist/chat/ChatController/components/AssistantMessageActions.d.ts.map +1 -0
  37. package/dist/chat/ChatController/components/AssistantMessageActions.js +102 -0
  38. package/dist/chat/ChatController/components/AssistantMessageActions.js.map +1 -0
  39. package/dist/chat/ChatController/components/AssistantTurnMessage.d.ts +24 -1
  40. package/dist/chat/ChatController/components/AssistantTurnMessage.js +155 -26
  41. package/dist/chat/ChatController/components/AssistantTurnMessage.js.map +1 -1
  42. package/dist/chat/ChatController/components/ChatMessage.d.ts +8 -5
  43. package/dist/chat/ChatController/components/ChatMessage.js +27 -22
  44. package/dist/chat/ChatController/components/ChatMessage.js.map +1 -1
  45. package/dist/chat/ChatController/components/History.d.ts +5 -1
  46. package/dist/chat/ChatController/components/History.js +17 -7
  47. package/dist/chat/ChatController/components/History.js.map +1 -1
  48. package/dist/chat/ChatController/components/Message.d.ts +7 -2
  49. package/dist/chat/ChatController/components/Message.js +22 -8
  50. package/dist/chat/ChatController/components/Message.js.map +1 -1
  51. package/dist/chat/ChatController/components/MessageBlocks.d.ts +2 -5
  52. package/dist/chat/ChatController/components/MessageBlocks.js +6 -48
  53. package/dist/chat/ChatController/components/MessageBlocks.js.map +1 -1
  54. package/dist/chat/ChatController/components/MessageBody.js +10 -3
  55. package/dist/chat/ChatController/components/MessageBody.js.map +1 -1
  56. package/dist/chat/ChatController/components/PendingMessagesPanel.js +2 -3
  57. package/dist/chat/ChatController/components/PendingMessagesPanel.js.map +1 -1
  58. package/dist/chat/ChatController/components/SentAnnotations.js +5 -3
  59. package/dist/chat/ChatController/components/SentAnnotations.js.map +1 -1
  60. package/dist/chat/ChatController/components/TextArea/QuestionComposer.js +1 -2
  61. package/dist/chat/ChatController/components/TextArea/QuestionComposer.js.map +1 -1
  62. package/dist/chat/ChatController/components/TextArea.d.ts +3 -5
  63. package/dist/chat/ChatController/components/TextArea.js +5 -69
  64. package/dist/chat/ChatController/components/TextArea.js.map +1 -1
  65. package/dist/chat/ChatController/types.d.ts +28 -1
  66. package/dist/index.d.ts +7 -8
  67. package/dist/index.js +5 -6
  68. package/dist/index.js.map +1 -1
  69. package/dist/stream/ResponseStream.d.ts +15 -10
  70. package/dist/stream/ResponseStream.js +58 -61
  71. package/dist/stream/ResponseStream.js.map +1 -1
  72. package/dist/stream/reasoningSummary.js +19 -0
  73. package/dist/stream/reasoningSummary.js.map +1 -0
  74. package/package.json +8 -8
  75. package/dist/assistant/AssistantController.d.ts +0 -53
  76. package/dist/assistant/AssistantController.d.ts.map +0 -1
  77. package/dist/assistant/AssistantController.js +0 -131
  78. package/dist/assistant/AssistantController.js.map +0 -1
  79. package/dist/assistant/HandoffCoordinator.d.ts +0 -18
  80. package/dist/assistant/HandoffCoordinator.d.ts.map +0 -1
  81. package/dist/assistant/HandoffCoordinator.js +0 -35
  82. package/dist/assistant/HandoffCoordinator.js.map +0 -1
  83. package/dist/assistant/PanelAssistantTransport.d.ts +0 -28
  84. package/dist/assistant/PanelAssistantTransport.d.ts.map +0 -1
  85. package/dist/assistant/PanelAssistantTransport.js +0 -48
  86. package/dist/assistant/PanelAssistantTransport.js.map +0 -1
@@ -0,0 +1,302 @@
1
+ /** Coordinator operations use only the public TabAssistantsClient. No tab runtime knowledge. */
2
+ const terminal = new Set(['completed', 'failed', 'cancelled', 'closed']);
3
+ const copy = value => JSON.parse(JSON.stringify(value));
4
+ const deliveryProblem = (operation, code, tabId) => copy({ operationId: operation.id, status: ['screen-read', 'screen-apply'].includes(operation.kind) ? 'failed' : 'requires-intervention', code,
5
+ tabId, process: operation.process,
6
+ message: (operation.process?.committed
7
+ ? `La instancia ${operation.process.identification ?? operation.process.processInstanceId} ya está creada. ` : '') +
8
+ `No se pudo continuar con el agente (${code}). Conservá esa instancia y continuá su observación cuando el destino esté disponible.` });
9
+ class CoordinatorProxy {
10
+ constructor({ client, storage, key, publish, closeTaskTab, attachmentForTurn, filterRequests = false, isCurrent = () => true }) {
11
+ this.client = client; this.storage = storage; this.key = key; this.publish = publish;
12
+ this.closeTaskTab = closeTaskTab;
13
+ this.attachmentForTurn = attachmentForTurn;
14
+ this.filterRequests = filterRequests;
15
+ this.isCurrent = isCurrent;
16
+ const raw = storage.getItem(key);
17
+ this.state = raw ? JSON.parse(raw) : { version: 1, operations: {}, cursor: 0, inbox: [] };
18
+ if (this.state.version !== 1) throw new Error('Unsupported coordinator checkpoint');
19
+ this.state.inbox ??= [];
20
+ this.running = new Map(); this.unsubscribe = undefined; this.delivery = undefined; this.disposed = false;
21
+ }
22
+ save(next) {
23
+ if (this.disposed || !this.isCurrent()) throw new Error('COORDINATOR_DISPOSED');
24
+ // Confirmation precedes every effect and every event acknowledgement.
25
+ this.storage.setItem(this.key, JSON.stringify(next)); this.state = next;
26
+ }
27
+ observe() {
28
+ if (this.unsubscribe || this.disposed) return;
29
+ this.unsubscribe = this.client.subscribe(event => {
30
+ if (this.disposed || !this.isCurrent()) return;
31
+ const events = event.kind === 'replay' ? event.events : [event];
32
+ if (event.kind === 'replay' && event.gap) {
33
+ const next = copy(this.state);
34
+ next.inbox.push({ id: `gap:${event.cursor}`, value: { kind: 'inventory', snapshot: event.snapshot, gap: true } });
35
+ this.save(next);
36
+ }
37
+ for (const fact of events) {
38
+ if (fact.cursor <= this.state.cursor) continue;
39
+ const next = copy(this.state);
40
+ if (this.filterRequests && fact.requestId && !Object.values(next.operations).some(operation =>
41
+ operation.requestId === fact.requestId && operation.tabId === fact.tabId &&
42
+ (!operation.assistantId || operation.assistantId === fact.assistantId))) {
43
+ next.cursor = fact.cursor; this.save(next); continue;
44
+ }
45
+ if (next.inbox.length >= 512) throw new Error('COORDINATOR_EVENT_RETENTION_LIMIT');
46
+ next.cursor = fact.cursor;
47
+ next.inbox.push({ id: `event:${fact.cursor}`, value: { kind: 'tab-event', event: fact } });
48
+ this.save(next);
49
+ }
50
+ void this.drain().catch(() => { /* Durable inbox is retried on the next observation/remount. */ });
51
+ }, this.state.cursor);
52
+ void this.drain().catch(() => {});
53
+ }
54
+ drain() {
55
+ if (this.disposed || !this.isCurrent()) return Promise.resolve();
56
+ if (this.delivery) return this.delivery;
57
+ if (!this.state.inbox.length) return Promise.resolve();
58
+ this.delivery = (async () => {
59
+ while (!this.disposed && this.state.inbox.length) {
60
+ const item = this.state.inbox[0];
61
+ // Consumer persists/deduplicates by deliveryId before acknowledging, including async consumers.
62
+ const ack = await this.publish({ ...item.value, deliveryId: item.id });
63
+ if (this.disposed || !this.isCurrent()) return; // Leave the inbox for the replacement observer; never overwrite its cursor.
64
+ if (ack === false) throw new Error('COORDINATOR_EVENT_NOT_ACKNOWLEDGED');
65
+ const next = copy(this.state); next.inbox = next.inbox.filter(entry => entry.id !== item.id);
66
+ this.save(next);
67
+ }
68
+ })().finally(() => { this.delivery = undefined; });
69
+ return this.delivery;
70
+ }
71
+ dispose() { this.disposed = true; this.unsubscribe?.(); this.unsubscribe = undefined; }
72
+ inventory() { return this.client.snapshot(); }
73
+ execute(operation, { recover = false, reconcileRequestId, observeOnly = false } = {}) {
74
+ if (this.disposed) return Promise.reject(new Error('COORDINATOR_DISPOSED'));
75
+ const previous = this.running.get(operation.id);
76
+ if (previous) {
77
+ if (previous.fingerprint !== JSON.stringify(operation)) return Promise.reject(new Error('OPERATION_ID_CONFLICT'));
78
+ return previous.promise;
79
+ }
80
+ const run = Promise.resolve().then(() => this.run(operation, recover, reconcileRequestId, observeOnly))
81
+ .finally(() => this.running.delete(operation.id));
82
+ this.running.set(operation.id, { fingerprint: JSON.stringify(operation), promise: run }); return run;
83
+ }
84
+ async run(operation, recover, reconcileRequestId, observeOnly) {
85
+ const deliveryStartedAt = Date.now();
86
+ if (!operation.id || !['sendMessage', 'openProcess', 'screen-read', 'screen-apply', 'code-open', 'code-task-close'].includes(operation.kind)) throw new Error('Invalid operation');
87
+ if (operation.cancellationRequested) return copy({ operationId: operation.id, status: 'cancelled', process: operation.process });
88
+ const fingerprint = JSON.stringify(operation);
89
+ let checkpoint = this.state.operations[operation.id];
90
+ if (checkpoint && checkpoint.fingerprint !== fingerprint) throw new Error('OPERATION_ID_CONFLICT');
91
+ if (reconcileRequestId && checkpoint?.requestId !== reconcileRequestId) throw new Error('REQUEST_ACTION_STALE');
92
+ const update = fields => {
93
+ if (this.disposed) throw new Error('COORDINATOR_DISPOSED');
94
+ const next = copy(this.state);
95
+ next.operations[operation.id] = { ...next.operations[operation.id], ...fields, fingerprint };
96
+ this.save(next); checkpoint = this.state.operations[operation.id];
97
+ };
98
+ if (checkpoint?.result) return copy(checkpoint.result);
99
+ if (!checkpoint) {
100
+ if (Object.keys(this.state.operations).length >= 128) throw new Error('COORDINATOR_RETENTION_LIMIT');
101
+ update({ phase: 'prepared', requestId: this.client.newRequestId(), tabId: operation.tabId });
102
+ }
103
+ const cancelledBeforeDelivery = () => {
104
+ if (!this.state.operations[operation.id]?.cancelRequested) return undefined;
105
+ const result = copy({ operationId: operation.id, status: 'cancelled', tabId: checkpoint.tabId, process: operation.process,
106
+ code: 'CANCELLED_BEFORE_DELIVERY', message: 'Se detuvo la entrega. Se conserva cualquier instancia ya creada.' });
107
+ update({ phase: 'finished', result }); return result;
108
+ };
109
+ if (this.state.operations[operation.id]?.cancelRequested) return cancelledBeforeDelivery();
110
+ if (operation.kind === 'code-task-close') {
111
+ const { tabId, requestId } = checkpoint;
112
+ const finish = (status, fields) => {
113
+ const result = copy({ operationId: operation.id, status, tabId, requestId, ...fields });
114
+ update({ phase: 'finished', result });
115
+ return result;
116
+ };
117
+ if (observeOnly || checkpoint.phase === 'closing' || !tabId || !this.closeTaskTab)
118
+ return finish('failed', { code: 'TASK_TAB_CLOSE_UNCONFIRMED' });
119
+ const id = `relation:${operation.id}`;
120
+ if (!checkpoint.relationQueued) {
121
+ const next = copy(this.state);
122
+ next.inbox.push({ id, value: { kind: 'relation', operationId: operation.id, requestId, tabId } });
123
+ next.operations[operation.id].relationQueued = true;
124
+ this.save(next);
125
+ }
126
+ try {
127
+ await this.drain();
128
+ } catch (error) {
129
+ if (this.disposed || !this.isCurrent()) throw error;
130
+ const next = copy(this.state);
131
+ next.inbox = next.inbox.filter(item => item.id !== id);
132
+ this.save(next);
133
+ return finish('failed', { code: 'TASK_TAB_CLOSE_UNCONFIRMED' });
134
+ }
135
+ if (this.disposed || !this.isCurrent()) throw new Error('COORDINATOR_DISPOSED');
136
+ if (this.state.operations[operation.id]?.cancelRequested) return cancelledBeforeDelivery();
137
+ update({ phase: 'closing' });
138
+ let confirmed = false;
139
+ try { confirmed = await this.closeTaskTab(tabId) === true; }
140
+ catch { /* The tab controller may have removed the UI before receiving the server's reply. */ }
141
+ if (this.state.operations[operation.id]?.cancelRequested) return cancelledBeforeDelivery();
142
+ return confirmed ? finish('completed', { closeConfirmed: true })
143
+ : finish('failed', { code: 'TASK_TAB_CLOSE_UNCONFIRMED' });
144
+ }
145
+ const workTask = operation.kind === 'code-open' && operation.process?.workTask === true;
146
+ if (['openProcess', 'code-open'].includes(operation.kind) && !checkpoint.tabId) {
147
+ if (observeOnly) return deliveryProblem(operation, 'DELIVERY_NOT_CONFIRMED');
148
+ // Recover old checkpoints only through a unique public instance identity, never a title or URL guess.
149
+ if (checkpoint.phase === 'opening' && !checkpoint.managedOpening) {
150
+ const instanceId = operation.process?.committed && operation.process.processInstanceId;
151
+ const matches = instanceId ? this.client.snapshot().tabs.filter(tab => tab.state !== 'closed'
152
+ && String(tab.processInstanceId) === String(instanceId)) : [];
153
+ if (matches.length !== 1) return deliveryProblem(operation,
154
+ matches.length > 1 ? 'OPEN_DESTINATION_AMBIGUOUS' : 'OPEN_OUTCOME_UNKNOWN');
155
+ update({ tabId: matches[0].tabId, phase: 'prepared' });
156
+ }
157
+ if (!checkpoint.tabId) {
158
+ if (checkpoint.phase === 'opening' && !this.client.openOperation)
159
+ return deliveryProblem(operation, 'OPEN_OUTCOME_UNKNOWN');
160
+ const initialForm = operation.kind === 'code-open' && operation.process?.initialForm === true
161
+ && operation.process.status === 'ready-to-open';
162
+ if ((!operation.process?.committed && !initialForm && !workTask) || !operation.process?.url) throw new Error('UNCONFIRMED_PROCESS');
163
+ update({ phase: 'opening', managedOpening: typeof this.client.openOperation === 'function' });
164
+ try {
165
+ const options = { title: operation.process.title, url: operation.process.url, timeoutMs: 30000 };
166
+ const opened = this.client.openOperation
167
+ ? await this.client.openOperation(operation.id, options) : await this.client.open(options);
168
+ update({ tabId: opened.tab.tabId, phase: 'prepared' });
169
+ } catch (error) {
170
+ if (workTask) {
171
+ const result = copy({ operationId: operation.id, status: 'failed', tabId: error.tabId,
172
+ code: error.code ?? 'TASK_UNAVAILABLE' });
173
+ update({ phase: 'finished', result });
174
+ return result;
175
+ }
176
+ if (error.tabId) update({ tabId: error.tabId, phase: 'requires-intervention' });
177
+ return deliveryProblem(operation, error.code ?? 'OPEN_UNCONFIRMED', error.tabId);
178
+ }
179
+ }
180
+ }
181
+ if (operation.kind === 'code-open' && operation.process?.selectionRequired === true && checkpoint.phase === 'prepared' && checkpoint.tabId) {
182
+ const result = { operationId: operation.id, status: 'failed', tabId: checkpoint.tabId, code: 'PROCESS_SELECTION_REQUIRED',
183
+ message: 'Apia abrió la pantalla de selección. Elegí allí el registro con el que querés continuar.' };
184
+ update({ phase: 'finished', result });
185
+ return result;
186
+ }
187
+ const requestId = checkpoint.requestId;
188
+ if (this.state.operations[operation.id]?.cancelRequested) return cancelledBeforeDelivery();
189
+ let handle;
190
+ try { handle = this.client.request(requestId); handle.snapshot(); } catch (error) {
191
+ if (error.code && error.code !== 'REQUEST_UNKNOWN') throw error;
192
+ handle = undefined;
193
+ }
194
+ if (!handle) {
195
+ if (reconcileRequestId) throw new Error('REQUEST_ACTION_STALE');
196
+ if (observeOnly) return deliveryProblem(operation, 'DELIVERY_NOT_CONFIRMED', checkpoint.tabId);
197
+ if (workTask && operation.tabId && !this.client.assistant(checkpoint.tabId)) {
198
+ let timer;
199
+ try {
200
+ await Promise.race([this.client.refreshConnections?.(checkpoint.tabId),
201
+ new Promise(resolve => { timer = setTimeout(resolve, 1000); })]);
202
+ } catch { /* A failed reconnect must not open a second tab. */ }
203
+ finally { clearTimeout(timer); }
204
+ }
205
+ if (!workTask && recover && checkpoint.tabId && !this.client.assistant(checkpoint.tabId))
206
+ await this.client.recoverTab(checkpoint.tabId, 30000);
207
+ const assistant = this.client.assistant(checkpoint.tabId);
208
+ if (workTask && !assistant) {
209
+ const result = copy({ operationId: operation.id, status: 'failed', tabId: checkpoint.tabId,
210
+ code: 'TASK_RECEIVER_UNAVAILABLE' });
211
+ update({ phase: 'finished', result });
212
+ return result;
213
+ }
214
+ if (!assistant) return deliveryProblem(operation, 'ASSISTANT_UNAVAILABLE', checkpoint.tabId);
215
+ if (['screen-read', 'screen-apply'].includes(operation.kind) && assistant.assistantId !== operation.assistantId)
216
+ return deliveryProblem(operation, 'SCREEN_DESTINATION_CHANGED', checkpoint.tabId);
217
+ const envelope = { ...operation.delegation, requestId };
218
+ const attachmentRef = envelope.arguments?.entityDocument;
219
+ if (operation.kind === 'screen-apply' && attachmentRef) {
220
+ try {
221
+ const retained = checkpoint.envelope?.attachments;
222
+ if (retained) envelope.attachments = retained;
223
+ else {
224
+ const file = this.attachmentForTurn?.(attachmentRef);
225
+ if (!file) return deliveryProblem(operation, 'ATTACHMENT_UNAVAILABLE', checkpoint.tabId);
226
+ envelope.attachments = [this.client.retainAttachment(file)];
227
+ }
228
+ } catch (error) {
229
+ return deliveryProblem(operation, error.code ?? 'ATTACHMENT_UNAVAILABLE', checkpoint.tabId);
230
+ }
231
+ }
232
+ if (!envelope.instruction?.trim()) throw new Error('EMPTY_DELEGATION');
233
+ // Persist exact envelope before acceptance; a retry uses the same public request identity.
234
+ if (checkpoint.envelope && JSON.stringify(checkpoint.envelope) !== JSON.stringify(envelope)) throw new Error('DELEGATION_CONFLICT');
235
+ update({ envelope, phase: 'sending', assistantId: assistant.assistantId });
236
+ try { handle = assistant.sendMessage(envelope); }
237
+ catch (error) { return deliveryProblem(operation, error.code ?? 'DELIVERY_UNCONFIRMED', checkpoint.tabId); }
238
+ update({ phase: 'observing' });
239
+ }
240
+ const identity = handle.snapshot();
241
+ if (identity.tabId && identity.tabId !== checkpoint.tabId) throw new Error('REQUEST_DESTINATION_CONFLICT');
242
+ if (!checkpoint.assistantId && identity.assistantId) update({ assistantId: identity.assistantId });
243
+ const relationId = `relation:${operation.id}`;
244
+ if (!checkpoint.relationQueued) {
245
+ const next = copy(this.state);
246
+ const initialConfirmation = operation.kind === 'screen-apply' && operation.delegation?.arguments?.taskAction === 'confirm';
247
+ next.inbox.push({ id: relationId, value: copy({ kind: 'relation', operationId: operation.id, requestId, tabId: checkpoint.tabId,
248
+ assistantId: checkpoint.assistantId, process: operation.process, ...(initialConfirmation ? { initialConfirmation: true } : {}) }) });
249
+ next.operations[operation.id].relationQueued = true; this.save(next); checkpoint = this.state.operations[operation.id];
250
+ }
251
+ const acknowledgementStartedAt = Date.now();
252
+ await this.drain();
253
+ const acknowledgementMs = Date.now() - acknowledgementStartedAt;
254
+ if (this.disposed) return;
255
+ let observed = handle.snapshot();
256
+ if (reconcileRequestId) {
257
+ if (observed.status !== 'requires-intervention' || !observed.attention?.actions?.includes('reconcile')) throw new Error('REQUEST_ACTION_UNAVAILABLE');
258
+ await handle.reconcile(); observed = handle.snapshot();
259
+ } else if (recover && observed.status === 'suspended') {
260
+ await handle.recover(); observed = handle.snapshot();
261
+ }
262
+ const observationStartedAt = Date.now();
263
+ if (!terminal.has(observed.status) && !['suspended', 'requires-intervention'].includes(observed.status)) {
264
+ try { observed = await handle.wait(120000); }
265
+ catch (error) {
266
+ observed = handle.snapshot();
267
+ if (terminal.has(observed.status)) ;
268
+ else if (!['suspended', 'requires-intervention'].includes(observed.status)) throw error;
269
+ }
270
+ }
271
+ const deliveryMetrics = { totalMs: Date.now() - deliveryStartedAt, acknowledgementMs, observationMs: Date.now() - observationStartedAt };
272
+ if (handle.replay && Number.isFinite(identity.acceptedAt)) {
273
+ try {
274
+ const final = handle.replay(0).events?.find(event => event.kind === 'request.final');
275
+ if (Number.isFinite(final?.observedAt)) deliveryMetrics.destinationMs = Math.max(0, final.observedAt - identity.acceptedAt);
276
+ } catch { /* Optional timing evidence must never prevent delivery of the confirmed result. */ }
277
+ }
278
+ const result = copy({ ...observed, operationId: operation.id, process: operation.process, deliveryMetrics });
279
+ if (!this.disposed) {
280
+ if (terminal.has(observed.status)) update({ phase: 'finished', result });
281
+ else update({ phase: observed.status });
282
+ }
283
+ return result;
284
+ }
285
+ async cancel(operationId) {
286
+ const operation = this.state.operations[operationId];
287
+ if (!operation?.requestId) throw new Error('UNKNOWN_OPERATION');
288
+ const handle = this.client.request(operation.requestId);
289
+ try { handle.snapshot(); }
290
+ catch (error) {
291
+ if (error.code !== 'REQUEST_UNKNOWN') throw error;
292
+ if (!['prepared', 'opening'].includes(operation.phase))
293
+ throw Object.assign(new Error('No se conserva la evidencia de la entrega. Comprobá la tarea existente antes de continuar.'), { code: 'DELIVERY_EVIDENCE_LOST' });
294
+ const next = copy(this.state); next.operations[operationId].cancelRequested = true; this.save(next);
295
+ return { status: 'cancelled', code: 'CANCELLED_BEFORE_DELIVERY' };
296
+ }
297
+ return handle.cancel();
298
+ }
299
+ }
300
+
301
+ export { CoordinatorProxy };
302
+ //# sourceMappingURL=coordinatorProxy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordinatorProxy.js","sources":["../../../src/assistant/runtime/coordinatorProxy.mjs"],"sourcesContent":["/** Coordinator operations use only the public TabAssistantsClient. No tab runtime knowledge. */\r\nconst terminal = new Set(['completed', 'failed', 'cancelled', 'closed']);\r\nconst copy = value => JSON.parse(JSON.stringify(value));\r\nconst deliveryProblem = (operation, code, tabId) => copy({ operationId: operation.id, status: ['screen-read', 'screen-apply'].includes(operation.kind) ? 'failed' : 'requires-intervention', code,\r\n tabId, process: operation.process,\r\n message: (operation.process?.committed\r\n ? `La instancia ${operation.process.identification ?? operation.process.processInstanceId} ya está creada. ` : '') +\r\n `No se pudo continuar con el agente (${code}). Conservá esa instancia y continuá su observación cuando el destino esté disponible.` });\r\nexport class CoordinatorProxy {\r\n constructor({ client, storage, key, publish, closeTaskTab, attachmentForTurn, filterRequests = false, isCurrent = () => true }) {\r\n this.client = client; this.storage = storage; this.key = key; this.publish = publish;\r\n this.closeTaskTab = closeTaskTab;\r\n this.attachmentForTurn = attachmentForTurn;\r\n this.filterRequests = filterRequests;\r\n this.isCurrent = isCurrent;\r\n const raw = storage.getItem(key);\r\n this.state = raw ? JSON.parse(raw) : { version: 1, operations: {}, cursor: 0, inbox: [] };\r\n if (this.state.version !== 1) throw new Error('Unsupported coordinator checkpoint');\r\n this.state.inbox ??= [];\r\n this.running = new Map(); this.unsubscribe = undefined; this.delivery = undefined; this.disposed = false;\r\n }\r\n save(next) {\r\n if (this.disposed || !this.isCurrent()) throw new Error('COORDINATOR_DISPOSED');\r\n // Confirmation precedes every effect and every event acknowledgement.\r\n this.storage.setItem(this.key, JSON.stringify(next)); this.state = next;\r\n }\r\n observe() {\r\n if (this.unsubscribe || this.disposed) return;\r\n this.unsubscribe = this.client.subscribe(event => {\r\n if (this.disposed || !this.isCurrent()) return;\r\n const events = event.kind === 'replay' ? event.events : [event];\r\n if (event.kind === 'replay' && event.gap) {\r\n const next = copy(this.state);\r\n next.inbox.push({ id: `gap:${event.cursor}`, value: { kind: 'inventory', snapshot: event.snapshot, gap: true } });\r\n this.save(next);\r\n }\r\n for (const fact of events) {\r\n if (fact.cursor <= this.state.cursor) continue;\r\n const next = copy(this.state);\r\n if (this.filterRequests && fact.requestId && !Object.values(next.operations).some(operation =>\r\n operation.requestId === fact.requestId && operation.tabId === fact.tabId &&\r\n (!operation.assistantId || operation.assistantId === fact.assistantId))) {\r\n next.cursor = fact.cursor; this.save(next); continue;\r\n }\r\n if (next.inbox.length >= 512) throw new Error('COORDINATOR_EVENT_RETENTION_LIMIT');\r\n next.cursor = fact.cursor;\r\n next.inbox.push({ id: `event:${fact.cursor}`, value: { kind: 'tab-event', event: fact } });\r\n this.save(next);\r\n }\r\n void this.drain().catch(() => { /* Durable inbox is retried on the next observation/remount. */ });\r\n }, this.state.cursor);\r\n void this.drain().catch(() => {});\r\n }\r\n drain() {\r\n if (this.disposed || !this.isCurrent()) return Promise.resolve();\r\n if (this.delivery) return this.delivery;\r\n if (!this.state.inbox.length) return Promise.resolve();\r\n this.delivery = (async () => {\r\n while (!this.disposed && this.state.inbox.length) {\r\n const item = this.state.inbox[0];\r\n // Consumer persists/deduplicates by deliveryId before acknowledging, including async consumers.\r\n const ack = await this.publish({ ...item.value, deliveryId: item.id });\r\n if (this.disposed || !this.isCurrent()) return; // Leave the inbox for the replacement observer; never overwrite its cursor.\r\n if (ack === false) throw new Error('COORDINATOR_EVENT_NOT_ACKNOWLEDGED');\r\n const next = copy(this.state); next.inbox = next.inbox.filter(entry => entry.id !== item.id);\r\n this.save(next);\r\n }\r\n })().finally(() => { this.delivery = undefined; });\r\n return this.delivery;\r\n }\r\n dispose() { this.disposed = true; this.unsubscribe?.(); this.unsubscribe = undefined; }\r\n inventory() { return this.client.snapshot(); }\r\n execute(operation, { recover = false, reconcileRequestId, observeOnly = false } = {}) {\r\n if (this.disposed) return Promise.reject(new Error('COORDINATOR_DISPOSED'));\r\n const previous = this.running.get(operation.id);\r\n if (previous) {\r\n if (previous.fingerprint !== JSON.stringify(operation)) return Promise.reject(new Error('OPERATION_ID_CONFLICT'));\r\n return previous.promise;\r\n }\r\n const run = Promise.resolve().then(() => this.run(operation, recover, reconcileRequestId, observeOnly))\r\n .finally(() => this.running.delete(operation.id));\r\n this.running.set(operation.id, { fingerprint: JSON.stringify(operation), promise: run }); return run;\r\n }\r\n async run(operation, recover, reconcileRequestId, observeOnly) {\r\n const deliveryStartedAt = Date.now();\r\n if (!operation.id || !['sendMessage', 'openProcess', 'screen-read', 'screen-apply', 'code-open', 'code-task-close'].includes(operation.kind)) throw new Error('Invalid operation');\r\n if (operation.cancellationRequested) return copy({ operationId: operation.id, status: 'cancelled', process: operation.process });\r\n const fingerprint = JSON.stringify(operation);\r\n let checkpoint = this.state.operations[operation.id];\r\n if (checkpoint && checkpoint.fingerprint !== fingerprint) throw new Error('OPERATION_ID_CONFLICT');\r\n if (reconcileRequestId && checkpoint?.requestId !== reconcileRequestId) throw new Error('REQUEST_ACTION_STALE');\r\n const update = fields => {\r\n if (this.disposed) throw new Error('COORDINATOR_DISPOSED');\r\n const next = copy(this.state);\r\n next.operations[operation.id] = { ...next.operations[operation.id], ...fields, fingerprint };\r\n this.save(next); checkpoint = this.state.operations[operation.id];\r\n };\r\n if (checkpoint?.result) return copy(checkpoint.result);\r\n if (!checkpoint) {\r\n if (Object.keys(this.state.operations).length >= 128) throw new Error('COORDINATOR_RETENTION_LIMIT');\r\n update({ phase: 'prepared', requestId: this.client.newRequestId(), tabId: operation.tabId });\r\n }\r\n const cancelledBeforeDelivery = () => {\r\n if (!this.state.operations[operation.id]?.cancelRequested) return undefined;\r\n const result = copy({ operationId: operation.id, status: 'cancelled', tabId: checkpoint.tabId, process: operation.process,\r\n code: 'CANCELLED_BEFORE_DELIVERY', message: 'Se detuvo la entrega. Se conserva cualquier instancia ya creada.' });\r\n update({ phase: 'finished', result }); return result;\r\n };\r\n if (this.state.operations[operation.id]?.cancelRequested) return cancelledBeforeDelivery();\r\n if (operation.kind === 'code-task-close') {\r\n const { tabId, requestId } = checkpoint;\r\n const finish = (status, fields) => {\r\n const result = copy({ operationId: operation.id, status, tabId, requestId, ...fields });\r\n update({ phase: 'finished', result });\r\n return result;\r\n };\r\n if (observeOnly || checkpoint.phase === 'closing' || !tabId || !this.closeTaskTab)\r\n return finish('failed', { code: 'TASK_TAB_CLOSE_UNCONFIRMED' });\r\n const id = `relation:${operation.id}`;\r\n if (!checkpoint.relationQueued) {\r\n const next = copy(this.state);\r\n next.inbox.push({ id, value: { kind: 'relation', operationId: operation.id, requestId, tabId } });\r\n next.operations[operation.id].relationQueued = true;\r\n this.save(next);\r\n }\r\n try {\r\n await this.drain();\r\n } catch (error) {\r\n if (this.disposed || !this.isCurrent()) throw error;\r\n const next = copy(this.state);\r\n next.inbox = next.inbox.filter(item => item.id !== id);\r\n this.save(next);\r\n return finish('failed', { code: 'TASK_TAB_CLOSE_UNCONFIRMED' });\r\n }\r\n if (this.disposed || !this.isCurrent()) throw new Error('COORDINATOR_DISPOSED');\r\n if (this.state.operations[operation.id]?.cancelRequested) return cancelledBeforeDelivery();\r\n update({ phase: 'closing' });\r\n let confirmed = false;\r\n try { confirmed = await this.closeTaskTab(tabId) === true; }\r\n catch { /* The tab controller may have removed the UI before receiving the server's reply. */ }\r\n if (this.state.operations[operation.id]?.cancelRequested) return cancelledBeforeDelivery();\r\n return confirmed ? finish('completed', { closeConfirmed: true })\r\n : finish('failed', { code: 'TASK_TAB_CLOSE_UNCONFIRMED' });\r\n }\r\n const workTask = operation.kind === 'code-open' && operation.process?.workTask === true;\r\n if (['openProcess', 'code-open'].includes(operation.kind) && !checkpoint.tabId) {\r\n if (observeOnly) return deliveryProblem(operation, 'DELIVERY_NOT_CONFIRMED');\r\n // Recover old checkpoints only through a unique public instance identity, never a title or URL guess.\r\n if (checkpoint.phase === 'opening' && !checkpoint.managedOpening) {\r\n const instanceId = operation.process?.committed && operation.process.processInstanceId;\r\n const matches = instanceId ? this.client.snapshot().tabs.filter(tab => tab.state !== 'closed'\r\n && String(tab.processInstanceId) === String(instanceId)) : [];\r\n if (matches.length !== 1) return deliveryProblem(operation,\r\n matches.length > 1 ? 'OPEN_DESTINATION_AMBIGUOUS' : 'OPEN_OUTCOME_UNKNOWN');\r\n update({ tabId: matches[0].tabId, phase: 'prepared' });\r\n }\r\n if (!checkpoint.tabId) {\r\n if (checkpoint.phase === 'opening' && !this.client.openOperation)\r\n return deliveryProblem(operation, 'OPEN_OUTCOME_UNKNOWN');\r\n const initialForm = operation.kind === 'code-open' && operation.process?.initialForm === true\r\n && operation.process.status === 'ready-to-open';\r\n if ((!operation.process?.committed && !initialForm && !workTask) || !operation.process?.url) throw new Error('UNCONFIRMED_PROCESS');\r\n update({ phase: 'opening', managedOpening: typeof this.client.openOperation === 'function' });\r\n try {\r\n const options = { title: operation.process.title, url: operation.process.url, timeoutMs: 30000 };\r\n const opened = this.client.openOperation\r\n ? await this.client.openOperation(operation.id, options) : await this.client.open(options);\r\n update({ tabId: opened.tab.tabId, phase: 'prepared' });\r\n } catch (error) {\r\n if (workTask) {\r\n const result = copy({ operationId: operation.id, status: 'failed', tabId: error.tabId,\r\n code: error.code ?? 'TASK_UNAVAILABLE' });\r\n update({ phase: 'finished', result });\r\n return result;\r\n }\r\n if (error.tabId) update({ tabId: error.tabId, phase: 'requires-intervention' });\r\n return deliveryProblem(operation, error.code ?? 'OPEN_UNCONFIRMED', error.tabId);\r\n }\r\n }\r\n }\r\n if (operation.kind === 'code-open' && operation.process?.selectionRequired === true && checkpoint.phase === 'prepared' && checkpoint.tabId) {\r\n const result = { operationId: operation.id, status: 'failed', tabId: checkpoint.tabId, code: 'PROCESS_SELECTION_REQUIRED',\r\n message: 'Apia abrió la pantalla de selección. Elegí allí el registro con el que querés continuar.' };\r\n update({ phase: 'finished', result });\r\n return result;\r\n }\r\n const requestId = checkpoint.requestId;\r\n if (this.state.operations[operation.id]?.cancelRequested) return cancelledBeforeDelivery();\r\n let handle;\r\n try { handle = this.client.request(requestId); handle.snapshot(); } catch (error) {\r\n if (error.code && error.code !== 'REQUEST_UNKNOWN') throw error;\r\n handle = undefined;\r\n }\r\n if (!handle) {\r\n if (reconcileRequestId) throw new Error('REQUEST_ACTION_STALE');\r\n if (observeOnly) return deliveryProblem(operation, 'DELIVERY_NOT_CONFIRMED', checkpoint.tabId);\r\n if (workTask && operation.tabId && !this.client.assistant(checkpoint.tabId)) {\r\n let timer;\r\n try {\r\n await Promise.race([this.client.refreshConnections?.(checkpoint.tabId),\r\n new Promise(resolve => { timer = setTimeout(resolve, 1000); })]);\r\n } catch { /* A failed reconnect must not open a second tab. */ }\r\n finally { clearTimeout(timer); }\r\n }\r\n if (!workTask && recover && checkpoint.tabId && !this.client.assistant(checkpoint.tabId))\r\n await this.client.recoverTab(checkpoint.tabId, 30000);\r\n const assistant = this.client.assistant(checkpoint.tabId);\r\n if (workTask && !assistant) {\r\n const result = copy({ operationId: operation.id, status: 'failed', tabId: checkpoint.tabId,\r\n code: 'TASK_RECEIVER_UNAVAILABLE' });\r\n update({ phase: 'finished', result });\r\n return result;\r\n }\r\n if (!assistant) return deliveryProblem(operation, 'ASSISTANT_UNAVAILABLE', checkpoint.tabId);\r\n if (['screen-read', 'screen-apply'].includes(operation.kind) && assistant.assistantId !== operation.assistantId)\r\n return deliveryProblem(operation, 'SCREEN_DESTINATION_CHANGED', checkpoint.tabId);\r\n const envelope = { ...operation.delegation, requestId };\r\n const attachmentRef = envelope.arguments?.entityDocument;\r\n if (operation.kind === 'screen-apply' && attachmentRef) {\r\n try {\r\n const retained = checkpoint.envelope?.attachments;\r\n if (retained) envelope.attachments = retained;\r\n else {\r\n const file = this.attachmentForTurn?.(attachmentRef);\r\n if (!file) return deliveryProblem(operation, 'ATTACHMENT_UNAVAILABLE', checkpoint.tabId);\r\n envelope.attachments = [this.client.retainAttachment(file)];\r\n }\r\n } catch (error) {\r\n return deliveryProblem(operation, error.code ?? 'ATTACHMENT_UNAVAILABLE', checkpoint.tabId);\r\n }\r\n }\r\n if (!envelope.instruction?.trim()) throw new Error('EMPTY_DELEGATION');\r\n // Persist exact envelope before acceptance; a retry uses the same public request identity.\r\n if (checkpoint.envelope && JSON.stringify(checkpoint.envelope) !== JSON.stringify(envelope)) throw new Error('DELEGATION_CONFLICT');\r\n update({ envelope, phase: 'sending', assistantId: assistant.assistantId });\r\n try { handle = assistant.sendMessage(envelope); }\r\n catch (error) { return deliveryProblem(operation, error.code ?? 'DELIVERY_UNCONFIRMED', checkpoint.tabId); }\r\n update({ phase: 'observing' });\r\n }\r\n const identity = handle.snapshot();\r\n if (identity.tabId && identity.tabId !== checkpoint.tabId) throw new Error('REQUEST_DESTINATION_CONFLICT');\r\n if (!checkpoint.assistantId && identity.assistantId) update({ assistantId: identity.assistantId });\r\n const relationId = `relation:${operation.id}`;\r\n if (!checkpoint.relationQueued) {\r\n const next = copy(this.state);\r\n const initialConfirmation = operation.kind === 'screen-apply' && operation.delegation?.arguments?.taskAction === 'confirm';\r\n next.inbox.push({ id: relationId, value: copy({ kind: 'relation', operationId: operation.id, requestId, tabId: checkpoint.tabId,\r\n assistantId: checkpoint.assistantId, process: operation.process, ...(initialConfirmation ? { initialConfirmation: true } : {}) }) });\r\n next.operations[operation.id].relationQueued = true; this.save(next); checkpoint = this.state.operations[operation.id];\r\n }\r\n const acknowledgementStartedAt = Date.now();\r\n await this.drain();\r\n const acknowledgementMs = Date.now() - acknowledgementStartedAt;\r\n if (this.disposed) return;\r\n let observed = handle.snapshot();\r\n if (reconcileRequestId) {\r\n if (observed.status !== 'requires-intervention' || !observed.attention?.actions?.includes('reconcile')) throw new Error('REQUEST_ACTION_UNAVAILABLE');\r\n await handle.reconcile(); observed = handle.snapshot();\r\n } else if (recover && observed.status === 'suspended') {\r\n await handle.recover(); observed = handle.snapshot();\r\n }\r\n const observationStartedAt = Date.now();\r\n if (!terminal.has(observed.status) && !['suspended', 'requires-intervention'].includes(observed.status)) {\r\n try { observed = await handle.wait(120000); }\r\n catch (error) {\r\n observed = handle.snapshot();\r\n if (terminal.has(observed.status)) { /* Retained terminal result wins over a wait timeout. */ }\r\n else if (!['suspended', 'requires-intervention'].includes(observed.status)) throw error;\r\n }\r\n }\r\n const deliveryMetrics = { totalMs: Date.now() - deliveryStartedAt, acknowledgementMs, observationMs: Date.now() - observationStartedAt };\r\n if (handle.replay && Number.isFinite(identity.acceptedAt)) {\r\n try {\r\n const final = handle.replay(0).events?.find(event => event.kind === 'request.final');\r\n if (Number.isFinite(final?.observedAt)) deliveryMetrics.destinationMs = Math.max(0, final.observedAt - identity.acceptedAt);\r\n } catch { /* Optional timing evidence must never prevent delivery of the confirmed result. */ }\r\n }\r\n const result = copy({ ...observed, operationId: operation.id, process: operation.process, deliveryMetrics });\r\n if (!this.disposed) {\r\n if (terminal.has(observed.status)) update({ phase: 'finished', result });\r\n else update({ phase: observed.status });\r\n }\r\n return result;\r\n }\r\n async cancel(operationId) {\r\n const operation = this.state.operations[operationId];\r\n if (!operation?.requestId) throw new Error('UNKNOWN_OPERATION');\r\n const handle = this.client.request(operation.requestId);\r\n try { handle.snapshot(); }\r\n catch (error) {\r\n if (error.code !== 'REQUEST_UNKNOWN') throw error;\r\n if (!['prepared', 'opening'].includes(operation.phase))\r\n throw Object.assign(new Error('No se conserva la evidencia de la entrega. Comprobá la tarea existente antes de continuar.'), { code: 'DELIVERY_EVIDENCE_LOST' });\r\n const next = copy(this.state); next.operations[operationId].cancelRequested = true; this.save(next);\r\n return { status: 'cancelled', code: 'CANCELLED_BEFORE_DELIVERY' };\r\n }\r\n return handle.cancel();\r\n }\r\n}\r\n"],"names":[],"mappings":"AAAA;AACA,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;AACzE,MAAM,IAAI,GAAG,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;AACxD,MAAM,eAAe,GAAG,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,KAAK,IAAI,CAAC,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,QAAQ,GAAG,uBAAuB,EAAE,IAAI;AACjM,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC,OAAO;AACnC,EAAE,OAA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,IAAI,OAAO,KAAK,EAAE;AAClB,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,iBAAiB,EAAE,MAAM,KAAK,CAAC;AACxD,MAAM,IAAI,CAAC,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC;AAC5D,QAAQ,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,4FAA4F,CAAC,EAAE,EAAE,IAAI,EAAE,wBAAwB,EAAE,CAAC,CAAC;AACzK,MAAM,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1G,MAAM,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,2BAA2B,EAAE,CAAC;AACxE,KAAK;AACL,IAAI,OAAO,MAAM,CAAC,MAAM,EAAE,CAAC;AAC3B,GAAG;AACH;;;;"}
@@ -1,10 +1,11 @@
1
1
  import * as react from 'react';
2
- import { ReactNode } from 'react';
2
+ import { ReactNode, ComponentType } from 'react';
3
3
  import * as _apia_util from '@apia/util';
4
4
  import { ChatMessage } from './components/ChatMessage.js';
5
+ import { ReplyWithAssistantMessage } from './components/AssistantMessageActions.js';
5
6
  import { TTextAreaProps } from './components/TextArea.js';
6
7
  import { ChatAssistantTurn } from './components/AssistantTurnMessage.js';
7
- import { TChatControllerState, TChatAnnotationResolver, MessageSubmitCallback, ClearHistoryCallback, IAttachment, TMessageType, TChatAssistantPanelConfig, TChatAssistantTurnSnapshot, TChatAnnotationSelection, TChatAnnotation, MessageCallbackProps, TChatModelOption } from './types.js';
8
+ import { TChatControllerState, MessageSubmitCallback, ClearHistoryCallback, IAttachment, TMessageType, TChatAssistantPanelConfig, TChatAssistantTurnSnapshot, TChatAnnotationSelection, TChatAnnotation, MessageCallbackProps, TChatModelOption } from './types.js';
8
9
  import { TMenuItem } from '@apia/components';
9
10
  import { TChatFeedbackForm } from './TChatFeedbackForm.js';
10
11
 
@@ -18,7 +19,6 @@ type TCreateAssistantTurnMessageProps = {
18
19
  };
19
20
  type TChatControllerOptions = {
20
21
  feedbackForm: TChatFeedbackForm;
21
- annotationResolver: TChatAnnotationResolver;
22
22
  };
23
23
  type TChangeModelCallback = (model: string) => boolean | Promise<boolean>;
24
24
  type TChatPlanItem = {
@@ -40,6 +40,7 @@ type TChatPlanStreamBlock = {
40
40
  type TChatControllerInternalState<T extends Record<string, unknown>> = TChatControllerState & T & {
41
41
  feedbackForm: TChatFeedbackForm;
42
42
  plan: TChatPlanState | null;
43
+ plans: Record<string, TChatPlanState>;
43
44
  };
44
45
  declare class ChatController<T extends Record<string, unknown> = Record<string, unknown>> {
45
46
  private onMessageSubmit;
@@ -56,8 +57,6 @@ declare class ChatController<T extends Record<string, unknown> = Record<string,
56
57
  private stopPromise?;
57
58
  private maxId;
58
59
  private annotationId;
59
- private readonly annotationRanges;
60
- private readonly annotationResolver?;
61
60
  audioRecorder: {
62
61
  cancelOnStop: boolean;
63
62
  start: () => void;
@@ -83,10 +82,9 @@ declare class ChatController<T extends Record<string, unknown> = Record<string,
83
82
  clearHistory(): void;
84
83
  clearMessage(): void;
85
84
  resolveAnnotations(selection: TChatAnnotationSelection): TChatAnnotation[];
86
- addAnnotations(annotations: TChatAnnotation[], comment?: string, range?: Range): void;
85
+ addAnnotations(annotations: TChatAnnotation[], comment?: string): void;
87
86
  removeAnnotation(id: string): void;
88
87
  updateAnnotationComment(id: string, comment: string): void;
89
- beginEditAnnotation(id: string): void;
90
88
  removeAttachment(attachment: IAttachment): void;
91
89
  stop(): Promise<void>;
92
90
  removePendingMessage(message: ChatMessage): void;
@@ -103,11 +101,13 @@ declare class ChatController<T extends Record<string, unknown> = Record<string,
103
101
  prevMessage(): void;
104
102
  protected getAdditionalProps(): Partial<MessageCallbackProps>;
105
103
  protected getTextAreaProps(): Partial<TTextAreaProps>;
106
- applyPlanStreamBlock(block: TChatPlanStreamBlock): boolean;
104
+ applyPlanStreamBlock(block: TChatPlanStreamBlock, scope?: string): boolean;
107
105
  setModelOptions(modelOptions: TChatModelOption[], selectedModel?: string): void;
108
106
  changeModel(model: string): Promise<void>;
109
107
  setState<K extends keyof ChatController<T>['state']>(k: K, v: this['state'][K]): void;
110
- History: (() => react.JSX.Element) & {
108
+ History: (({ onReplyWithMessage }: {
109
+ onReplyWithMessage?: ReplyWithAssistantMessage;
110
+ }) => react.JSX.Element) & {
111
111
  displayName: string;
112
112
  };
113
113
  Attachments: (() => react.JSX.Element) & {
@@ -116,9 +116,13 @@ declare class ChatController<T extends Record<string, unknown> = Record<string,
116
116
  Plan: (() => react.JSX.Element) & {
117
117
  displayName: string;
118
118
  };
119
+ protected TextAreaComponent: ComponentType<TTextAreaProps>;
119
120
  TextArea: (() => react.JSX.Element) & {
120
121
  displayName: string;
121
122
  };
123
+ Annotations: (() => react.JSX.Element) & {
124
+ displayName: string;
125
+ };
122
126
  Renderer: () => react.JSX.Element;
123
127
  computeBase64Size(base64: string): number;
124
128
  }