@olane/o-lane 0.7.12-alpha.76 → 0.7.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/src/index.d.ts +1 -1
  2. package/dist/src/index.d.ts.map +1 -1
  3. package/dist/src/index.js +1 -2
  4. package/dist/src/prompts/agent.prompt.d.ts +11 -0
  5. package/dist/src/prompts/agent.prompt.d.ts.map +1 -1
  6. package/dist/src/prompts/agent.prompt.js +14 -3
  7. package/dist/src/prompts/configure.prompt.d.ts +7 -0
  8. package/dist/src/prompts/configure.prompt.d.ts.map +1 -1
  9. package/dist/src/prompts/configure.prompt.js +8 -1
  10. package/dist/src/prompts/custom.prompt.d.ts +7 -0
  11. package/dist/src/prompts/custom.prompt.d.ts.map +1 -1
  12. package/dist/src/prompts/custom.prompt.js +77 -0
  13. package/dist/src/storage/index.d.ts +8 -0
  14. package/dist/src/storage/index.d.ts.map +1 -0
  15. package/dist/src/storage/index.js +12 -0
  16. package/dist/src/storage/interfaces/prompt-storage.interface.d.ts +102 -0
  17. package/dist/src/storage/interfaces/prompt-storage.interface.d.ts.map +1 -0
  18. package/dist/src/storage/methods/prompt-storage.methods.d.ts +9 -0
  19. package/dist/src/storage/methods/prompt-storage.methods.d.ts.map +1 -0
  20. package/dist/src/storage/methods/prompt-storage.methods.js +338 -0
  21. package/dist/src/storage/prompt-loader.d.ts +40 -0
  22. package/dist/src/storage/prompt-loader.d.ts.map +1 -0
  23. package/dist/src/storage/prompt-loader.js +126 -0
  24. package/dist/src/storage/prompt-schema.d.ts +42 -0
  25. package/dist/src/storage/prompt-schema.d.ts.map +1 -0
  26. package/dist/src/storage/prompt-schema.js +29 -0
  27. package/dist/src/storage/prompt-seeder.d.ts +42 -0
  28. package/dist/src/storage/prompt-seeder.d.ts.map +1 -0
  29. package/dist/src/storage/prompt-seeder.js +141 -0
  30. package/dist/src/storage/prompt-storage-provider.tool.d.ts +99 -0
  31. package/dist/src/storage/prompt-storage-provider.tool.d.ts.map +1 -0
  32. package/dist/src/storage/prompt-storage-provider.tool.js +320 -0
  33. package/dist/test/prompt-seeder.spec.d.ts +2 -0
  34. package/dist/test/prompt-seeder.spec.d.ts.map +1 -0
  35. package/dist/test/prompt-seeder.spec.js +254 -0
  36. package/dist/test/prompt-storage-provider.spec.d.ts +2 -0
  37. package/dist/test/prompt-storage-provider.spec.d.ts.map +1 -0
  38. package/dist/test/prompt-storage-provider.spec.js +456 -0
  39. package/package.json +10 -7
  40. package/dist/src/ag-ui/ag-ui-constants.d.ts +0 -90
  41. package/dist/src/ag-ui/ag-ui-constants.d.ts.map +0 -1
  42. package/dist/src/ag-ui/ag-ui-constants.js +0 -113
  43. package/dist/src/ag-ui/ag-ui-event-mapper.d.ts +0 -88
  44. package/dist/src/ag-ui/ag-ui-event-mapper.d.ts.map +0 -1
  45. package/dist/src/ag-ui/ag-ui-event-mapper.js +0 -487
  46. package/dist/src/ag-ui/ag-ui-olane.tool.d.ts +0 -45
  47. package/dist/src/ag-ui/ag-ui-olane.tool.d.ts.map +0 -1
  48. package/dist/src/ag-ui/ag-ui-olane.tool.js +0 -257
  49. package/dist/src/ag-ui/ag-ui-stream-manager.d.ts +0 -99
  50. package/dist/src/ag-ui/ag-ui-stream-manager.d.ts.map +0 -1
  51. package/dist/src/ag-ui/ag-ui-stream-manager.js +0 -160
  52. package/dist/src/ag-ui/ag-ui-utils.d.ts +0 -50
  53. package/dist/src/ag-ui/ag-ui-utils.d.ts.map +0 -1
  54. package/dist/src/ag-ui/ag-ui-utils.js +0 -287
  55. package/dist/src/ag-ui/index.d.ts +0 -17
  56. package/dist/src/ag-ui/index.d.ts.map +0 -1
  57. package/dist/src/ag-ui/index.js +0 -21
  58. package/dist/src/ag-ui/transports/ag-ui-transport.interface.d.ts +0 -44
  59. package/dist/src/ag-ui/transports/ag-ui-transport.interface.d.ts.map +0 -1
  60. package/dist/src/ag-ui/transports/ag-ui-transport.interface.js +0 -26
  61. package/dist/src/ag-ui/transports/callback-transport.d.ts +0 -13
  62. package/dist/src/ag-ui/transports/callback-transport.d.ts.map +0 -1
  63. package/dist/src/ag-ui/transports/callback-transport.js +0 -26
  64. package/dist/src/ag-ui/transports/console-transport.d.ts +0 -14
  65. package/dist/src/ag-ui/transports/console-transport.d.ts.map +0 -1
  66. package/dist/src/ag-ui/transports/console-transport.js +0 -63
  67. package/dist/src/ag-ui/transports/index.d.ts +0 -5
  68. package/dist/src/ag-ui/transports/index.d.ts.map +0 -1
  69. package/dist/src/ag-ui/transports/index.js +0 -4
  70. package/dist/src/ag-ui/transports/onode-transport.d.ts +0 -34
  71. package/dist/src/ag-ui/transports/onode-transport.d.ts.map +0 -1
  72. package/dist/src/ag-ui/transports/onode-transport.js +0 -83
  73. package/dist/src/ag-ui/types/ag-ui-config.interface.d.ts +0 -105
  74. package/dist/src/ag-ui/types/ag-ui-config.interface.d.ts.map +0 -1
  75. package/dist/src/ag-ui/types/ag-ui-event.types.d.ts +0 -266
  76. package/dist/src/ag-ui/types/ag-ui-event.types.d.ts.map +0 -1
  77. package/dist/src/ag-ui/types/ag-ui-event.types.js +0 -6
  78. package/dist/src/ag-ui/types/index.d.ts +0 -3
  79. package/dist/src/ag-ui/types/index.d.ts.map +0 -1
  80. package/dist/src/ag-ui/types/index.js +0 -2
  81. package/dist/test/ai.spec.d.ts +0 -2
  82. package/dist/test/ai.spec.d.ts.map +0 -1
  83. package/dist/test/ai.spec.js +0 -19
  84. /package/dist/src/{ag-ui/types/ag-ui-config.interface.js → storage/interfaces/prompt-storage.interface.js} +0 -0
@@ -1,287 +0,0 @@
1
- import { v4 as uuidv4 } from 'uuid';
2
- /**
3
- * Utility functions for AG-UI event handling
4
- */
5
- /**
6
- * Generate a unique run ID
7
- */
8
- export function generateRunId() {
9
- return `run-${uuidv4()}`;
10
- }
11
- /**
12
- * Generate a unique message ID
13
- */
14
- export function generateMessageId() {
15
- return `msg-${uuidv4()}`;
16
- }
17
- /**
18
- * Generate a unique tool call ID
19
- */
20
- export function generateToolCallId() {
21
- return `tool-${uuidv4()}`;
22
- }
23
- /**
24
- * Generate a thread ID from context or create a new one
25
- */
26
- export function generateThreadId(context) {
27
- if (context) {
28
- // Create a deterministic ID from context
29
- const hash = simpleHash(context);
30
- return `thread-${hash}`;
31
- }
32
- return `thread-${uuidv4()}`;
33
- }
34
- /**
35
- * Simple hash function for creating deterministic IDs
36
- */
37
- function simpleHash(str) {
38
- let hash = 0;
39
- for (let i = 0; i < str.length; i++) {
40
- const char = str.charCodeAt(i);
41
- hash = (hash << 5) - hash + char;
42
- hash = hash & hash; // Convert to 32-bit integer
43
- }
44
- return Math.abs(hash).toString(36);
45
- }
46
- /**
47
- * Generate ISO 8601 timestamp for events
48
- */
49
- export function generateTimestamp() {
50
- return new Date().toISOString();
51
- }
52
- /**
53
- * Generate JSON Patch operations (RFC 6902) for state deltas
54
- * Compares old and new state to create minimal patch
55
- */
56
- export function generateJSONPatch(oldState, newState, basePath = '') {
57
- const patches = [];
58
- // Handle null/undefined cases
59
- if (oldState === undefined || oldState === null) {
60
- if (newState !== undefined && newState !== null) {
61
- patches.push({
62
- op: 'add',
63
- path: basePath || '/',
64
- value: newState,
65
- });
66
- }
67
- return patches;
68
- }
69
- if (newState === undefined || newState === null) {
70
- patches.push({
71
- op: 'remove',
72
- path: basePath || '/',
73
- });
74
- return patches;
75
- }
76
- // Handle primitive types
77
- if (typeof oldState !== 'object' || typeof newState !== 'object') {
78
- if (oldState !== newState) {
79
- patches.push({
80
- op: 'replace',
81
- path: basePath || '/',
82
- value: newState,
83
- });
84
- }
85
- return patches;
86
- }
87
- // Handle arrays
88
- if (Array.isArray(oldState) && Array.isArray(newState)) {
89
- return generateArrayPatch(oldState, newState, basePath);
90
- }
91
- // Handle objects
92
- if (Array.isArray(oldState) !== Array.isArray(newState)) {
93
- patches.push({
94
- op: 'replace',
95
- path: basePath || '/',
96
- value: newState,
97
- });
98
- return patches;
99
- }
100
- // Compare object keys
101
- const oldKeys = Object.keys(oldState);
102
- const newKeys = Object.keys(newState);
103
- const allKeys = new Set([...oldKeys, ...newKeys]);
104
- for (const key of allKeys) {
105
- const path = basePath ? `${basePath}/${escapeJsonPointer(key)}` : `/${escapeJsonPointer(key)}`;
106
- if (!(key in oldState)) {
107
- // Key added
108
- patches.push({
109
- op: 'add',
110
- path,
111
- value: newState[key],
112
- });
113
- }
114
- else if (!(key in newState)) {
115
- // Key removed
116
- patches.push({
117
- op: 'remove',
118
- path,
119
- });
120
- }
121
- else {
122
- // Key exists in both - recurse
123
- const nestedPatches = generateJSONPatch(oldState[key], newState[key], path);
124
- patches.push(...nestedPatches);
125
- }
126
- }
127
- return patches;
128
- }
129
- /**
130
- * Generate patches for array differences
131
- */
132
- function generateArrayPatch(oldArray, newArray, basePath) {
133
- const patches = [];
134
- // Simple strategy: if arrays differ significantly, replace entire array
135
- if (Math.abs(oldArray.length - newArray.length) > oldArray.length / 2) {
136
- patches.push({
137
- op: 'replace',
138
- path: basePath || '/',
139
- value: newArray,
140
- });
141
- return patches;
142
- }
143
- // For similar-length arrays, compare element by element
144
- const maxLen = Math.max(oldArray.length, newArray.length);
145
- for (let i = 0; i < maxLen; i++) {
146
- const path = `${basePath}/${i}`;
147
- if (i >= oldArray.length) {
148
- // New element added
149
- patches.push({
150
- op: 'add',
151
- path: `${basePath}/-`, // Use '-' to append
152
- value: newArray[i],
153
- });
154
- }
155
- else if (i >= newArray.length) {
156
- // Element removed (always remove from end)
157
- patches.push({
158
- op: 'remove',
159
- path: `${basePath}/${oldArray.length - 1}`,
160
- });
161
- }
162
- else {
163
- // Element potentially changed
164
- const nestedPatches = generateJSONPatch(oldArray[i], newArray[i], path);
165
- patches.push(...nestedPatches);
166
- }
167
- }
168
- return patches;
169
- }
170
- /**
171
- * Escape special characters in JSON Pointer (RFC 6901)
172
- */
173
- function escapeJsonPointer(str) {
174
- return str.replace(/~/g, '~0').replace(/\//g, '~1');
175
- }
176
- /**
177
- * Apply JSON Patch operations to an object
178
- */
179
- export function applyJSONPatch(obj, patches) {
180
- let result = JSON.parse(JSON.stringify(obj)); // Deep clone
181
- for (const patch of patches) {
182
- const path = patch.path.split('/').filter((p) => p);
183
- switch (patch.op) {
184
- case 'add':
185
- result = applyAdd(result, path, patch.value);
186
- break;
187
- case 'remove':
188
- result = applyRemove(result, path);
189
- break;
190
- case 'replace':
191
- result = applyReplace(result, path, patch.value);
192
- break;
193
- }
194
- }
195
- return result;
196
- }
197
- function applyAdd(obj, path, value) {
198
- if (path.length === 0)
199
- return value;
200
- const key = path[0];
201
- const rest = path.slice(1);
202
- if (rest.length === 0) {
203
- if (Array.isArray(obj)) {
204
- if (key === '-') {
205
- obj.push(value);
206
- }
207
- else {
208
- obj.splice(parseInt(key), 0, value);
209
- }
210
- }
211
- else {
212
- obj[key] = value;
213
- }
214
- return obj;
215
- }
216
- obj[key] = applyAdd(obj[key] || {}, rest, value);
217
- return obj;
218
- }
219
- function applyRemove(obj, path) {
220
- if (path.length === 0)
221
- return undefined;
222
- const key = path[0];
223
- const rest = path.slice(1);
224
- if (rest.length === 0) {
225
- if (Array.isArray(obj)) {
226
- obj.splice(parseInt(key), 1);
227
- }
228
- else {
229
- delete obj[key];
230
- }
231
- return obj;
232
- }
233
- obj[key] = applyRemove(obj[key], rest);
234
- return obj;
235
- }
236
- function applyReplace(obj, path, value) {
237
- if (path.length === 0)
238
- return value;
239
- const key = path[0];
240
- const rest = path.slice(1);
241
- if (rest.length === 0) {
242
- obj[key] = value;
243
- return obj;
244
- }
245
- obj[key] = applyReplace(obj[key], rest, value);
246
- return obj;
247
- }
248
- /**
249
- * Chunk a string into smaller pieces for streaming
250
- */
251
- export function chunkString(str, chunkSize) {
252
- const chunks = [];
253
- for (let i = 0; i < str.length; i += chunkSize) {
254
- chunks.push(str.slice(i, i + chunkSize));
255
- }
256
- return chunks;
257
- }
258
- /**
259
- * Validate an AG-UI event has required fields
260
- */
261
- export function validateEvent(event) {
262
- if (!event || typeof event !== 'object') {
263
- return false;
264
- }
265
- if (!event.type || typeof event.type !== 'string') {
266
- return false;
267
- }
268
- // Basic validation passed
269
- return true;
270
- }
271
- /**
272
- * Extract capability type from step name
273
- */
274
- export function capabilityTypeToStepName(capabilityType) {
275
- return capabilityType.toLowerCase();
276
- }
277
- /**
278
- * Create a safe JSON string from any value
279
- */
280
- export function safeJSONStringify(value) {
281
- try {
282
- return JSON.stringify(value, null, 2);
283
- }
284
- catch (error) {
285
- return String(value);
286
- }
287
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * AG-UI Protocol Support for oLane
3
- *
4
- * This module provides AG-UI protocol integration for oLane, enabling
5
- * real-time event streaming for agent execution visualization in frontends.
6
- *
7
- * @see https://docs.ag-ui.com/
8
- * @see https://github.com/ag-ui-protocol/ag-ui
9
- */
10
- export * from './ag-ui-olane.tool.js';
11
- export * from './ag-ui-event-mapper.js';
12
- export * from './ag-ui-stream-manager.js';
13
- export * from './types/index.js';
14
- export * from './transports/index.js';
15
- export * from './ag-ui-utils.js';
16
- export * from './ag-ui-constants.js';
17
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ag-ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,cAAc,uBAAuB,CAAC;AAGtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAG1C,cAAc,kBAAkB,CAAC;AAGjC,cAAc,uBAAuB,CAAC;AAGtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
@@ -1,21 +0,0 @@
1
- /**
2
- * AG-UI Protocol Support for oLane
3
- *
4
- * This module provides AG-UI protocol integration for oLane, enabling
5
- * real-time event streaming for agent execution visualization in frontends.
6
- *
7
- * @see https://docs.ag-ui.com/
8
- * @see https://github.com/ag-ui-protocol/ag-ui
9
- */
10
- // Main tool
11
- export * from './ag-ui-olane.tool.js';
12
- // Event mapper and stream manager
13
- export * from './ag-ui-event-mapper.js';
14
- export * from './ag-ui-stream-manager.js';
15
- // Types
16
- export * from './types/index.js';
17
- // Transports
18
- export * from './transports/index.js';
19
- // Utilities and constants
20
- export * from './ag-ui-utils.js';
21
- export * from './ag-ui-constants.js';
@@ -1,44 +0,0 @@
1
- import { AGUIEvent } from '../types/ag-ui-event.types.js';
2
- /**
3
- * Base interface for AG-UI event transport mechanisms
4
- * Implementations handle how events are delivered to frontends
5
- */
6
- export interface AGUITransport {
7
- /**
8
- * Send a single event
9
- * @param event - The AG-UI event to send
10
- */
11
- send(event: AGUIEvent): Promise<void>;
12
- /**
13
- * Send multiple events in sequence
14
- * @param events - Array of AG-UI events to send
15
- */
16
- sendBatch(events: AGUIEvent[]): Promise<void>;
17
- /**
18
- * Close the transport connection
19
- */
20
- close(): Promise<void>;
21
- /**
22
- * Check if the transport is currently active
23
- */
24
- isActive(): boolean;
25
- /**
26
- * Get transport type identifier
27
- */
28
- getType(): string;
29
- }
30
- /**
31
- * Base abstract class for transport implementations
32
- */
33
- export declare abstract class BaseAGUITransport implements AGUITransport {
34
- protected active: boolean;
35
- protected eventCount: number;
36
- abstract send(event: AGUIEvent): Promise<void>;
37
- abstract getType(): string;
38
- sendBatch(events: AGUIEvent[]): Promise<void>;
39
- close(): Promise<void>;
40
- isActive(): boolean;
41
- protected incrementEventCount(): void;
42
- getEventCount(): number;
43
- }
44
- //# sourceMappingURL=ag-ui-transport.interface.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ag-ui-transport.interface.d.ts","sourceRoot":"","sources":["../../../../src/ag-ui/transports/ag-ui-transport.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE1D;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtC;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9C;;OAEG;IACH,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvB;;OAEG;IACH,QAAQ,IAAI,OAAO,CAAC;IAEpB;;OAEG;IACH,OAAO,IAAI,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,8BAAsB,iBAAkB,YAAW,aAAa;IAC9D,SAAS,CAAC,MAAM,EAAE,OAAO,CAAQ;IACjC,SAAS,CAAC,UAAU,EAAE,MAAM,CAAK;IAEjC,QAAQ,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAC9C,QAAQ,CAAC,OAAO,IAAI,MAAM;IAEpB,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAM7C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,QAAQ,IAAI,OAAO;IAInB,SAAS,CAAC,mBAAmB,IAAI,IAAI;IAIrC,aAAa,IAAI,MAAM;CAGxB"}
@@ -1,26 +0,0 @@
1
- /**
2
- * Base abstract class for transport implementations
3
- */
4
- export class BaseAGUITransport {
5
- constructor() {
6
- this.active = true;
7
- this.eventCount = 0;
8
- }
9
- async sendBatch(events) {
10
- for (const event of events) {
11
- await this.send(event);
12
- }
13
- }
14
- async close() {
15
- this.active = false;
16
- }
17
- isActive() {
18
- return this.active;
19
- }
20
- incrementEventCount() {
21
- this.eventCount++;
22
- }
23
- getEventCount() {
24
- return this.eventCount;
25
- }
26
- }
@@ -1,13 +0,0 @@
1
- import { AGUIEvent } from '../types/ag-ui-event.types.js';
2
- import { BaseAGUITransport } from './ag-ui-transport.interface.js';
3
- /**
4
- * Simple callback-based transport for AG-UI events
5
- * Useful for testing and custom integrations
6
- */
7
- export declare class CallbackAGUITransport extends BaseAGUITransport {
8
- private callback;
9
- constructor(callback: (event: AGUIEvent) => void | Promise<void>);
10
- send(event: AGUIEvent): Promise<void>;
11
- getType(): string;
12
- }
13
- //# sourceMappingURL=callback-transport.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"callback-transport.d.ts","sourceRoot":"","sources":["../../../../src/ag-ui/transports/callback-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGnE;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,iBAAiB;IAC1D,OAAO,CAAC,QAAQ,CAA6C;gBAEjD,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAK1D,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAe3C,OAAO,IAAI,MAAM;CAGlB"}
@@ -1,26 +0,0 @@
1
- import { BaseAGUITransport } from './ag-ui-transport.interface.js';
2
- import { generateTimestamp } from '../ag-ui-utils.js';
3
- /**
4
- * Simple callback-based transport for AG-UI events
5
- * Useful for testing and custom integrations
6
- */
7
- export class CallbackAGUITransport extends BaseAGUITransport {
8
- constructor(callback) {
9
- super();
10
- this.callback = callback;
11
- }
12
- async send(event) {
13
- if (!this.active) {
14
- throw new Error('Transport is closed');
15
- }
16
- // Add timestamp if not present
17
- if (!event.timestamp) {
18
- event.timestamp = generateTimestamp();
19
- }
20
- this.incrementEventCount();
21
- await Promise.resolve(this.callback(event));
22
- }
23
- getType() {
24
- return 'callback';
25
- }
26
- }
@@ -1,14 +0,0 @@
1
- import { AGUIEvent } from '../types/ag-ui-event.types.js';
2
- import { BaseAGUITransport } from './ag-ui-transport.interface.js';
3
- /**
4
- * Console-based transport for AG-UI events
5
- * Useful for debugging and development
6
- */
7
- export declare class ConsoleAGUITransport extends BaseAGUITransport {
8
- private verbose;
9
- constructor(verbose?: boolean);
10
- send(event: AGUIEvent): Promise<void>;
11
- private formatEventSummary;
12
- getType(): string;
13
- }
14
- //# sourceMappingURL=console-transport.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"console-transport.d.ts","sourceRoot":"","sources":["../../../../src/ag-ui/transports/console-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGnE;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,iBAAiB;IACzD,OAAO,CAAC,OAAO,CAAU;gBAEb,OAAO,GAAE,OAAe;IAK9B,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;IAuB3C,OAAO,CAAC,kBAAkB;IAgC1B,OAAO,IAAI,MAAM;CAGlB"}
@@ -1,63 +0,0 @@
1
- import { BaseAGUITransport } from './ag-ui-transport.interface.js';
2
- import { generateTimestamp, safeJSONStringify } from '../ag-ui-utils.js';
3
- /**
4
- * Console-based transport for AG-UI events
5
- * Useful for debugging and development
6
- */
7
- export class ConsoleAGUITransport extends BaseAGUITransport {
8
- constructor(verbose = false) {
9
- super();
10
- this.verbose = verbose;
11
- }
12
- async send(event) {
13
- if (!this.active) {
14
- throw new Error('Transport is closed');
15
- }
16
- // Add timestamp if not present
17
- if (!event.timestamp) {
18
- event.timestamp = generateTimestamp();
19
- }
20
- this.incrementEventCount();
21
- if (this.verbose) {
22
- console.log(`[AG-UI Event #${this.eventCount}]`, safeJSONStringify(event));
23
- }
24
- else {
25
- // Compact format for non-verbose mode
26
- console.log(`[AG-UI] ${event.type}`, this.formatEventSummary(event));
27
- }
28
- }
29
- formatEventSummary(event) {
30
- switch (event.type) {
31
- case 'RunStarted':
32
- return `runId=${event.runId} threadId=${event.threadId}`;
33
- case 'RunFinished':
34
- return `runId=${event.runId} outcome=${event.outcome || 'success'}`;
35
- case 'RunError':
36
- return `message="${event.message}"`;
37
- case 'StepStarted':
38
- case 'StepFinished':
39
- return `step="${event.stepName}"`;
40
- case 'TextMessageStart':
41
- return `msgId=${event.messageId} role=${event.role}`;
42
- case 'TextMessageContent':
43
- return `msgId=${event.messageId} delta="${event.delta.slice(0, 30)}..."`;
44
- case 'TextMessageEnd':
45
- return `msgId=${event.messageId}`;
46
- case 'ToolCallStart':
47
- return `toolId=${event.toolCallId} name=${event.toolCallName}`;
48
- case 'ToolCallResult':
49
- return `toolId=${event.toolCallId}`;
50
- case 'StateSnapshot':
51
- return `snapshot keys: ${Object.keys(event.snapshot).join(', ')}`;
52
- case 'StateDelta':
53
- return `${event.delta.length} patches`;
54
- case 'ActivitySnapshot':
55
- return `${event.activityType} msgId=${event.messageId}`;
56
- default:
57
- return '';
58
- }
59
- }
60
- getType() {
61
- return 'console';
62
- }
63
- }
@@ -1,5 +0,0 @@
1
- export * from './ag-ui-transport.interface.js';
2
- export * from './onode-transport.js';
3
- export * from './callback-transport.js';
4
- export * from './console-transport.js';
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ag-ui/transports/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC"}
@@ -1,4 +0,0 @@
1
- export * from './ag-ui-transport.interface.js';
2
- export * from './onode-transport.js';
3
- export * from './callback-transport.js';
4
- export * from './console-transport.js';
@@ -1,34 +0,0 @@
1
- import { oAddress } from '@olane/o-core';
2
- import { oToolBase } from '@olane/o-tool';
3
- import { Stream } from '@olane/o-config';
4
- import { AGUIEvent } from '../types/ag-ui-event.types.js';
5
- import { BaseAGUITransport } from './ag-ui-transport.interface.js';
6
- /**
7
- * AG-UI Transport using oNode's existing streaming infrastructure
8
- * Leverages the streamTo address and oResponse streaming
9
- */
10
- export declare class ONodeAGUITransport extends BaseAGUITransport {
11
- private streamTo?;
12
- private node?;
13
- private stream?;
14
- private requestId?;
15
- constructor(config: {
16
- streamTo?: oAddress;
17
- node?: oToolBase;
18
- stream?: Stream;
19
- requestId?: string | number;
20
- });
21
- send(event: AGUIEvent): Promise<void>;
22
- private sendViaStream;
23
- private sendViaStreamTo;
24
- getType(): string;
25
- /**
26
- * Update stream configuration mid-execution
27
- */
28
- updateStream(stream: Stream): void;
29
- /**
30
- * Update streamTo address mid-execution
31
- */
32
- updateStreamTo(streamTo: oAddress): void;
33
- }
34
- //# sourceMappingURL=onode-transport.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"onode-transport.d.ts","sourceRoot":"","sources":["../../../../src/ag-ui/transports/onode-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAwB,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGnE;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,iBAAiB;IACvD,OAAO,CAAC,QAAQ,CAAC,CAAW;IAC5B,OAAO,CAAC,IAAI,CAAC,CAAY;IACzB,OAAO,CAAC,MAAM,CAAC,CAAS;IACxB,OAAO,CAAC,SAAS,CAAC,CAAkB;gBAExB,MAAM,EAAE;QAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC;QACpB,IAAI,CAAC,EAAE,SAAS,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;KAC7B;IAQK,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;YAuB7B,aAAa;YAkBb,eAAe;IAkB7B,OAAO,IAAI,MAAM;IAIjB;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIlC;;OAEG;IACH,cAAc,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CAGzC"}
@@ -1,83 +0,0 @@
1
- import { oResponse, CoreUtils } from '@olane/o-core';
2
- import { BaseAGUITransport } from './ag-ui-transport.interface.js';
3
- import { generateTimestamp } from '../ag-ui-utils.js';
4
- /**
5
- * AG-UI Transport using oNode's existing streaming infrastructure
6
- * Leverages the streamTo address and oResponse streaming
7
- */
8
- export class ONodeAGUITransport extends BaseAGUITransport {
9
- constructor(config) {
10
- super();
11
- this.streamTo = config.streamTo;
12
- this.node = config.node;
13
- this.stream = config.stream;
14
- this.requestId = config.requestId;
15
- }
16
- async send(event) {
17
- if (!this.active) {
18
- throw new Error('Transport is closed');
19
- }
20
- // Add timestamp if not present
21
- if (!event.timestamp) {
22
- event.timestamp = generateTimestamp();
23
- }
24
- this.incrementEventCount();
25
- // Send via oNode streaming if stream is available
26
- if (this.stream) {
27
- await this.sendViaStream(event);
28
- }
29
- // Also send to streamTo address if configured
30
- if (this.streamTo && this.node) {
31
- await this.sendViaStreamTo(event);
32
- }
33
- }
34
- async sendViaStream(event) {
35
- if (!this.stream)
36
- return;
37
- const response = new oResponse({
38
- data: {
39
- type: 'ag-ui-event',
40
- event: event,
41
- },
42
- _last: false,
43
- _isStreaming: true,
44
- _connectionId: this.node?.address.toString() || 'unknown',
45
- _requestMethod: 'ag_ui_intent',
46
- id: this.requestId || 'unknown',
47
- });
48
- await CoreUtils.sendStreamResponse(response, this.stream);
49
- }
50
- async sendViaStreamTo(event) {
51
- if (!this.streamTo || !this.node)
52
- return;
53
- try {
54
- await this.node.use(this.streamTo, {
55
- method: 'receive_ag_ui_event',
56
- params: {
57
- event: event,
58
- },
59
- });
60
- }
61
- catch (error) {
62
- // Log but don't throw - streamTo errors shouldn't break execution
63
- if (this.node) {
64
- this.node.logger.error('Error sending AG-UI event to streamTo:', error);
65
- }
66
- }
67
- }
68
- getType() {
69
- return 'onode';
70
- }
71
- /**
72
- * Update stream configuration mid-execution
73
- */
74
- updateStream(stream) {
75
- this.stream = stream;
76
- }
77
- /**
78
- * Update streamTo address mid-execution
79
- */
80
- updateStreamTo(streamTo) {
81
- this.streamTo = streamTo;
82
- }
83
- }