@output.ai/core 0.3.5 → 0.3.6

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.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "The core module of the output framework",
5
5
  "type": "module",
6
6
  "exports": {
@@ -6,7 +6,17 @@ const envVarSchema = z.object( {
6
6
  CATALOG_ID: z.string().regex( /^[a-z0-9_.@-]+$/i ),
7
7
  TEMPORAL_ADDRESS: z.string().default( 'localhost:7233' ),
8
8
  TEMPORAL_API_KEY: z.string().optional(),
9
- TEMPORAL_NAMESPACE: z.string().optional().default( 'default' )
9
+ TEMPORAL_NAMESPACE: z.string().optional().default( 'default' ),
10
+ // Worker concurrency — tune these via env vars to adjust for your workload.
11
+ // Each step (API, LLM, etc.) call is one activity. Lower this to reduce memory pressure.
12
+ MAX_CONCURRENT_ACTIVITY_TASKS: z.coerce.number().int().positive().default( 40 ),
13
+ // Workflows are lightweight state machines — this can be high.
14
+ MAX_CONCURRENT_WORKFLOW_TASKS: z.coerce.number().int().positive().default( 200 ),
15
+ // LRU cache for sticky workflow execution. Lower values free memory faster after surges.
16
+ MAX_CACHED_WORKFLOWS: z.coerce.number().int().positive().default( 1000 ),
17
+ // How aggressively the worker pulls tasks from Temporal.
18
+ MAX_CONCURRENT_ACTIVITY_POLLS: z.coerce.number().int().positive().default( 5 ),
19
+ MAX_CONCURRENT_WORKFLOW_POLLS: z.coerce.number().int().positive().default( 5 )
10
20
  } );
11
21
 
12
22
  const { data: envVars, error } = envVarSchema.safeParse( process.env );
@@ -17,8 +27,11 @@ if ( error ) {
17
27
  export const address = envVars.TEMPORAL_ADDRESS;
18
28
  export const apiKey = envVars.TEMPORAL_API_KEY;
19
29
  export const executionTimeout = '1m';
20
- export const maxActivities = 100;
21
- export const maxWorkflows = 100;
30
+ export const maxActivities = envVars.MAX_CONCURRENT_ACTIVITY_TASKS;
31
+ export const maxWorkflows = envVars.MAX_CONCURRENT_WORKFLOW_TASKS;
32
+ export const maxCachedWorkflows = envVars.MAX_CACHED_WORKFLOWS;
33
+ export const maxActivityPolls = envVars.MAX_CONCURRENT_ACTIVITY_POLLS;
34
+ export const maxWorkflowPolls = envVars.MAX_CONCURRENT_WORKFLOW_POLLS;
22
35
  export const namespace = envVars.TEMPORAL_NAMESPACE;
23
36
  export const taskQueue = envVars.CATALOG_ID;
24
37
  export const catalogId = envVars.CATALOG_ID;
@@ -1,7 +1,10 @@
1
1
  import { Worker, NativeConnection } from '@temporalio/worker';
2
2
  import { Client } from '@temporalio/client';
3
3
  import { WorkflowIdConflictPolicy } from '@temporalio/common';
4
- import { address, apiKey, maxActivities, maxWorkflows, namespace, taskQueue, catalogId } from './configs.js';
4
+ import {
5
+ address, apiKey, maxActivities, maxWorkflows, maxCachedWorkflows,
6
+ maxActivityPolls, maxWorkflowPolls, namespace, taskQueue, catalogId
7
+ } from './configs.js';
5
8
  import { loadActivities, loadWorkflows, createWorkflowsEntryPoint } from './loader.js';
6
9
  import { sinks } from './sinks.js';
7
10
  import { createCatalog } from './catalog_workflow/index.js';
@@ -47,6 +50,9 @@ const callerDir = process.argv[2];
47
50
  interceptors: initInterceptors( { activities } ),
48
51
  maxConcurrentWorkflowTaskExecutions: maxWorkflows,
49
52
  maxConcurrentActivityTaskExecutions: maxActivities,
53
+ maxCachedWorkflows,
54
+ maxConcurrentActivityTaskPolls: maxActivityPolls,
55
+ maxConcurrentWorkflowTaskPolls: maxWorkflowPolls,
50
56
  bundlerOptions: { webpackConfigHook }
51
57
  } );
52
58