@output.ai/core 0.1.8-dev.pr156.696d4dd → 0.1.8-dev.pr156.c8e7f40

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.1.8-dev.pr156.696d4dd",
3
+ "version": "0.1.8-dev.pr156.c8e7f40",
4
4
  "description": "The core module of the output framework",
5
5
  "type": "module",
6
6
  "exports": {
@@ -4,8 +4,9 @@ import buildTraceTree from '../../tools/build_trace_tree.js';
4
4
  import { EOL } from 'node:os';
5
5
 
6
6
  const oneWeekInMS = 1000 * 60 * 60 * 24 * 7;
7
- // Use local working directory for temp files, not module-relative path
8
- const tempDir = join( process.cwd(), 'logs', 'temp', 'traces' );
7
+ // Use project root (passed as argv[2]) for temp files, fallback to cwd
8
+ const projectRoot = process.argv[2] || process.cwd();
9
+ const tempDir = join( projectRoot, 'logs', 'temp', 'traces' );
9
10
 
10
11
  const accumulate = ( { entry, executionContext: { workflowId, startTime } } ) => {
11
12
  const path = join( tempDir, `${startTime}_${workflowId}.trace` );
@@ -28,22 +29,24 @@ export const init = () => {
28
29
 
29
30
  /**
30
31
  * Get the local file system path for ALL file I/O operations (read/write)
31
- * Always uses the container's local working directory
32
+ * Uses the project root path passed as argv[2], falls back to cwd
32
33
  * @param {string} workflowName - The name of the workflow
33
34
  * @returns {string} The local filesystem path for file operations
34
35
  */
35
36
  const getLocalOutputDir = workflowName => {
36
- return join( process.cwd(), 'logs', 'runs', workflowName );
37
+ const root = process.argv[2] || process.cwd();
38
+ return join( root, 'logs', 'runs', workflowName );
37
39
  };
38
40
 
39
41
  /**
40
42
  * Get the host path for reporting trace file locations to users
41
- * Uses HOST_TRACE_PATH if set (for Docker), otherwise uses local path
43
+ * Uses HOST_TRACE_PATH if set (for Docker), otherwise uses project root
42
44
  * @param {string} workflowName - The name of the workflow
43
45
  * @returns {string} The path to report to users/API
44
46
  */
45
47
  const getReportOutputDir = workflowName => {
46
- const basePath = process.env.HOST_TRACE_PATH || join( process.cwd(), 'logs' );
48
+ const root = process.argv[2] || process.cwd();
49
+ const basePath = process.env.HOST_TRACE_PATH || join( root, 'logs' );
47
50
  return join( basePath, 'runs', workflowName );
48
51
  };
49
52