@output.ai/core 0.5.4 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@output.ai/core",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "description": "The core module of the output framework",
5
5
  "type": "module",
6
6
  "exports": {
@@ -40,7 +40,7 @@
40
40
  "stacktrace-parser": "0.1.11",
41
41
  "undici": "7.18.2",
42
42
  "winston": "3.17.0",
43
- "zod": "4.1.12"
43
+ "zod": "^4.3.6"
44
44
  },
45
45
  "license": "Apache-2.0",
46
46
  "publishConfig": {
@@ -23,7 +23,7 @@ const processors = [
23
23
  name: 'REMOTE',
24
24
  init: s3Processor.init,
25
25
  exec: s3Processor.exec,
26
- getDestination: localProcessor.getDestination
26
+ getDestination: s3Processor.getDestination
27
27
  }
28
28
  ];
29
29
 
@@ -87,6 +87,18 @@ describe( 'tracing/trace_engine', () => {
87
87
  expect( localExecMock ).not.toHaveBeenCalled();
88
88
  } );
89
89
 
90
+ it( 'addEventPhase() does not emit when kind is INTERNAL_STEP', async () => {
91
+ process.env.OUTPUT_TRACE_LOCAL_ON = '1';
92
+ const { init, addEventPhase } = await loadTraceEngine();
93
+ await init();
94
+
95
+ addEventPhase( 'start', {
96
+ kind: 'internal_step', name: 'Internal', id: '1', parentId: 'p', details: {},
97
+ executionContext: { disableTrace: false }
98
+ } );
99
+ expect( localExecMock ).not.toHaveBeenCalled();
100
+ } );
101
+
90
102
  it( 'addEventPhaseWithContext() uses storage when available', async () => {
91
103
  process.env.OUTPUT_TRACE_LOCAL_ON = 'true';
92
104
  storageLoadMock.mockReturnValue( {
@@ -128,23 +140,60 @@ describe( 'tracing/trace_engine', () => {
128
140
  expect( localExecMock ).not.toHaveBeenCalled();
129
141
  } );
130
142
 
131
- it( 'getDestinations() returns null for each value when executionContext.disableTrace is true', async () => {
132
- process.env.OUTPUT_TRACE_LOCAL_ON = '1';
133
- process.env.OUTPUT_TRACE_REMOTE_ON = '1';
134
- const { getDestinations } = await loadTraceEngine();
135
- const result = getDestinations( { workflowId: 'w1', workflowName: 'WF', startTime: 1, disableTrace: true } );
136
- expect( result ).toEqual( { local: null, remote: null } );
137
- expect( localGetDestinationMock ).not.toHaveBeenCalled();
138
- expect( s3GetDestinationMock ).not.toHaveBeenCalled();
139
- } );
140
-
141
- it( 'getDestinations() returns processor destinations when disableTrace is false', async () => {
142
- process.env.OUTPUT_TRACE_LOCAL_ON = '1';
143
- process.env.OUTPUT_TRACE_REMOTE_ON = '0';
144
- const { getDestinations } = await loadTraceEngine();
143
+ describe( 'getDestinations()', () => {
145
144
  const executionContext = { workflowId: 'w1', workflowName: 'WF', startTime: 1, disableTrace: false };
146
- const result = getDestinations( executionContext );
147
- expect( result ).toEqual( { local: '/local/path.json', remote: null } );
148
- expect( localGetDestinationMock ).toHaveBeenCalledWith( executionContext );
145
+
146
+ it( 'returns null for both when traces are off (env vars unset)', async () => {
147
+ const { getDestinations } = await loadTraceEngine();
148
+ const result = getDestinations( executionContext );
149
+ expect( result ).toEqual( { local: null, remote: null } );
150
+ expect( localGetDestinationMock ).not.toHaveBeenCalled();
151
+ expect( s3GetDestinationMock ).not.toHaveBeenCalled();
152
+ } );
153
+
154
+ it( 'returns null for both when executionContext.disableTrace is true', async () => {
155
+ process.env.OUTPUT_TRACE_LOCAL_ON = '1';
156
+ process.env.OUTPUT_TRACE_REMOTE_ON = '1';
157
+ const { getDestinations } = await loadTraceEngine();
158
+ const result = getDestinations( { ...executionContext, disableTrace: true } );
159
+ expect( result ).toEqual( { local: null, remote: null } );
160
+ expect( localGetDestinationMock ).not.toHaveBeenCalled();
161
+ expect( s3GetDestinationMock ).not.toHaveBeenCalled();
162
+ } );
163
+
164
+ it( 'returns both destinations when both traces are on', async () => {
165
+ process.env.OUTPUT_TRACE_LOCAL_ON = '1';
166
+ process.env.OUTPUT_TRACE_REMOTE_ON = 'true';
167
+ const { getDestinations } = await loadTraceEngine();
168
+ const result = getDestinations( executionContext );
169
+ expect( result ).toEqual( {
170
+ local: '/local/path.json',
171
+ remote: 'https://bucket.s3.amazonaws.com/key.json'
172
+ } );
173
+ expect( localGetDestinationMock ).toHaveBeenCalledTimes( 1 );
174
+ expect( localGetDestinationMock ).toHaveBeenCalledWith( executionContext );
175
+ expect( s3GetDestinationMock ).toHaveBeenCalledTimes( 1 );
176
+ expect( s3GetDestinationMock ).toHaveBeenCalledWith( executionContext );
177
+ } );
178
+
179
+ it( 'returns local only when local trace on and remote off', async () => {
180
+ process.env.OUTPUT_TRACE_LOCAL_ON = '1';
181
+ process.env.OUTPUT_TRACE_REMOTE_ON = '0';
182
+ const { getDestinations } = await loadTraceEngine();
183
+ const result = getDestinations( executionContext );
184
+ expect( result ).toEqual( { local: '/local/path.json', remote: null } );
185
+ expect( localGetDestinationMock ).toHaveBeenCalledWith( executionContext );
186
+ expect( s3GetDestinationMock ).not.toHaveBeenCalled();
187
+ } );
188
+
189
+ it( 'returns remote only when local trace off and remote on', async () => {
190
+ process.env.OUTPUT_TRACE_LOCAL_ON = '0';
191
+ process.env.OUTPUT_TRACE_REMOTE_ON = 'true';
192
+ const { getDestinations } = await loadTraceEngine();
193
+ const result = getDestinations( executionContext );
194
+ expect( result ).toEqual( { local: null, remote: 'https://bucket.s3.amazonaws.com/key.json' } );
195
+ expect( localGetDestinationMock ).not.toHaveBeenCalled();
196
+ expect( s3GetDestinationMock ).toHaveBeenCalledWith( executionContext );
197
+ } );
149
198
  } );
150
199
  } );