@output.ai/core 0.5.3 → 0.5.4

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.3",
3
+ "version": "0.5.4",
4
4
  "description": "The core module of the output framework",
5
5
  "type": "module",
6
6
  "exports": {
package/src/consts.js CHANGED
@@ -15,8 +15,3 @@ export const LifecycleEvent = {
15
15
  END: 'end',
16
16
  ERROR: 'error'
17
17
  };
18
- export const LifecycleEventLogMessage = {
19
- [LifecycleEvent.START]: 'Start',
20
- [LifecycleEvent.END]: 'End',
21
- [LifecycleEvent.ERROR]: 'Error'
22
- };
@@ -2,7 +2,7 @@ import { Context } from '@temporalio/activity';
2
2
  import { Storage } from '#async_storage';
3
3
  import { addEventStart, addEventEnd, addEventError } from '#tracing';
4
4
  import { headersToObject } from '../sandboxed_utils.js';
5
- import { LifecycleEventLogMessage, LifecycleEvent, METADATA_ACCESS_SYMBOL } from '#consts';
5
+ import { LifecycleEvent, METADATA_ACCESS_SYMBOL } from '#consts';
6
6
  import { activityHeartbeatEnabled, activityHeartbeatIntervalMs } from '../configs.js';
7
7
  import { createChildLogger } from '#logger';
8
8
 
@@ -37,7 +37,7 @@ export class ActivityExecutionInterceptor {
37
37
  const logContext = { workflowName, workflowId, stepId: activityId, stepName: activityType };
38
38
  const traceArguments = { kind, id: activityId, parentId: workflowId, name: activityType, executionContext };
39
39
 
40
- log.info( LifecycleEventLogMessage[LifecycleEvent.START], logContext );
40
+ log.info( `Started ${activityType} ${kind}`, { event: LifecycleEvent.START, kind, ...logContext } );
41
41
  addEventStart( { details: input.args[0], ...traceArguments } );
42
42
 
43
43
  const intervals = { heartbeat: null };
@@ -47,12 +47,14 @@ export class ActivityExecutionInterceptor {
47
47
 
48
48
  const output = await Storage.runWithContext( async _ => next( input ), { parentId: activityId, executionContext } );
49
49
 
50
- log.info( LifecycleEventLogMessage[LifecycleEvent.END], { ...logContext, durationMs: Date.now() - startDate } );
50
+ log.info( `Ended ${activityType} ${kind}`, { event: LifecycleEvent.END, kind, ...logContext, durationMs: Date.now() - startDate } );
51
51
  addEventEnd( { details: output, ...traceArguments } );
52
52
  return output;
53
53
 
54
54
  } catch ( error ) {
55
- log.error( LifecycleEventLogMessage[LifecycleEvent.ERROR], { ...logContext, durationMs: Date.now() - startDate, error: error.message } );
55
+ log.error( `Error ${activityType} ${kind}: ${error.message}`, {
56
+ event: LifecycleEvent.ERROR, kind, ...logContext, durationMs: Date.now() - startDate, error: error.message
57
+ } );
56
58
  addEventError( { details: error, ...traceArguments } );
57
59
  throw error;
58
60
 
@@ -1,4 +1,4 @@
1
- import { LifecycleEvent, LifecycleEventLogMessage, WORKFLOW_CATALOG } from '#consts';
1
+ import { LifecycleEvent, WORKFLOW_CATALOG } from '#consts';
2
2
  import { addEventStart, addEventEnd, addEventError } from '#tracing';
3
3
  import { createChildLogger } from '#logger';
4
4
 
@@ -34,11 +34,12 @@ const logWorkflowEvent = ( event, workflowInfo, error ) => {
34
34
  }
35
35
 
36
36
  if ( event === LifecycleEvent.START ) {
37
- log.info( LifecycleEventLogMessage[event], { workflowName, workflowId } );
37
+ log.info( `Started ${workflowName} workflow`, { event, workflowName, workflowId } );
38
38
  } else if ( event === LifecycleEvent.END ) {
39
- log.info( LifecycleEventLogMessage[event], { workflowName, workflowId, durationMs: Date.now() - startTime.getTime() } );
39
+ log.info( `Ended ${workflowName} workflow`, { event, workflowName, workflowId, durationMs: Date.now() - startTime.getTime() } );
40
40
  } else if ( event === LifecycleEvent.ERROR ) {
41
- log.info( LifecycleEventLogMessage[event], {
41
+ log.error( `Error ${workflowName} workflow: ${error.message}`, {
42
+ event,
42
43
  workflowName,
43
44
  workflowId,
44
45
  durationMs: Date.now() - startTime.getTime(),