@principal-ai/principal-view-core 0.16.0 → 0.17.1

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.
@@ -2,7 +2,7 @@
2
2
  * Unified discovery system for canvas and execution files in a package-aware way
3
3
  */
4
4
  import type { FileTree } from '@principal-ai/repository-abstraction';
5
- import type { DiscoveredCanvas, DiscoveredExecution, CanvasDiscoveryResult, DiscoveryOptions } from './types';
5
+ import type { CanvasDiscoveryResult, DiscoveryOptions } from './types';
6
6
  /**
7
7
  * Unified discovery system for canvas and execution files in a package-aware way
8
8
  *
@@ -27,7 +27,6 @@ import type { DiscoveredCanvas, DiscoveredExecution, CanvasDiscoveryResult, Disc
27
27
  */
28
28
  export declare class CanvasDiscovery {
29
29
  private static readonly CANVAS_DIR;
30
- private static readonly EXECUTIONS_DIR;
31
30
  private static readonly WORKFLOW_EXTENSION;
32
31
  private packageModule;
33
32
  private packageCache;
@@ -40,22 +39,6 @@ export declare class CanvasDiscovery {
40
39
  * @returns Discovery result with canvases, executions, storyboards, and errors
41
40
  */
42
41
  discover(fileTree: FileTree, options?: DiscoveryOptions): Promise<CanvasDiscoveryResult>;
43
- /**
44
- * Find canvas file for a given execution
45
- *
46
- * @param execution - Discovered execution
47
- * @param canvases - Array of discovered canvases (from discover())
48
- * @returns Matching canvas or null
49
- */
50
- findCanvasForExecution(execution: DiscoveredExecution, canvases: DiscoveredCanvas[]): DiscoveredCanvas | null;
51
- /**
52
- * Find execution files for a given canvas
53
- *
54
- * @param canvas - Discovered canvas
55
- * @param executions - Array of discovered executions (from discover())
56
- * @returns Array of matching executions
57
- */
58
- findExecutionsForCanvas(canvas: DiscoveredCanvas, executions: DiscoveredExecution[]): DiscoveredExecution[];
59
42
  /**
60
43
  * Clear package cache (useful when file tree changes)
61
44
  */
@@ -68,6 +51,10 @@ export declare class CanvasDiscovery {
68
51
  * Discover workflows within a storyboard folder
69
52
  */
70
53
  private discoverWorkflowsInStoryboard;
54
+ /**
55
+ * Discover execution files co-located in a workflow directory
56
+ */
57
+ private discoverExecutionsInWorkflowDir;
71
58
  /**
72
59
  * Discover packages with caching by fileTree SHA
73
60
  */
@@ -83,24 +70,14 @@ export declare class CanvasDiscovery {
83
70
  /**
84
71
  * Discover execution files in the file tree
85
72
  */
86
- private discoverExecutionFiles;
87
73
  /**
88
- * Check if path is in .principal-views directory
74
+ * Check if path is in .principal-views directory (directly, not in subdirectories)
89
75
  */
90
76
  private isInCanvasDir;
91
77
  /**
92
78
  * Parse canvas file path to extract metadata
93
79
  */
94
80
  private parseCanvasPath;
95
- /**
96
- * Check if path is in __executions__ directory
97
- */
98
- private isInExecutionsDir;
99
- /**
100
- * Parse execution file path to extract metadata
101
- * Only .otel.json files are supported
102
- */
103
- private parseExecutionPath;
104
81
  /**
105
82
  * Find package for a given path using longest-path matching
106
83
  */
@@ -114,7 +91,7 @@ export declare class CanvasDiscovery {
114
91
  */
115
92
  private compareByPackageThenName;
116
93
  /**
117
- * Detect legacy flat structures and add deprecation errors
94
+ * Detect legacy flat canvas structures and add deprecation errors
118
95
  */
119
96
  private detectLegacyStructures;
120
97
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CanvasDiscovery.d.ts","sourceRoot":"","sources":["../../src/discovery/CanvasDiscovery.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAErE,OAAO,KAAK,EACV,gBAAgB,EAEhB,mBAAmB,EAMnB,qBAAqB,EACrB,gBAAgB,EAGjB,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAsB;IACxD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAoB;IAC1D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAoB;IAE9D,OAAO,CAA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Ae;IAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAsB;IACxD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAoB;IAE9D,OAAO,CAAC,aAAa,CAAqB;IAC1C,OAAO,CAAC,YAAY,CAA0C;;IAM9D;;;;;;OAMG;IACG,QAAQ,CACZ,QAAQ,EAAE,QAAQ,EAClB,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,qBAAqB,CAAC;IAoCjC;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;OAEG;YACW,mBAAmB;IAmFjC;;OAEG;YACW,6BAA6B;IAkF3C;;OAEG;YACW,+BAA+B;IA6E7C;;OAEG;YACW,yBAAyB;IAgBvC;;OAEG;IACH,OAAO,CAAC,eAAe;IAYvB;;OAEG;YACW,mBAAmB;IAkEjC;;OAEG;IACH;;OAEG;IACH,OAAO,CAAC,aAAa;IAkBrB;;OAEG;IACH,OAAO,CAAC,eAAe;IAuBvB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAoB1B;;OAEG;IACH,OAAO,CAAC,aAAa;IAOrB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAkBhC;;OAEG;IACH,OAAO,CAAC,sBAAsB;CA0B/B"}
@@ -45,44 +45,24 @@ class CanvasDiscovery {
45
45
  const packageMap = this.buildPackageMap(packages);
46
46
  // 3. Discover canvas files
47
47
  const canvases = await this.discoverCanvasFiles(fileTree, packageMap, options, errors);
48
- // 4. Discover execution files
49
- const executions = await this.discoverExecutionFiles(fileTree, packageMap, options, errors);
50
- // 5. Discover storyboards (hierarchical organization)
51
- const storyboards = await this.discoverStoryboards(fileTree, packageMap, canvases, executions, options, errors);
52
- // 6. Detect legacy structures and add deprecation errors
53
- this.detectLegacyStructures(canvases, executions, storyboards, errors);
48
+ // 4. Discover storyboards (hierarchical organization)
49
+ // Note: Executions are discovered as part of workflows, not separately
50
+ const storyboards = await this.discoverStoryboards(fileTree, packageMap, canvases, options, errors);
51
+ // 5. Collect all executions from workflows for backward compatibility
52
+ const executions = [];
53
+ for (const storyboard of storyboards) {
54
+ for (const workflow of storyboard.workflows) {
55
+ executions.push(...workflow.executions);
56
+ }
57
+ }
58
+ // 6. Detect legacy flat canvas structures and add deprecation errors
59
+ this.detectLegacyStructures(canvases, storyboards, errors);
54
60
  // 7. Sort results
55
61
  canvases.sort(this.compareByPackageThenName);
56
62
  executions.sort(this.compareByPackageThenName);
57
63
  storyboards.sort(this.compareByPackageThenName);
58
64
  return { canvases, executions, storyboards, errors, warnings };
59
65
  }
60
- /**
61
- * Find canvas file for a given execution
62
- *
63
- * @param execution - Discovered execution
64
- * @param canvases - Array of discovered canvases (from discover())
65
- * @returns Matching canvas or null
66
- */
67
- findCanvasForExecution(execution, canvases) {
68
- // Find canvas with matching basename and scope
69
- return canvases.find(canvas => canvas.basename === execution.canvasBasename &&
70
- canvas.scope === execution.scope &&
71
- canvas.packageName === execution.packageName) || null;
72
- }
73
- /**
74
- * Find execution files for a given canvas
75
- *
76
- * @param canvas - Discovered canvas
77
- * @param executions - Array of discovered executions (from discover())
78
- * @returns Array of matching executions
79
- */
80
- findExecutionsForCanvas(canvas, executions) {
81
- // Find all executions with matching basename and scope
82
- return executions.filter(execution => execution.canvasBasename === canvas.basename &&
83
- execution.scope === canvas.scope &&
84
- execution.packageName === canvas.packageName);
85
- }
86
66
  /**
87
67
  * Clear package cache (useful when file tree changes)
88
68
  */
@@ -92,7 +72,7 @@ class CanvasDiscovery {
92
72
  /**
93
73
  * Discover storyboards (hierarchical organization of canvas + workflows + executions)
94
74
  */
95
- async discoverStoryboards(fileTree, packageMap, canvases, executions, options, errors) {
75
+ async discoverStoryboards(fileTree, packageMap, canvases, options, errors) {
96
76
  const storyboards = [];
97
77
  // Build a map of directories to check for storyboards
98
78
  const storyboardDirs = new Map();
@@ -115,8 +95,8 @@ class CanvasDiscovery {
115
95
  // For each potential storyboard directory, check if it has a canvas
116
96
  for (const [storyboardPath, storyboardNames] of storyboardDirs) {
117
97
  for (const storyboardName of storyboardNames) {
118
- // Skip __executions__ directory
119
- if (storyboardName === CanvasDiscovery.EXECUTIONS_DIR)
98
+ // Skip __executions__ directory (legacy pattern, should not exist)
99
+ if (storyboardName === '__executions__')
120
100
  continue;
121
101
  // Find canvas for this storyboard
122
102
  const storyboardCanvas = canvases.find(c => {
@@ -126,7 +106,7 @@ class CanvasDiscovery {
126
106
  if (!storyboardCanvas)
127
107
  continue;
128
108
  // This is a storyboard! Now discover workflows
129
- const workflows = await this.discoverWorkflowsInStoryboard(fileTree, storyboardPath, storyboardName, packageMap, executions, options, errors);
109
+ const workflows = await this.discoverWorkflowsInStoryboard(fileTree, storyboardPath, storyboardName, packageMap, options, errors);
130
110
  // Determine package context
131
111
  const packageInfo = this.findPackageForPath(storyboardPath, packageMap);
132
112
  // Generate unique ID
@@ -153,7 +133,7 @@ class CanvasDiscovery {
153
133
  /**
154
134
  * Discover workflows within a storyboard folder
155
135
  */
156
- async discoverWorkflowsInStoryboard(fileTree, storyboardPath, storyboardName, packageMap, executions, options, errors) {
136
+ async discoverWorkflowsInStoryboard(fileTree, storyboardPath, storyboardName, packageMap, options, errors) {
157
137
  const workflows = [];
158
138
  // Find all workflow files in this storyboard
159
139
  for (const file of fileTree.allFiles) {
@@ -176,11 +156,11 @@ class CanvasDiscovery {
176
156
  const id = packageInfo
177
157
  ? `${packageInfo.packageData.name}/${storyboardName}/${basename}`
178
158
  : `${storyboardName}/${basename}`;
179
- // Find executions for this workflow (in the same directory as workflow.json)
180
- const workflowExecutions = executions.filter(e => {
181
- const execDir = e.path.split('/').slice(0, -1).join('/');
182
- return execDir === workflowDir;
183
- });
159
+ // Discover executions co-located in the same directory as workflow.json
160
+ console.log(`[CanvasDiscovery] Discovering executions for workflow: ${path}`);
161
+ console.log(`[CanvasDiscovery] Workflow directory: ${workflowDir}`);
162
+ const workflowExecutions = await this.discoverExecutionsInWorkflowDir(fileTree, workflowDir, packageMap, options, errors);
163
+ console.log(`[CanvasDiscovery] Found ${workflowExecutions.length} executions for workflow ${basename}`);
184
164
  // Create discovered workflow
185
165
  let workflow = {
186
166
  id,
@@ -213,6 +193,69 @@ class CanvasDiscovery {
213
193
  }
214
194
  return workflows;
215
195
  }
196
+ /**
197
+ * Discover execution files co-located in a workflow directory
198
+ */
199
+ async discoverExecutionsInWorkflowDir(fileTree, workflowDir, packageMap, options, errors) {
200
+ const executions = [];
201
+ console.log(`[CanvasDiscovery] Scanning for executions in directory: ${workflowDir}`);
202
+ console.log(`[CanvasDiscovery] Total files in tree: ${fileTree.allFiles.length}`);
203
+ // Find all .otel.json files in the workflow directory
204
+ for (const file of fileTree.allFiles) {
205
+ const path = file.relativePath || file.path || '';
206
+ // Check if file is in this workflow directory
207
+ const fileDir = path.split('/').slice(0, -1).join('/');
208
+ if (fileDir !== workflowDir)
209
+ continue;
210
+ console.log(`[CanvasDiscovery] Found file in workflow dir: ${path}`);
211
+ // Check if it's an execution file (.otel.json)
212
+ if (!path.endsWith('.otel.json')) {
213
+ console.log(`[CanvasDiscovery] Skipping non-.otel.json file: ${path}`);
214
+ continue;
215
+ }
216
+ // Extract execution metadata
217
+ const filename = path.split('/').pop();
218
+ if (!filename)
219
+ continue;
220
+ const basename = filename.replace('.otel.json', '');
221
+ // Determine package context
222
+ const packageInfo = this.findPackageForPath(path, packageMap);
223
+ // Generate unique ID (workflow-scoped)
224
+ const workflowBasename = workflowDir.split('/').pop() || '';
225
+ const id = packageInfo
226
+ ? `${packageInfo.packageData.name}/${workflowBasename}/${basename}`
227
+ : `${workflowBasename}/${basename}`;
228
+ // Create discovered execution
229
+ let execution = {
230
+ id,
231
+ name: this.toDisplayName(basename),
232
+ path,
233
+ basename,
234
+ type: 'otel',
235
+ canvasBasename: basename,
236
+ packageName: packageInfo?.packageData.name,
237
+ packagePath: packageInfo?.packageData.path,
238
+ scope: packageInfo ? 'package' : 'root',
239
+ };
240
+ // Optionally load content
241
+ if (options.includeContent && options.fileReader) {
242
+ try {
243
+ const content = await options.fileReader(path);
244
+ execution = { ...execution, content: JSON.parse(content) };
245
+ }
246
+ catch (error) {
247
+ errors.push({
248
+ path,
249
+ error: `Failed to parse execution content: ${error.message}`,
250
+ });
251
+ }
252
+ }
253
+ console.log(`[CanvasDiscovery] Added execution: ${execution.id} (${path})`);
254
+ executions.push(execution);
255
+ }
256
+ console.log(`[CanvasDiscovery] Total executions found in ${workflowDir}: ${executions.length}`);
257
+ return executions;
258
+ }
216
259
  /**
217
260
  * Discover packages with caching by fileTree SHA
218
261
  */
@@ -295,54 +338,8 @@ class CanvasDiscovery {
295
338
  /**
296
339
  * Discover execution files in the file tree
297
340
  */
298
- async discoverExecutionFiles(fileTree, packageMap, options, errors) {
299
- const executions = [];
300
- for (const file of fileTree.allFiles) {
301
- const path = file.relativePath || file.path || '';
302
- // Check if in __executions__ directory
303
- if (!this.isInExecutionsDir(path))
304
- continue;
305
- // Extract execution metadata
306
- const metadata = this.parseExecutionPath(path);
307
- if (!metadata)
308
- continue;
309
- // Determine package context
310
- const packageInfo = this.findPackageForPath(path, packageMap);
311
- // Generate unique ID
312
- const id = packageInfo
313
- ? `${packageInfo.packageData.name}/${metadata.basename}`
314
- : metadata.basename;
315
- // Create discovered execution
316
- let execution = {
317
- id,
318
- name: this.toDisplayName(metadata.basename),
319
- path,
320
- basename: metadata.basename,
321
- type: metadata.type,
322
- canvasBasename: metadata.canvasBasename,
323
- packageName: packageInfo?.packageData.name,
324
- packagePath: packageInfo?.packageData.path,
325
- scope: packageInfo ? 'package' : 'root',
326
- };
327
- // Optionally load content
328
- if (options.includeContent && options.fileReader) {
329
- try {
330
- const content = await options.fileReader(path);
331
- execution = { ...execution, content: JSON.parse(content) };
332
- }
333
- catch (error) {
334
- errors.push({
335
- path,
336
- error: `Failed to parse execution content: ${error.message}`,
337
- });
338
- }
339
- }
340
- executions.push(execution);
341
- }
342
- return executions;
343
- }
344
341
  /**
345
- * Check if path is in .principal-views directory
342
+ * Check if path is in .principal-views directory (directly, not in subdirectories)
346
343
  */
347
344
  isInCanvasDir(path) {
348
345
  const parts = path.split('/');
@@ -353,8 +350,8 @@ class CanvasDiscovery {
353
350
  // Package: packages/core/.principal-views/file.canvas
354
351
  if (parts.includes(CanvasDiscovery.CANVAS_DIR)) {
355
352
  const idx = parts.indexOf(CanvasDiscovery.CANVAS_DIR);
356
- // Ensure it's not in __executions__ subdirectory
357
- return !parts.includes(CanvasDiscovery.EXECUTIONS_DIR, idx);
353
+ // Must be directly in .principal-views/, not in a subdirectory
354
+ return parts.length === idx + 2;
358
355
  }
359
356
  return false;
360
357
  }
@@ -381,40 +378,6 @@ class CanvasDiscovery {
381
378
  }
382
379
  return null;
383
380
  }
384
- /**
385
- * Check if path is in __executions__ directory
386
- */
387
- isInExecutionsDir(path) {
388
- const parts = path.split('/');
389
- // Must contain __executions__ directory
390
- if (!parts.includes(CanvasDiscovery.EXECUTIONS_DIR))
391
- return false;
392
- // Valid patterns:
393
- // 1. .principal-views/__executions__/file.otel.json
394
- // 2. packages/core/.principal-views/__executions__/file.otel.json
395
- // 3. __executions__/file.otel.json (root level)
396
- return true;
397
- }
398
- /**
399
- * Parse execution file path to extract metadata
400
- * Only .otel.json files are supported
401
- */
402
- parseExecutionPath(path) {
403
- const filename = path.split('/').pop();
404
- if (!filename)
405
- return null;
406
- // Pattern: name.otel.json
407
- const match = filename.match(/^(.+)\.otel\.json$/);
408
- if (match) {
409
- const basename = match[1];
410
- return {
411
- basename,
412
- type: 'otel',
413
- canvasBasename: basename, // Same as basename for linking
414
- };
415
- }
416
- return null;
417
- }
418
381
  /**
419
382
  * Find package for a given path using longest-path matching
420
383
  */
@@ -460,20 +423,11 @@ class CanvasDiscovery {
460
423
  return a.name.localeCompare(b.name);
461
424
  }
462
425
  /**
463
- * Detect legacy flat structures and add deprecation errors
426
+ * Detect legacy flat canvas structures and add deprecation errors
464
427
  */
465
- detectLegacyStructures(canvases, executions, storyboards, errors) {
428
+ detectLegacyStructures(canvases, storyboards, errors) {
466
429
  // Build a set of storyboard canvas IDs for quick lookup
467
430
  const storyboardCanvasIds = new Set(storyboards.map(s => s.canvas.id));
468
- // Build a set of execution IDs that are part of storyboards
469
- const storyboardExecutionIds = new Set();
470
- for (const storyboard of storyboards) {
471
- for (const workflow of storyboard.workflows) {
472
- for (const execution of workflow.executions) {
473
- storyboardExecutionIds.add(execution.id);
474
- }
475
- }
476
- }
477
431
  // Check for legacy flat canvases (not part of any storyboard)
478
432
  for (const canvas of canvases) {
479
433
  if (!storyboardCanvasIds.has(canvas.id)) {
@@ -490,22 +444,9 @@ class CanvasDiscovery {
490
444
  }
491
445
  }
492
446
  }
493
- // Check for legacy executions in __executions__/ directory
494
- for (const execution of executions) {
495
- if (!storyboardExecutionIds.has(execution.id)) {
496
- // Check if this execution is in __executions__/ directory
497
- if (execution.path.includes(`/${CanvasDiscovery.EXECUTIONS_DIR}/`)) {
498
- errors.push({
499
- path: execution.path,
500
- error: 'DEPRECATED: Legacy __executions__/ directory is no longer supported. Migrate executions to workflow folders within storyboards immediately. See migration guide at docs/MIGRATION_GUIDE.md for details.',
501
- });
502
- }
503
- }
504
- }
505
447
  }
506
448
  }
507
449
  CanvasDiscovery.CANVAS_DIR = '.principal-views';
508
- CanvasDiscovery.EXECUTIONS_DIR = '__executions__';
509
450
  CanvasDiscovery.WORKFLOW_EXTENSION = '.workflow.json';
510
451
  export { CanvasDiscovery };
511
452
  //# sourceMappingURL=CanvasDiscovery.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CanvasDiscovery.js","sourceRoot":"","sources":["../../src/discovery/CanvasDiscovery.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,kBAAkB,EAAqB,MAAM,oCAAoC,CAAC;AAgB3F;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAa,eAAe;IAQ1B;QAFQ,iBAAY,GAAgC,IAAI,GAAG,EAAE,CAAC;QAG5D,IAAI,CAAC,aAAa,GAAG,IAAI,kBAAkB,EAAE,CAAC;IACh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AAC;IAED;;OAEG;IACK,sBAAsB,CAC5B,QAA4B,EAC5B,WAAuE,EACvE,MAA8C;QAE9C,wDAAwD;QACxD,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAEvE,8DAA8D;QAC9D,KAAK,MAAM,MAAM,IAAI,QAAQ,EAAE;YAC7B,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE;gBACvC,+BAA+B;gBAC/B,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBAChE,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACnC,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;gBAE1D,oEAAoE;gBACpE,IAAI,OAAO,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,OAAO,GAAG,CAAC,EAAE;oBAClD,MAAM,CAAC,IAAI,CAAC;wBACV,IAAI,EAAE,MAAM,CAAC,IAAI;wBACjB,KAAK,EAAE,+KAA+K;qBACvL,CAAC,CAAC;iBACJ;aACF;SACF;IACH,CAAC;;AAriBuB,0BAAU,GAAG,kBAAkB,AAArB,CAAsB;AAChC,kCAAkB,GAAG,gBAAgB,AAAnB,CAAoB;SAFnD,eAAe"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principal-ai/principal-view-core",
3
- "version": "0.16.0",
3
+ "version": "0.17.1",
4
4
  "description": "Core logic and types for graph-based principal view framework",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -133,213 +133,6 @@ describe('CanvasDiscovery', () => {
133
133
  expect(result.errors.some(e => e.path === '.principal-views/bad.canvas' && e.error.includes('DEPRECATED'))).toBe(true);
134
134
  });
135
135
 
136
- test('ignores canvas files in __executions__ directory', async () => {
137
- const fileTree = createMockFileTree([
138
- '.principal-views/__executions__/should-ignore.canvas',
139
- '.principal-views/should-include.canvas',
140
- ]);
141
-
142
- const result = await discovery.discover(fileTree);
143
-
144
- expect(result.canvases).toHaveLength(1);
145
- expect(result.canvases[0].basename).toBe('should-include');
146
- });
147
- });
148
-
149
- describe('discover() - Execution Files', () => {
150
- test('discovers execution files in .principal-views/__executions__', async () => {
151
- const fileTree = createMockFileTree([
152
- '.principal-views/__executions__/test-run.otel.json',
153
- '.principal-views/__executions__/api-test.otel.json',
154
- ]);
155
-
156
- const result = await discovery.discover(fileTree);
157
-
158
- expect(result.executions).toHaveLength(2);
159
- expect(result.executions[0]).toMatchObject({
160
- id: 'api-test',
161
- type: 'otel',
162
- canvasBasename: 'api-test',
163
- scope: 'root',
164
- });
165
- expect(result.executions[1]).toMatchObject({
166
- id: 'test-run',
167
- type: 'otel',
168
- canvasBasename: 'test-run',
169
- scope: 'root',
170
- });
171
- });
172
-
173
- test('discovers execution files in packages with package prefix', async () => {
174
- const fileTree = createMockFileTree([
175
- 'packages/core/.principal-views/__executions__/auth.otel.json',
176
- 'packages/api/.principal-views/__executions__/request.otel.json',
177
- 'packages/core/package.json',
178
- 'packages/api/package.json',
179
- ]);
180
-
181
- const result = await discovery.discover(fileTree, {
182
- fileReader: async (path) => {
183
- if (path.includes('core/package.json')) {
184
- return JSON.stringify({ name: 'core' });
185
- }
186
- if (path.includes('api/package.json')) {
187
- return JSON.stringify({ name: 'api' });
188
- }
189
- return '';
190
- },
191
- });
192
-
193
- expect(result.executions).toHaveLength(2);
194
- expect(result.executions.map(e => e.id)).toEqual([
195
- 'api/request',
196
- 'core/auth',
197
- ]);
198
- });
199
-
200
- test('discovers execution files in root __executions__', async () => {
201
- const fileTree = createMockFileTree([
202
- '__executions__/integration-test.otel.json',
203
- ]);
204
-
205
- const result = await discovery.discover(fileTree);
206
-
207
- expect(result.executions).toHaveLength(1);
208
- expect(result.executions[0]).toMatchObject({
209
- id: 'integration-test',
210
- scope: 'root',
211
- });
212
- });
213
-
214
- test('only discovers .otel.json execution files', async () => {
215
- const fileTree = createMockFileTree([
216
- '__executions__/test.otel.json',
217
- '__executions__/test.execution.json',
218
- '__executions__/test.events.json',
219
- ]);
220
-
221
- const result = await discovery.discover(fileTree);
222
-
223
- // Only .otel.json files should be discovered
224
- expect(result.executions).toHaveLength(1);
225
- expect(result.executions[0]).toMatchObject({
226
- id: 'test',
227
- type: 'otel',
228
- canvasBasename: 'test',
229
- });
230
- });
231
- });
232
-
233
- describe('findCanvasForExecution()', () => {
234
- test('finds matching canvas in same scope', async () => {
235
- const fileTree = createMockFileTree([
236
- '.principal-views/test-flow.otel.canvas',
237
- '.principal-views/__executions__/test-flow.otel.json',
238
- ]);
239
-
240
- const result = await discovery.discover(fileTree);
241
- const execution = result.executions[0];
242
-
243
- const canvas = discovery.findCanvasForExecution(execution, result.canvases);
244
-
245
- expect(canvas).toBeTruthy();
246
- expect(canvas?.basename).toBe('test-flow');
247
- });
248
-
249
- test('finds matching canvas in same package', async () => {
250
- const fileTree = createMockFileTree([
251
- 'packages/core/.principal-views/auth.otel.canvas',
252
- 'packages/core/.principal-views/__executions__/auth.otel.json',
253
- 'packages/core/package.json',
254
- ]);
255
-
256
- const result = await discovery.discover(fileTree, {
257
- fileReader: async (path) => {
258
- if (path.endsWith('package.json')) {
259
- return JSON.stringify({ name: 'core' });
260
- }
261
- return '';
262
- },
263
- });
264
-
265
- const execution = result.executions[0];
266
- const canvas = discovery.findCanvasForExecution(execution, result.canvases);
267
-
268
- expect(canvas).toBeTruthy();
269
- expect(canvas?.packageName).toBe('core');
270
- });
271
-
272
- test('does not match canvas in different package', async () => {
273
- const fileTree = createMockFileTree([
274
- 'packages/core/.principal-views/auth.canvas',
275
- 'packages/api/.principal-views/__executions__/auth.otel.json',
276
- 'packages/core/package.json',
277
- 'packages/api/package.json',
278
- ]);
279
-
280
- const result = await discovery.discover(fileTree, {
281
- fileReader: async (path) => {
282
- if (path.includes('core/package.json')) {
283
- return JSON.stringify({ name: 'core' });
284
- }
285
- if (path.includes('api/package.json')) {
286
- return JSON.stringify({ name: 'api' });
287
- }
288
- return '';
289
- },
290
- });
291
-
292
- const execution = result.executions[0];
293
- const canvas = discovery.findCanvasForExecution(execution, result.canvases);
294
-
295
- // Should not find match (different packages)
296
- expect(canvas).toBeNull();
297
- });
298
- });
299
-
300
- describe('findExecutionsForCanvas()', () => {
301
- test('finds all executions for a canvas', async () => {
302
- const fileTree = createMockFileTree([
303
- '.principal-views/test-flow.otel.canvas',
304
- '.principal-views/__executions__/test-flow.otel.json',
305
- ]);
306
-
307
- const result = await discovery.discover(fileTree);
308
- const canvas = result.canvases[0];
309
-
310
- const executions = discovery.findExecutionsForCanvas(canvas, result.executions);
311
-
312
- expect(executions).toHaveLength(1);
313
- expect(executions[0].canvasBasename).toBe('test-flow');
314
- });
315
-
316
- test('only returns executions in same package', async () => {
317
- const fileTree = createMockFileTree([
318
- 'packages/core/.principal-views/auth.canvas',
319
- 'packages/core/.principal-views/__executions__/auth.otel.json',
320
- 'packages/api/.principal-views/__executions__/auth.otel.json',
321
- 'packages/core/package.json',
322
- 'packages/api/package.json',
323
- ]);
324
-
325
- const result = await discovery.discover(fileTree, {
326
- fileReader: async (path) => {
327
- if (path.includes('core/package.json')) {
328
- return JSON.stringify({ name: 'core' });
329
- }
330
- if (path.includes('api/package.json')) {
331
- return JSON.stringify({ name: 'api' });
332
- }
333
- return '';
334
- },
335
- });
336
-
337
- const canvas = result.canvases.find(c => c.packageName === 'core')!;
338
- const executions = discovery.findExecutionsForCanvas(canvas, result.executions);
339
-
340
- expect(executions).toHaveLength(1);
341
- expect(executions[0].packageName).toBe('core');
342
- });
343
136
  });
344
137
 
345
138
  describe('caching', () => {
@@ -43,7 +43,6 @@ import type {
43
43
  */
44
44
  export class CanvasDiscovery {
45
45
  private static readonly CANVAS_DIR = '.principal-views';
46
- private static readonly EXECUTIONS_DIR = '__executions__';
47
46
  private static readonly WORKFLOW_EXTENSION = '.workflow.json';
48
47
 
49
48
  private packageModule: PackageLayerModule;
@@ -76,14 +75,20 @@ export class CanvasDiscovery {
76
75
  // 3. Discover canvas files
77
76
  const canvases = await this.discoverCanvasFiles(fileTree, packageMap, options, errors);
78
77
 
79
- // 4. Discover execution files
80
- const executions = await this.discoverExecutionFiles(fileTree, packageMap, options, errors);
78
+ // 4. Discover storyboards (hierarchical organization)
79
+ // Note: Executions are discovered as part of workflows, not separately
80
+ const storyboards = await this.discoverStoryboards(fileTree, packageMap, canvases, options, errors);
81
81
 
82
- // 5. Discover storyboards (hierarchical organization)
83
- const storyboards = await this.discoverStoryboards(fileTree, packageMap, canvases, executions, options, errors);
82
+ // 5. Collect all executions from workflows for backward compatibility
83
+ const executions: (DiscoveredExecution | DiscoveredExecutionWithContent)[] = [];
84
+ for (const storyboard of storyboards) {
85
+ for (const workflow of storyboard.workflows) {
86
+ executions.push(...workflow.executions);
87
+ }
88
+ }
84
89
 
85
- // 6. Detect legacy structures and add deprecation errors
86
- this.detectLegacyStructures(canvases, executions, storyboards, errors);
90
+ // 6. Detect legacy flat canvas structures and add deprecation errors
91
+ this.detectLegacyStructures(canvases, storyboards, errors);
87
92
 
88
93
  // 7. Sort results
89
94
  canvases.sort(this.compareByPackageThenName);
@@ -93,44 +98,6 @@ export class CanvasDiscovery {
93
98
  return { canvases, executions, storyboards, errors, warnings };
94
99
  }
95
100
 
96
- /**
97
- * Find canvas file for a given execution
98
- *
99
- * @param execution - Discovered execution
100
- * @param canvases - Array of discovered canvases (from discover())
101
- * @returns Matching canvas or null
102
- */
103
- findCanvasForExecution(
104
- execution: DiscoveredExecution,
105
- canvases: DiscoveredCanvas[]
106
- ): DiscoveredCanvas | null {
107
- // Find canvas with matching basename and scope
108
- return canvases.find(canvas =>
109
- canvas.basename === execution.canvasBasename &&
110
- canvas.scope === execution.scope &&
111
- canvas.packageName === execution.packageName
112
- ) || null;
113
- }
114
-
115
- /**
116
- * Find execution files for a given canvas
117
- *
118
- * @param canvas - Discovered canvas
119
- * @param executions - Array of discovered executions (from discover())
120
- * @returns Array of matching executions
121
- */
122
- findExecutionsForCanvas(
123
- canvas: DiscoveredCanvas,
124
- executions: DiscoveredExecution[]
125
- ): DiscoveredExecution[] {
126
- // Find all executions with matching basename and scope
127
- return executions.filter(execution =>
128
- execution.canvasBasename === canvas.basename &&
129
- execution.scope === canvas.scope &&
130
- execution.packageName === canvas.packageName
131
- );
132
- }
133
-
134
101
  /**
135
102
  * Clear package cache (useful when file tree changes)
136
103
  */
@@ -145,7 +112,6 @@ export class CanvasDiscovery {
145
112
  fileTree: FileTree,
146
113
  packageMap: Map<string, PackageLayer>,
147
114
  canvases: DiscoveredCanvas[],
148
- executions: (DiscoveredExecution | DiscoveredExecutionWithContent)[],
149
115
  options: DiscoveryOptions,
150
116
  errors: Array<{ path: string; error: string }>
151
117
  ): Promise<(DiscoveredStoryboard | DiscoveredStoryboardWithContent)[]> {
@@ -176,8 +142,8 @@ export class CanvasDiscovery {
176
142
  // For each potential storyboard directory, check if it has a canvas
177
143
  for (const [storyboardPath, storyboardNames] of storyboardDirs) {
178
144
  for (const storyboardName of storyboardNames) {
179
- // Skip __executions__ directory
180
- if (storyboardName === CanvasDiscovery.EXECUTIONS_DIR) continue;
145
+ // Skip __executions__ directory (legacy pattern, should not exist)
146
+ if (storyboardName === '__executions__') continue;
181
147
 
182
148
  // Find canvas for this storyboard
183
149
  const storyboardCanvas = canvases.find(c => {
@@ -193,7 +159,6 @@ export class CanvasDiscovery {
193
159
  storyboardPath,
194
160
  storyboardName,
195
161
  packageMap,
196
- executions,
197
162
  options,
198
163
  errors
199
164
  );
@@ -234,7 +199,6 @@ export class CanvasDiscovery {
234
199
  storyboardPath: string,
235
200
  storyboardName: string,
236
201
  packageMap: Map<string, PackageLayer>,
237
- executions: (DiscoveredExecution | DiscoveredExecutionWithContent)[],
238
202
  options: DiscoveryOptions,
239
203
  errors: Array<{ path: string; error: string }>
240
204
  ): Promise<(DiscoveredWorkflow | DiscoveredWorkflowWithContent)[]> {
@@ -265,11 +229,17 @@ export class CanvasDiscovery {
265
229
  ? `${packageInfo.packageData.name}/${storyboardName}/${basename}`
266
230
  : `${storyboardName}/${basename}`;
267
231
 
268
- // Find executions for this workflow (in the same directory as workflow.json)
269
- const workflowExecutions = executions.filter(e => {
270
- const execDir = e.path.split('/').slice(0, -1).join('/');
271
- return execDir === workflowDir;
272
- });
232
+ // Discover executions co-located in the same directory as workflow.json
233
+ console.log(`[CanvasDiscovery] Discovering executions for workflow: ${path}`);
234
+ console.log(`[CanvasDiscovery] Workflow directory: ${workflowDir}`);
235
+ const workflowExecutions = await this.discoverExecutionsInWorkflowDir(
236
+ fileTree,
237
+ workflowDir,
238
+ packageMap,
239
+ options,
240
+ errors
241
+ );
242
+ console.log(`[CanvasDiscovery] Found ${workflowExecutions.length} executions for workflow ${basename}`);
273
243
 
274
244
  // Create discovered workflow
275
245
  let workflow: DiscoveredWorkflow | DiscoveredWorkflowWithContent = {
@@ -306,6 +276,86 @@ export class CanvasDiscovery {
306
276
  return workflows;
307
277
  }
308
278
 
279
+ /**
280
+ * Discover execution files co-located in a workflow directory
281
+ */
282
+ private async discoverExecutionsInWorkflowDir(
283
+ fileTree: FileTree,
284
+ workflowDir: string,
285
+ packageMap: Map<string, PackageLayer>,
286
+ options: DiscoveryOptions,
287
+ errors: Array<{ path: string; error: string }>
288
+ ): Promise<(DiscoveredExecution | DiscoveredExecutionWithContent)[]> {
289
+ const executions: (DiscoveredExecution | DiscoveredExecutionWithContent)[] = [];
290
+
291
+ console.log(`[CanvasDiscovery] Scanning for executions in directory: ${workflowDir}`);
292
+ console.log(`[CanvasDiscovery] Total files in tree: ${fileTree.allFiles.length}`);
293
+
294
+ // Find all .otel.json files in the workflow directory
295
+ for (const file of fileTree.allFiles) {
296
+ const path = file.relativePath || file.path || '';
297
+
298
+ // Check if file is in this workflow directory
299
+ const fileDir = path.split('/').slice(0, -1).join('/');
300
+ if (fileDir !== workflowDir) continue;
301
+
302
+ console.log(`[CanvasDiscovery] Found file in workflow dir: ${path}`);
303
+
304
+ // Check if it's an execution file (.otel.json)
305
+ if (!path.endsWith('.otel.json')) {
306
+ console.log(`[CanvasDiscovery] Skipping non-.otel.json file: ${path}`);
307
+ continue;
308
+ }
309
+
310
+ // Extract execution metadata
311
+ const filename = path.split('/').pop();
312
+ if (!filename) continue;
313
+
314
+ const basename = filename.replace('.otel.json', '');
315
+
316
+ // Determine package context
317
+ const packageInfo = this.findPackageForPath(path, packageMap);
318
+
319
+ // Generate unique ID (workflow-scoped)
320
+ const workflowBasename = workflowDir.split('/').pop() || '';
321
+ const id = packageInfo
322
+ ? `${packageInfo.packageData.name}/${workflowBasename}/${basename}`
323
+ : `${workflowBasename}/${basename}`;
324
+
325
+ // Create discovered execution
326
+ let execution: DiscoveredExecution | DiscoveredExecutionWithContent = {
327
+ id,
328
+ name: this.toDisplayName(basename),
329
+ path,
330
+ basename,
331
+ type: 'otel',
332
+ canvasBasename: basename, // For backward compatibility
333
+ packageName: packageInfo?.packageData.name,
334
+ packagePath: packageInfo?.packageData.path,
335
+ scope: packageInfo ? 'package' : 'root',
336
+ };
337
+
338
+ // Optionally load content
339
+ if (options.includeContent && options.fileReader) {
340
+ try {
341
+ const content = await options.fileReader(path);
342
+ execution = { ...execution, content: JSON.parse(content) } as DiscoveredExecutionWithContent;
343
+ } catch (error) {
344
+ errors.push({
345
+ path,
346
+ error: `Failed to parse execution content: ${(error as Error).message}`,
347
+ });
348
+ }
349
+ }
350
+
351
+ console.log(`[CanvasDiscovery] Added execution: ${execution.id} (${path})`);
352
+ executions.push(execution);
353
+ }
354
+
355
+ console.log(`[CanvasDiscovery] Total executions found in ${workflowDir}: ${executions.length}`);
356
+ return executions;
357
+ }
358
+
309
359
  /**
310
360
  * Discover packages with caching by fileTree SHA
311
361
  */
@@ -412,66 +462,8 @@ export class CanvasDiscovery {
412
462
  /**
413
463
  * Discover execution files in the file tree
414
464
  */
415
- private async discoverExecutionFiles(
416
- fileTree: FileTree,
417
- packageMap: Map<string, PackageLayer>,
418
- options: DiscoveryOptions,
419
- errors: Array<{ path: string; error: string }>
420
- ): Promise<(DiscoveredExecution | DiscoveredExecutionWithContent)[]> {
421
- const executions: (DiscoveredExecution | DiscoveredExecutionWithContent)[] = [];
422
-
423
- for (const file of fileTree.allFiles) {
424
- const path = file.relativePath || file.path || '';
425
-
426
- // Check if in __executions__ directory
427
- if (!this.isInExecutionsDir(path)) continue;
428
-
429
- // Extract execution metadata
430
- const metadata = this.parseExecutionPath(path);
431
- if (!metadata) continue;
432
-
433
- // Determine package context
434
- const packageInfo = this.findPackageForPath(path, packageMap);
435
-
436
- // Generate unique ID
437
- const id = packageInfo
438
- ? `${packageInfo.packageData.name}/${metadata.basename}`
439
- : metadata.basename;
440
-
441
- // Create discovered execution
442
- let execution: DiscoveredExecution | DiscoveredExecutionWithContent = {
443
- id,
444
- name: this.toDisplayName(metadata.basename),
445
- path,
446
- basename: metadata.basename,
447
- type: metadata.type,
448
- canvasBasename: metadata.canvasBasename,
449
- packageName: packageInfo?.packageData.name,
450
- packagePath: packageInfo?.packageData.path,
451
- scope: packageInfo ? 'package' : 'root',
452
- };
453
-
454
- // Optionally load content
455
- if (options.includeContent && options.fileReader) {
456
- try {
457
- const content = await options.fileReader(path);
458
- execution = { ...execution, content: JSON.parse(content) } as DiscoveredExecutionWithContent;
459
- } catch (error) {
460
- errors.push({
461
- path,
462
- error: `Failed to parse execution content: ${(error as Error).message}`,
463
- });
464
- }
465
- }
466
-
467
- executions.push(execution);
468
- }
469
-
470
- return executions;
471
- }
472
-
473
465
  /**
474
- * Check if path is in .principal-views directory
466
+ * Check if path is in .principal-views directory (directly, not in subdirectories)
475
467
  */
476
468
  private isInCanvasDir(path: string): boolean {
477
469
  const parts = path.split('/');
@@ -484,8 +476,8 @@ export class CanvasDiscovery {
484
476
  // Package: packages/core/.principal-views/file.canvas
485
477
  if (parts.includes(CanvasDiscovery.CANVAS_DIR)) {
486
478
  const idx = parts.indexOf(CanvasDiscovery.CANVAS_DIR);
487
- // Ensure it's not in __executions__ subdirectory
488
- return !parts.includes(CanvasDiscovery.EXECUTIONS_DIR, idx);
479
+ // Must be directly in .principal-views/, not in a subdirectory
480
+ return parts.length === idx + 2;
489
481
  }
490
482
 
491
483
  return false;
@@ -517,49 +509,6 @@ export class CanvasDiscovery {
517
509
  return null;
518
510
  }
519
511
 
520
- /**
521
- * Check if path is in __executions__ directory
522
- */
523
- private isInExecutionsDir(path: string): boolean {
524
- const parts = path.split('/');
525
-
526
- // Must contain __executions__ directory
527
- if (!parts.includes(CanvasDiscovery.EXECUTIONS_DIR)) return false;
528
-
529
- // Valid patterns:
530
- // 1. .principal-views/__executions__/file.otel.json
531
- // 2. packages/core/.principal-views/__executions__/file.otel.json
532
- // 3. __executions__/file.otel.json (root level)
533
-
534
- return true;
535
- }
536
-
537
- /**
538
- * Parse execution file path to extract metadata
539
- * Only .otel.json files are supported
540
- */
541
- private parseExecutionPath(path: string): {
542
- basename: string;
543
- type: ExecutionType;
544
- canvasBasename: string;
545
- } | null {
546
- const filename = path.split('/').pop();
547
- if (!filename) return null;
548
-
549
- // Pattern: name.otel.json
550
- const match = filename.match(/^(.+)\.otel\.json$/);
551
- if (match) {
552
- const basename = match[1];
553
- return {
554
- basename,
555
- type: 'otel',
556
- canvasBasename: basename, // Same as basename for linking
557
- };
558
- }
559
-
560
- return null;
561
- }
562
-
563
512
  /**
564
513
  * Find package for a given path using longest-path matching
565
514
  */
@@ -615,27 +564,16 @@ export class CanvasDiscovery {
615
564
  }
616
565
 
617
566
  /**
618
- * Detect legacy flat structures and add deprecation errors
567
+ * Detect legacy flat canvas structures and add deprecation errors
619
568
  */
620
569
  private detectLegacyStructures(
621
570
  canvases: DiscoveredCanvas[],
622
- executions: (DiscoveredExecution | DiscoveredExecutionWithContent)[],
623
571
  storyboards: (DiscoveredStoryboard | DiscoveredStoryboardWithContent)[],
624
572
  errors: Array<{ path: string; error: string }>
625
573
  ): void {
626
574
  // Build a set of storyboard canvas IDs for quick lookup
627
575
  const storyboardCanvasIds = new Set(storyboards.map(s => s.canvas.id));
628
576
 
629
- // Build a set of execution IDs that are part of storyboards
630
- const storyboardExecutionIds = new Set<string>();
631
- for (const storyboard of storyboards) {
632
- for (const workflow of storyboard.workflows) {
633
- for (const execution of workflow.executions) {
634
- storyboardExecutionIds.add(execution.id);
635
- }
636
- }
637
- }
638
-
639
577
  // Check for legacy flat canvases (not part of any storyboard)
640
578
  for (const canvas of canvases) {
641
579
  if (!storyboardCanvasIds.has(canvas.id)) {
@@ -653,18 +591,5 @@ export class CanvasDiscovery {
653
591
  }
654
592
  }
655
593
  }
656
-
657
- // Check for legacy executions in __executions__/ directory
658
- for (const execution of executions) {
659
- if (!storyboardExecutionIds.has(execution.id)) {
660
- // Check if this execution is in __executions__/ directory
661
- if (execution.path.includes(`/${CanvasDiscovery.EXECUTIONS_DIR}/`)) {
662
- errors.push({
663
- path: execution.path,
664
- error: 'DEPRECATED: Legacy __executions__/ directory is no longer supported. Migrate executions to workflow folders within storyboards immediately. See migration guide at docs/MIGRATION_GUIDE.md for details.',
665
- });
666
- }
667
- }
668
- }
669
594
  }
670
595
  }