@outputai/core 0.14.0 → 0.14.1-next.1ec4416.0

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 (100) hide show
  1. package/dist/credentials/credentials.d.ts +6 -0
  2. package/dist/credentials/credentials.js +87 -0
  3. package/dist/credentials/encrypted_yaml_provider.d.ts +2 -0
  4. package/dist/credentials/encrypted_yaml_provider.js +77 -0
  5. package/dist/credentials/encryption.d.ts +3 -0
  6. package/dist/credentials/encryption.js +6 -0
  7. package/dist/credentials/errors.d.ts +13 -0
  8. package/dist/credentials/errors.js +39 -0
  9. package/dist/credentials/index.d.ts +6 -0
  10. package/dist/credentials/index.js +5 -0
  11. package/dist/credentials/init.d.ts +1 -0
  12. package/dist/credentials/init.js +7 -0
  13. package/dist/credentials/paths.d.ts +7 -0
  14. package/dist/credentials/paths.js +14 -0
  15. package/dist/credentials/provider_registry.d.ts +3 -0
  16. package/dist/credentials/provider_registry.js +6 -0
  17. package/dist/credentials/types.d.ts +12 -0
  18. package/dist/credentials/types.js +1 -0
  19. package/package.json +25 -14
  20. package/src/async_storage.d.ts +4 -0
  21. package/src/consts.js +0 -2
  22. package/src/helpers/object.d.ts +2 -0
  23. package/src/hooks/index.d.ts +0 -8
  24. package/src/hooks/index.js +0 -3
  25. package/src/logger/index.d.ts +4 -0
  26. package/src/worker/index.js +3 -1
  27. package/bin/healthcheck.spec.js +0 -90
  28. package/src/bus.spec.js +0 -196
  29. package/src/errors.spec.js +0 -19
  30. package/src/helpers/activity_options.spec.js +0 -55
  31. package/src/helpers/component.spec.js +0 -54
  32. package/src/helpers/error_serializer.spec.js +0 -479
  33. package/src/helpers/errors.spec.js +0 -189
  34. package/src/helpers/fetch.spec.js +0 -292
  35. package/src/helpers/function.spec.js +0 -24
  36. package/src/helpers/object.spec.js +0 -425
  37. package/src/helpers/promise.spec.js +0 -62
  38. package/src/helpers/redact.spec.js +0 -66
  39. package/src/helpers/string.spec.js +0 -99
  40. package/src/helpers/temporal_context.spec.ts +0 -83
  41. package/src/helpers/trace_info.spec.js +0 -45
  42. package/src/helpers/workflow_context.spec.js +0 -46
  43. package/src/hooks/index.spec.js +0 -265
  44. package/src/hooks/pending_hooks.spec.js +0 -62
  45. package/src/interface/evaluator.spec.js +0 -685
  46. package/src/interface/logger.spec.js +0 -172
  47. package/src/interface/step.spec.js +0 -128
  48. package/src/interface/validations/index.spec.js +0 -197
  49. package/src/interface/validations/schemas.spec.js +0 -229
  50. package/src/interface/webhook.spec.js +0 -170
  51. package/src/interface/workflow.spec.js +0 -710
  52. package/src/interface/workflow_utils.spec.js +0 -271
  53. package/src/interface/zod_integration.spec.js +0 -646
  54. package/src/internal_activities/index.spec.js +0 -186
  55. package/src/logger/development.spec.js +0 -87
  56. package/src/logger/index.spec.js +0 -27
  57. package/src/logger/production.spec.js +0 -71
  58. package/src/sdk/helpers/component_metadata.spec.js +0 -30
  59. package/src/sdk/helpers/objects.spec.js +0 -16
  60. package/src/sdk/helpers/path.spec.js +0 -102
  61. package/src/sdk/runtime/context.spec.js +0 -37
  62. package/src/sdk/runtime/events.spec.js +0 -40
  63. package/src/temporal/client.spec.js +0 -124
  64. package/src/tracing/processors/local/index.spec.js +0 -204
  65. package/src/tracing/processors/s3/configs.spec.js +0 -64
  66. package/src/tracing/processors/s3/index.spec.js +0 -185
  67. package/src/tracing/processors/s3/redis_client.spec.js +0 -179
  68. package/src/tracing/processors/s3/s3_client.spec.js +0 -68
  69. package/src/tracing/tools/build_trace_tree.spec.js +0 -216
  70. package/src/tracing/trace_engine.spec.js +0 -299
  71. package/src/worker/bundle.spec.js +0 -53
  72. package/src/worker/bundler_options.spec.js +0 -62
  73. package/src/worker/catalog_workflow/catalog_publisher.spec.js +0 -317
  74. package/src/worker/catalog_workflow/index.spec.js +0 -222
  75. package/src/worker/configs.spec.js +0 -213
  76. package/src/worker/configs_tuner_schema.spec.js +0 -127
  77. package/src/worker/connection_monitor.spec.js +0 -328
  78. package/src/worker/global_functions.spec.js +0 -55
  79. package/src/worker/index.spec.js +0 -526
  80. package/src/worker/interceptors/activity.spec.js +0 -369
  81. package/src/worker/interceptors/headers.spec.js +0 -73
  82. package/src/worker/interceptors/workflow.spec.js +0 -357
  83. package/src/worker/interruption.spec.js +0 -177
  84. package/src/worker/loader/activities.spec.js +0 -212
  85. package/src/worker/loader/hooks.spec.js +0 -64
  86. package/src/worker/loader/matchers.spec.js +0 -140
  87. package/src/worker/loader/tools.spec.js +0 -595
  88. package/src/worker/loader/workflows.spec.js +0 -287
  89. package/src/worker/log_hooks.spec.js +0 -303
  90. package/src/worker/shutdown.spec.js +0 -197
  91. package/src/worker/sinks.spec.js +0 -220
  92. package/src/worker/telemetry.spec.js +0 -80
  93. package/src/worker/temporal_logger.spec.js +0 -90
  94. package/src/worker/webpack_loaders/tools.spec.js +0 -314
  95. package/src/worker/webpack_loaders/workflow_rewriter/collect_target_imports.spec.js +0 -134
  96. package/src/worker/webpack_loaders/workflow_rewriter/index.spec.js +0 -154
  97. package/src/worker/webpack_loaders/workflow_rewriter/rewrite_activity_calls.spec.js +0 -165
  98. package/src/worker/webpack_loaders/workflow_validator/index.spec.js +0 -202
  99. package/src/worker/webpack_loaders/workflow_validator/npm_workflow_export_resolve.spec.js +0 -374
  100. package/src/worker/worker_runner.spec.js +0 -220
package/src/bus.spec.js DELETED
@@ -1,196 +0,0 @@
1
- import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
2
-
3
- const loadMock = vi.hoisted( () => vi.fn() );
4
-
5
- vi.mock( '#async_storage', () => ( {
6
- Storage: { load: loadMock }
7
- } ) );
8
-
9
- import { mainEventBus, stepEventBus } from './bus.js';
10
-
11
- const UUID_V4_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
12
- const ACTIVITY_CONTEXT = {
13
- activityInfo: { activityId: 'activity-id' },
14
- workflowDetails: { workflowId: 'workflow-id' },
15
- outputActivityKind: 'step'
16
- };
17
-
18
- describe( 'event buses', () => {
19
- beforeEach( () => {
20
- mainEventBus.removeAllListeners();
21
- stepEventBus.removeAllListeners();
22
- loadMock.mockReset();
23
- } );
24
-
25
- afterEach( () => {
26
- vi.useRealTimers();
27
- } );
28
-
29
- describe( 'mainEventBus', () => {
30
- it( 'adds event metadata to payload fields', () => {
31
- const handler = vi.fn();
32
- const now = new Date( '2026-06-02T12:00:00.000Z' );
33
- vi.useFakeTimers();
34
- vi.setSystemTime( now );
35
- mainEventBus.on( 'test:event', handler );
36
-
37
- mainEventBus.emit( 'test:event', { foo: 'bar' } );
38
-
39
- expect( handler ).toHaveBeenCalledWith( {
40
- eventId: expect.stringMatching( UUID_V4_REGEX ),
41
- eventDate: now.getTime(),
42
- foo: 'bar'
43
- } );
44
- } );
45
-
46
- it( 'preserves caller-supplied event metadata', () => {
47
- const handler = vi.fn();
48
- mainEventBus.on( 'test:event', handler );
49
-
50
- mainEventBus.emit( 'test:event', { eventId: 'fixed-id', eventDate: 1234 } );
51
-
52
- expect( handler ).toHaveBeenCalledWith( {
53
- eventId: 'fixed-id',
54
- eventDate: 1234
55
- } );
56
- } );
57
-
58
- it( 'does not mutate the caller-supplied payload', () => {
59
- const handler = vi.fn();
60
- const payload = { foo: 'bar' };
61
- mainEventBus.on( 'test:event', handler );
62
-
63
- mainEventBus.emit( 'test:event', payload );
64
-
65
- expect( handler.mock.calls[0][0] ).not.toBe( payload );
66
- expect( payload ).toEqual( { foo: 'bar' } );
67
- } );
68
-
69
- it( 'does not attach activity context', () => {
70
- const handler = vi.fn();
71
- loadMock.mockReturnValue( {
72
- activityInfo: { activityId: 'activity-id' },
73
- workflowDetails: { workflowId: 'workflow-id' },
74
- outputActivityKind: 'step'
75
- } );
76
- mainEventBus.on( 'test:event', handler );
77
-
78
- mainEventBus.emit( 'test:event', { foo: 'bar' } );
79
-
80
- expect( handler ).toHaveBeenCalledWith( expect.not.objectContaining( {
81
- activityInfo: expect.anything(),
82
- workflowDetails: expect.anything(),
83
- outputActivityKind: expect.anything()
84
- } ) );
85
- expect( loadMock ).not.toHaveBeenCalled();
86
- } );
87
-
88
- it( 'filters catalog workflow events', () => {
89
- const handler = vi.fn();
90
- mainEventBus.on( 'workflow:start', handler );
91
-
92
- const emitted = mainEventBus.emit( 'workflow:start', {
93
- workflowDetails: { workflowType: '$catalog' }
94
- } );
95
-
96
- expect( emitted ).toBe( false );
97
- expect( handler ).not.toHaveBeenCalled();
98
- } );
99
- } );
100
-
101
- describe( 'stepEventBus', () => {
102
- beforeEach( () => {
103
- loadMock.mockReturnValue( ACTIVITY_CONTEXT );
104
- } );
105
-
106
- it( 'wraps payloads with event metadata and activity context', () => {
107
- const handler = vi.fn();
108
- const payload = { foo: 'bar' };
109
- stepEventBus.on( 'test:event', handler );
110
-
111
- stepEventBus.emit( 'test:event', payload );
112
-
113
- expect( handler ).toHaveBeenCalledWith( {
114
- eventId: expect.stringMatching( UUID_V4_REGEX ),
115
- eventDate: expect.any( Number ),
116
- ...ACTIVITY_CONTEXT,
117
- payload
118
- } );
119
- } );
120
-
121
- it( 'omits activity fields outside activity context', () => {
122
- const handler = vi.fn();
123
- loadMock.mockReturnValue( undefined );
124
- stepEventBus.on( 'test:event', handler );
125
-
126
- stepEventBus.emit( 'test:event', { foo: 'bar' } );
127
-
128
- expect( handler ).toHaveBeenCalledWith( {
129
- eventId: expect.stringMatching( UUID_V4_REGEX ),
130
- eventDate: expect.any( Number ),
131
- payload: { foo: 'bar' }
132
- } );
133
- } );
134
-
135
- it( 'preserves arbitrary payloads unchanged inside the envelope', () => {
136
- const handler = vi.fn();
137
- const array = [ 1, 2, 3 ];
138
- const instance = new Date();
139
- stepEventBus.on( 'test:event', handler );
140
-
141
- stepEventBus.emit( 'test:event', 'value' );
142
- stepEventBus.emit( 'test:event', array );
143
- stepEventBus.emit( 'test:event', instance );
144
- stepEventBus.emit( 'test:event' );
145
-
146
- expect( handler.mock.calls[0][0].payload ).toBe( 'value' );
147
- expect( handler.mock.calls[1][0].payload ).toBe( array );
148
- expect( handler.mock.calls[2][0].payload ).toBe( instance );
149
- expect( handler.mock.calls[3][0] ).toHaveProperty( 'payload', undefined );
150
- } );
151
-
152
- it( 'keeps payload metadata separate from envelope metadata', () => {
153
- const handler = vi.fn();
154
- const payload = { eventId: 'payload-id', eventDate: 1234 };
155
- stepEventBus.on( 'test:event', handler );
156
-
157
- stepEventBus.emit( 'test:event', payload );
158
-
159
- const envelope = handler.mock.calls[0][0];
160
- expect( envelope.eventId ).toMatch( UUID_V4_REGEX );
161
- expect( envelope.eventId ).not.toBe( payload.eventId );
162
- expect( envelope.eventDate ).not.toBe( payload.eventDate );
163
- expect( envelope.payload ).toBe( payload );
164
- } );
165
-
166
- it( 'gives distinct emits distinct eventIds', () => {
167
- const handler = vi.fn();
168
- stepEventBus.on( 'test:event', handler );
169
-
170
- stepEventBus.emit( 'test:event', { i: 1 } );
171
- stepEventBus.emit( 'test:event', { i: 2 } );
172
-
173
- const first = handler.mock.calls[0][0].eventId;
174
- const second = handler.mock.calls[1][0].eventId;
175
- expect( first ).toMatch( UUID_V4_REGEX );
176
- expect( second ).toMatch( UUID_V4_REGEX );
177
- expect( first ).not.toBe( second );
178
- } );
179
-
180
- it( 'forwards additional positional arguments unchanged', () => {
181
- const handler = vi.fn();
182
- stepEventBus.on( 'test:event', handler );
183
-
184
- stepEventBus.emit( 'test:event', { foo: 'bar' }, 'extra', 99 );
185
-
186
- expect( handler ).toHaveBeenCalledWith(
187
- expect.objectContaining( {
188
- eventId: expect.stringMatching( UUID_V4_REGEX ),
189
- payload: { foo: 'bar' }
190
- } ),
191
- 'extra',
192
- 99
193
- );
194
- } );
195
- } );
196
- } );
@@ -1,19 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { FatalError, TransparentFatalError, ValidationError } from './errors.js';
3
-
4
- describe( 'SDK errors', () => {
5
- it( 'treats validation and transparent errors as fatal errors', () => {
6
- const cause = new TypeError( 'provider rejected request' );
7
- const transparentError = new TransparentFatalError( cause );
8
-
9
- expect( new ValidationError( 'invalid input' ) ).toBeInstanceOf( FatalError );
10
- expect( transparentError ).toBeInstanceOf( FatalError );
11
- expect( transparentError.cause ).toBe( cause );
12
- } );
13
-
14
- it( 'rejects transparent errors without an Error cause', () => {
15
- expect( () => new TransparentFatalError( 'provider rejected request' ) ).toThrow(
16
- new FatalError( 'TransparentFatalError argument must be an Error instance' )
17
- );
18
- } );
19
- } );
@@ -1,55 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { enforceActivityOptions } from './activity_options.js';
3
-
4
- describe( 'enforceActivityOptions', () => {
5
- it( 'adds FatalError while preserving existing activity and retry options', () => {
6
- const activityOptions = {
7
- startToCloseTimeout: '5m',
8
- retry: {
9
- maximumAttempts: 4,
10
- nonRetryableErrorTypes: [ 'DomainError' ]
11
- }
12
- };
13
-
14
- expect( enforceActivityOptions( activityOptions ) ).toEqual( {
15
- startToCloseTimeout: '5m',
16
- retry: {
17
- maximumAttempts: 4,
18
- nonRetryableErrorTypes: [ 'DomainError', 'FatalError' ]
19
- }
20
- } );
21
- } );
22
-
23
- it( 'does not duplicate FatalError', () => {
24
- const result = enforceActivityOptions( {
25
- retry: { nonRetryableErrorTypes: [ 'FatalError', 'DomainError', 'FatalError' ] }
26
- } );
27
-
28
- expect( result.retry.nonRetryableErrorTypes ).toEqual( [ 'FatalError', 'DomainError' ] );
29
- } );
30
-
31
- it( 'returns a new object without mutating the provided options', () => {
32
- const activityOptions = {
33
- retry: {
34
- maximumAttempts: 2,
35
- nonRetryableErrorTypes: [ 'DomainError' ]
36
- }
37
- };
38
- const result = enforceActivityOptions( activityOptions );
39
-
40
- expect( result ).not.toBe( activityOptions );
41
- expect( result.retry ).not.toBe( activityOptions.retry );
42
- expect( activityOptions ).toEqual( {
43
- retry: {
44
- maximumAttempts: 2,
45
- nonRetryableErrorTypes: [ 'DomainError' ]
46
- }
47
- } );
48
- } );
49
-
50
- it( 'creates required retry options when options are omitted', () => {
51
- expect( enforceActivityOptions() ).toEqual( {
52
- retry: { nonRetryableErrorTypes: [ 'FatalError' ] }
53
- } );
54
- } );
55
- } );
@@ -1,54 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { ComponentType, METADATA_ACCESS_SYMBOL } from '#consts';
3
- import { createEvaluator, createInternalStep, createStep, createWorkflow } from './component.js';
4
-
5
- const factories = [
6
- [ 'createStep', createStep, ComponentType.STEP ],
7
- [ 'createInternalStep', createInternalStep, ComponentType.INTERNAL_STEP ],
8
- [ 'createEvaluator', createEvaluator, ComponentType.EVALUATOR ],
9
- [ 'createWorkflow', createWorkflow, ComponentType.WORKFLOW ]
10
- ];
11
-
12
- describe( 'component helpers', () => {
13
- it.each( factories )( '%s returns the handler with typed metadata', ( _, create, type ) => {
14
- const handler = () => 'ok';
15
- const inputSchema = { safeParse: () => ( { success: true } ) };
16
- const outputSchema = { safeParse: () => ( { success: true } ) };
17
- const options = { activityOptions: { startToCloseTimeout: '1m' } };
18
-
19
- const component = create( {
20
- name: 'test_component',
21
- description: 'Test component',
22
- inputSchema,
23
- outputSchema,
24
- handler,
25
- options
26
- } );
27
-
28
- expect( component ).toBe( handler );
29
- expect( component[METADATA_ACCESS_SYMBOL] ).toEqual( {
30
- name: 'test_component',
31
- description: 'Test component',
32
- inputSchema,
33
- outputSchema,
34
- options,
35
- type
36
- } );
37
- } );
38
-
39
- it( 'defines metadata as a hidden immutable property', () => {
40
- const handler = () => {};
41
- const component = createStep( { name: 'hidden_step', handler } );
42
-
43
- expect( Object.getOwnPropertyDescriptor( component, METADATA_ACCESS_SYMBOL ) ).toEqual( {
44
- value: { name: 'hidden_step', type: ComponentType.STEP },
45
- writable: false,
46
- configurable: false,
47
- enumerable: false
48
- } );
49
- expect( Object.keys( component ) ).toEqual( [] );
50
- expect( () => {
51
- component[METADATA_ACCESS_SYMBOL] = { name: 'updated' };
52
- } ).toThrow( TypeError );
53
- } );
54
- } );