@principal-ai/principal-view-core 0.24.2 → 0.24.3
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/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/registry/CompositeRegistry.d.ts +9 -2
- package/dist/registry/CompositeRegistry.d.ts.map +1 -1
- package/dist/registry/CompositeRegistry.js +10 -7
- package/dist/registry/CompositeRegistry.js.map +1 -1
- package/dist/registry/LocalRegistry.d.ts +30 -22
- package/dist/registry/LocalRegistry.d.ts.map +1 -1
- package/dist/registry/LocalRegistry.js +54 -105
- package/dist/registry/LocalRegistry.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/registry/CompositeRegistry.ts +13 -9
- package/src/registry/LocalRegistry.ts +65 -128
package/dist/index.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export type { RegisteredTrace, TraceResource, MatchedSpan, ScenarioMatch, Orphan
|
|
|
27
27
|
export { OtlpTraceParser } from './parsers/OtlpTraceParser';
|
|
28
28
|
export type { ExtractedSpan, ExtractedEvent } from './parsers/OtlpTraceParser';
|
|
29
29
|
export { RemoteRegistry } from './registry/RemoteRegistry';
|
|
30
|
-
export { LocalRegistry } from './registry/LocalRegistry';
|
|
30
|
+
export { LocalRegistry, type FileReader } from './registry/LocalRegistry';
|
|
31
31
|
export { CompositeRegistry } from './registry/CompositeRegistry';
|
|
32
32
|
export { TraceOrchestrator } from './orchestration/TraceOrchestrator';
|
|
33
33
|
export type { TraceOrchestratorConfig } from './orchestration/TraceOrchestrator';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,YAAY,EACV,kBAAkB,EAClB,SAAS,EACT,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,SA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+
import type { FileTree } from '@principal-ai/repository-abstraction';
|
|
11
12
|
import type { StoryboardRegistryInterface } from '../types/registered-trace';
|
|
12
13
|
import type { VersionSnapshot } from '../types/version-registry';
|
|
13
14
|
import type { LocalRegistry } from './LocalRegistry';
|
|
@@ -45,7 +46,7 @@ export declare class CompositeRegistry implements StoryboardRegistryInterface {
|
|
|
45
46
|
/**
|
|
46
47
|
* Register a local workspace (convenience method)
|
|
47
48
|
*/
|
|
48
|
-
registerWorkspace(scopeName: string,
|
|
49
|
+
registerWorkspace(scopeName: string, fileTree: FileTree): void;
|
|
49
50
|
/**
|
|
50
51
|
* Unregister a local workspace (convenience method)
|
|
51
52
|
*/
|
|
@@ -55,8 +56,14 @@ export declare class CompositeRegistry implements StoryboardRegistryInterface {
|
|
|
55
56
|
*/
|
|
56
57
|
getRegisteredWorkspaces(): Array<{
|
|
57
58
|
scopeName: string;
|
|
58
|
-
|
|
59
|
+
fileTreeSha: string;
|
|
59
60
|
}>;
|
|
61
|
+
/**
|
|
62
|
+
* Invalidate cache for a workspace (convenience method)
|
|
63
|
+
*
|
|
64
|
+
* Call this when .principal-views files change to trigger rebuild.
|
|
65
|
+
*/
|
|
66
|
+
invalidateCache(scopeName: string): void;
|
|
60
67
|
/**
|
|
61
68
|
* Cleanup: destroy local registry watchers
|
|
62
69
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompositeRegistry.d.ts","sourceRoot":"","sources":["../../src/registry/CompositeRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;GAEG;AACH,qBAAa,iBAAkB,YAAW,2B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AK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IAmBxE,iBAAiB,IAAI,OAAO;IAI5B;;OAEG;IACH,gBAAgB,IAAI,aAAa;IAIjC;;OAEG;IACH,iBAAiB,IAAI,cAAc;IAInC;;OAEG;IACH,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAI9D;;OAEG;IACH,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAI5C;;OAEG;IACH,uBAAuB,IAAI,KAAK,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAI5E;;;;OAIG;IACH,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAIxC;;OAEG;IACH,OAAO,IAAI,IAAI;CAGhB"}
|
|
@@ -35,11 +35,6 @@ export class CompositeRegistry {
|
|
|
35
35
|
console.log('[CompositeRegistry] Dev mode detected (dev.mode=true)');
|
|
36
36
|
return true;
|
|
37
37
|
}
|
|
38
|
-
// Check for dev workspace path
|
|
39
|
-
if (resource.attributes?.['dev.workspace.path']) {
|
|
40
|
-
console.log('[CompositeRegistry] Dev mode detected (dev.workspace.path present)');
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
38
|
// Check for dev version patterns
|
|
44
39
|
if (scope.version?.includes('-dev') ||
|
|
45
40
|
scope.version?.includes('-local') ||
|
|
@@ -81,8 +76,8 @@ export class CompositeRegistry {
|
|
|
81
76
|
/**
|
|
82
77
|
* Register a local workspace (convenience method)
|
|
83
78
|
*/
|
|
84
|
-
registerWorkspace(scopeName,
|
|
85
|
-
this.localRegistry.registerWorkspace(scopeName,
|
|
79
|
+
registerWorkspace(scopeName, fileTree) {
|
|
80
|
+
this.localRegistry.registerWorkspace(scopeName, fileTree);
|
|
86
81
|
}
|
|
87
82
|
/**
|
|
88
83
|
* Unregister a local workspace (convenience method)
|
|
@@ -96,6 +91,14 @@ export class CompositeRegistry {
|
|
|
96
91
|
getRegisteredWorkspaces() {
|
|
97
92
|
return this.localRegistry.getRegisteredWorkspaces();
|
|
98
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Invalidate cache for a workspace (convenience method)
|
|
96
|
+
*
|
|
97
|
+
* Call this when .principal-views files change to trigger rebuild.
|
|
98
|
+
*/
|
|
99
|
+
invalidateCache(scopeName) {
|
|
100
|
+
this.localRegistry.invalidateCache(scopeName);
|
|
101
|
+
}
|
|
99
102
|
/**
|
|
100
103
|
* Cleanup: destroy local registry watchers
|
|
101
104
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompositeRegistry.js","sourceRoot":"","sources":["../../src/registry/CompositeRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"CompositeRegistry.js","sourceRoot":"","sources":["../../src/registry/CompositeRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAC5B,YACU,aAA4B,EAC5B,cAA8B;QAD9B,kBAAa,GAAb,aAAa,CAAe;QAC5B,mBAAc,GAAd,cAAc,CAAgB;IACrC,CAAC;IAEJ,KAAK,CAAC,aAAa,CACjB,KAAwC,EACxC,QAAkD;QAElD,qCAAqC;QACrC,IAAI,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE;YAC5C,OAAO,CAAC,GAAG,CAAC,8CAA8C,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YACxE,OAAO,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;SAC1D;QAED,uDAAuD;QACvD,OAAO,CAAC,GAAG,CAAC,+CAA+C,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QACzE,OAAO,IAAI,CAAC,cAAc,CAAC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BAAiB,EAAE,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,gBAAgB;QACd,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,iBAAiB;QACf,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,iBAAiB,CAAC,SAAiB,EAAE,QAAkB;QACrD,IAAI,CAAC,aAAa,CAAC,iBAAiB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,mBAAmB,CAAC,SAAiB;QACnC,IAAI,CAAC,aAAa,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;IAED;;OAEG;IACH,uBAAuB;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC,uBAAuB,EAAE,CAAC;IACtD,CAAC;IAED;;;;OAIG;IACH,eAAe,CAAC,SAAiB;QAC/B,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,OAAO;QACL,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,CAAC;IAC/B,CAAC;CACF"}
|
|
@@ -1,32 +1,41 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* LocalRegistry -
|
|
2
|
+
* LocalRegistry - Browser-safe registry for local workspaces
|
|
3
3
|
*
|
|
4
4
|
* Features:
|
|
5
|
-
* -
|
|
6
|
-
* - No version registry lookups (uses
|
|
7
|
-
* -
|
|
5
|
+
* - Uses FileTree abstraction (browser-safe)
|
|
6
|
+
* - No version registry lookups (uses FileTree directly)
|
|
7
|
+
* - Cache invalidation via external triggers
|
|
8
8
|
* - Supports multiple registered workspaces
|
|
9
|
+
*
|
|
10
|
+
* Note: File watching must be handled externally by calling invalidateCache()
|
|
11
|
+
* when .principal-views files change.
|
|
9
12
|
*/
|
|
13
|
+
import type { FileTree } from '@principal-ai/repository-abstraction';
|
|
10
14
|
import type { StoryboardRegistryInterface } from '../types/registered-trace';
|
|
11
15
|
import type { VersionSnapshot } from '../types/version-registry';
|
|
16
|
+
/**
|
|
17
|
+
* File reader function type
|
|
18
|
+
*/
|
|
19
|
+
export type FileReader = (path: string) => Promise<string>;
|
|
12
20
|
/**
|
|
13
21
|
* Local registry for development mode
|
|
14
22
|
*/
|
|
15
23
|
export declare class LocalRegistry implements StoryboardRegistryInterface {
|
|
24
|
+
private fileReader;
|
|
16
25
|
private cache;
|
|
17
26
|
private workspaces;
|
|
18
|
-
private
|
|
27
|
+
private discovery;
|
|
28
|
+
constructor(fileReader: FileReader);
|
|
19
29
|
/**
|
|
20
|
-
* Register a local workspace
|
|
30
|
+
* Register a local workspace
|
|
31
|
+
*
|
|
32
|
+
* File watching should be handled externally. When .principal-views files change,
|
|
33
|
+
* call invalidateCache(scopeName) to rebuild the snapshot.
|
|
21
34
|
*
|
|
22
35
|
* @param scopeName - Scope name (e.g., "checkout-service")
|
|
23
|
-
* @param
|
|
36
|
+
* @param fileTree - FileTree for the workspace
|
|
24
37
|
*/
|
|
25
|
-
registerWorkspace(scopeName: string,
|
|
26
|
-
/**
|
|
27
|
-
* Check if file change should trigger reload
|
|
28
|
-
*/
|
|
29
|
-
private shouldReload;
|
|
38
|
+
registerWorkspace(scopeName: string, fileTree: FileTree): void;
|
|
30
39
|
/**
|
|
31
40
|
* Unregister a workspace (cleanup)
|
|
32
41
|
*/
|
|
@@ -38,17 +47,16 @@ export declare class LocalRegistry implements StoryboardRegistryInterface {
|
|
|
38
47
|
attributes?: Record<string, unknown>;
|
|
39
48
|
}): Promise<VersionSnapshot | null>;
|
|
40
49
|
/**
|
|
41
|
-
*
|
|
42
|
-
*/
|
|
43
|
-
private getWorkspacePath;
|
|
44
|
-
/**
|
|
45
|
-
* Build VersionSnapshot from local filesystem
|
|
50
|
+
* Build VersionSnapshot from FileTree using CanvasDiscovery
|
|
46
51
|
*/
|
|
47
|
-
private
|
|
52
|
+
private buildFromFileTree;
|
|
48
53
|
/**
|
|
49
|
-
* Invalidate cache for a scope
|
|
54
|
+
* Invalidate cache for a scope
|
|
55
|
+
*
|
|
56
|
+
* Call this when .principal-views files change to trigger rebuild on next lookup.
|
|
57
|
+
* Debouncing should be handled by external file watcher if needed.
|
|
50
58
|
*/
|
|
51
|
-
|
|
59
|
+
invalidateCache(scopeName: string): void;
|
|
52
60
|
listScopes(): Promise<Array<{
|
|
53
61
|
name: string;
|
|
54
62
|
versions: string[];
|
|
@@ -59,10 +67,10 @@ export declare class LocalRegistry implements StoryboardRegistryInterface {
|
|
|
59
67
|
*/
|
|
60
68
|
getRegisteredWorkspaces(): Array<{
|
|
61
69
|
scopeName: string;
|
|
62
|
-
|
|
70
|
+
fileTreeSha: string;
|
|
63
71
|
}>;
|
|
64
72
|
/**
|
|
65
|
-
* Cleanup:
|
|
73
|
+
* Cleanup: clear all state
|
|
66
74
|
*/
|
|
67
75
|
destroy(): void;
|
|
68
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalRegistry.d.ts","sourceRoot":"","sources":["../../src/registry/LocalRegistry.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"LocalRegistry.d.ts","sourceRoot":"","sources":["../../src/registry/LocalRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAGjE;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAU3D;;GAEG;AACH,qBAAa,aAAc,YAAW,2BAA2B;IAKnD,OAAO,CAAC,UAAU;IAJ9B,OAAO,CAAC,KAAK,CAAsC;IACnD,OAAO,CAAC,UAAU,CAA4C;IAC9D,OAAO,CAAC,SAAS,CAAkB;gBAEf,UAAU,EAAE,UAAU;IAI1C;;;;;;;;OAQG;IACH,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAkB9D;;OAEG;IACH,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAetC,aAAa,CACjB,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EACxC,QAAQ,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GACjD,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAuBlC;;OAEG;YACW,iBAAiB;IA2B/B;;;;;OAKG;IACH,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAKlC,UAAU,IAAI,OAAO,CAAC,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IAaxE,iBAAiB,IAAI,OAAO;IAI5B;;OAEG;IACH,uBAAuB,IAAI,KAAK,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAa5E;;OAEG;IACH,OAAO,IAAI,IAAI;CAQhB"}
|
|
@@ -1,71 +1,49 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* LocalRegistry -
|
|
2
|
+
* LocalRegistry - Browser-safe registry for local workspaces
|
|
3
3
|
*
|
|
4
4
|
* Features:
|
|
5
|
-
* -
|
|
6
|
-
* - No version registry lookups (uses
|
|
7
|
-
* -
|
|
5
|
+
* - Uses FileTree abstraction (browser-safe)
|
|
6
|
+
* - No version registry lookups (uses FileTree directly)
|
|
7
|
+
* - Cache invalidation via external triggers
|
|
8
8
|
* - Supports multiple registered workspaces
|
|
9
|
+
*
|
|
10
|
+
* Note: File watching must be handled externally by calling invalidateCache()
|
|
11
|
+
* when .principal-views files change.
|
|
9
12
|
*/
|
|
10
|
-
import {
|
|
11
|
-
import * as path from 'path';
|
|
13
|
+
import { CanvasDiscovery } from '../discovery/CanvasDiscovery';
|
|
12
14
|
/**
|
|
13
15
|
* Local registry for development mode
|
|
14
16
|
*/
|
|
15
17
|
export class LocalRegistry {
|
|
16
|
-
constructor() {
|
|
18
|
+
constructor(fileReader) {
|
|
19
|
+
this.fileReader = fileReader;
|
|
17
20
|
this.cache = new Map();
|
|
18
21
|
this.workspaces = new Map();
|
|
19
|
-
this.
|
|
22
|
+
this.discovery = new CanvasDiscovery();
|
|
20
23
|
}
|
|
21
24
|
/**
|
|
22
|
-
* Register a local workspace
|
|
25
|
+
* Register a local workspace
|
|
26
|
+
*
|
|
27
|
+
* File watching should be handled externally. When .principal-views files change,
|
|
28
|
+
* call invalidateCache(scopeName) to rebuild the snapshot.
|
|
23
29
|
*
|
|
24
30
|
* @param scopeName - Scope name (e.g., "checkout-service")
|
|
25
|
-
* @param
|
|
31
|
+
* @param fileTree - FileTree for the workspace
|
|
26
32
|
*/
|
|
27
|
-
registerWorkspace(scopeName,
|
|
33
|
+
registerWorkspace(scopeName, fileTree) {
|
|
28
34
|
// Check if already registered
|
|
29
35
|
if (this.workspaces.has(scopeName)) {
|
|
30
36
|
console.log('[LocalRegistry] Workspace already registered:', scopeName);
|
|
31
37
|
return;
|
|
32
38
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
});
|
|
42
|
-
this.workspaces.set(scopeName, {
|
|
43
|
-
scopeName,
|
|
44
|
-
workspacePath,
|
|
45
|
-
watcher,
|
|
46
|
-
});
|
|
47
|
-
console.log('[LocalRegistry] Registered workspace:', {
|
|
48
|
-
scopeName,
|
|
49
|
-
workspacePath,
|
|
50
|
-
watching: principalViewsPath,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
catch (error) {
|
|
54
|
-
console.error('[LocalRegistry] Failed to watch workspace:', error);
|
|
55
|
-
// Register without watcher (fallback)
|
|
56
|
-
this.workspaces.set(scopeName, {
|
|
57
|
-
scopeName,
|
|
58
|
-
workspacePath,
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Check if file change should trigger reload
|
|
64
|
-
*/
|
|
65
|
-
shouldReload(filename) {
|
|
66
|
-
return (filename.endsWith('.canvas') ||
|
|
67
|
-
filename.endsWith('.otel.canvas') ||
|
|
68
|
-
filename.endsWith('library.yaml'));
|
|
39
|
+
this.workspaces.set(scopeName, {
|
|
40
|
+
scopeName,
|
|
41
|
+
fileTree,
|
|
42
|
+
});
|
|
43
|
+
console.log('[LocalRegistry] Registered workspace:', {
|
|
44
|
+
scopeName,
|
|
45
|
+
fileTreeSha: fileTree.sha,
|
|
46
|
+
});
|
|
69
47
|
}
|
|
70
48
|
/**
|
|
71
49
|
* Unregister a workspace (cleanup)
|
|
@@ -75,8 +53,6 @@ export class LocalRegistry {
|
|
|
75
53
|
if (!workspace) {
|
|
76
54
|
return;
|
|
77
55
|
}
|
|
78
|
-
// Stop watching
|
|
79
|
-
workspace.watcher?.close();
|
|
80
56
|
// Clear cache
|
|
81
57
|
this.cache.delete(scopeName);
|
|
82
58
|
// Remove registration
|
|
@@ -84,8 +60,8 @@ export class LocalRegistry {
|
|
|
84
60
|
console.log('[LocalRegistry] Unregistered workspace:', scopeName);
|
|
85
61
|
}
|
|
86
62
|
async lookupByScope(scope, resource) {
|
|
87
|
-
const
|
|
88
|
-
if (!
|
|
63
|
+
const workspace = this.workspaces.get(scope.name);
|
|
64
|
+
if (!workspace) {
|
|
89
65
|
return null; // Not a registered local workspace
|
|
90
66
|
}
|
|
91
67
|
// Check cache first
|
|
@@ -94,67 +70,48 @@ export class LocalRegistry {
|
|
|
94
70
|
console.log('[LocalRegistry] Cache hit:', cacheKey);
|
|
95
71
|
return this.cache.get(cacheKey);
|
|
96
72
|
}
|
|
97
|
-
// Build VersionSnapshot from
|
|
98
|
-
console.log('[LocalRegistry] Building snapshot from
|
|
99
|
-
const snapshot = await this.
|
|
73
|
+
// Build VersionSnapshot from FileTree
|
|
74
|
+
console.log('[LocalRegistry] Building snapshot from FileTree:', scope.name);
|
|
75
|
+
const snapshot = await this.buildFromFileTree(workspace.fileTree);
|
|
100
76
|
// Cache it
|
|
101
77
|
this.cache.set(cacheKey, snapshot);
|
|
102
78
|
return snapshot;
|
|
103
79
|
}
|
|
104
80
|
/**
|
|
105
|
-
*
|
|
81
|
+
* Build VersionSnapshot from FileTree using CanvasDiscovery
|
|
106
82
|
*/
|
|
107
|
-
|
|
108
|
-
//
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
// Check for workspace path in resource attributes
|
|
114
|
-
const devWorkspace = resource.attributes?.['dev.workspace.path'];
|
|
115
|
-
if (devWorkspace) {
|
|
116
|
-
// Auto-register this workspace
|
|
117
|
-
this.registerWorkspace(scope.name, devWorkspace);
|
|
118
|
-
return devWorkspace;
|
|
119
|
-
}
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Build VersionSnapshot from local filesystem
|
|
124
|
-
*/
|
|
125
|
-
async buildFromFilesystem(workspacePath) {
|
|
126
|
-
// For now, return an empty snapshot
|
|
127
|
-
// TODO: Implement filesystem scanning to build storyboards
|
|
128
|
-
// This will be done in the next phase when we implement the full orchestrator
|
|
83
|
+
async buildFromFileTree(fileTree) {
|
|
84
|
+
// Use CanvasDiscovery to find all storyboards
|
|
85
|
+
const discoveryResult = await this.discovery.discover(fileTree, {
|
|
86
|
+
fileReader: this.fileReader,
|
|
87
|
+
includeContent: true,
|
|
88
|
+
});
|
|
129
89
|
const snapshot = {
|
|
130
90
|
repositoryUrl: 'local',
|
|
131
|
-
commitSha: 'dev',
|
|
132
|
-
storyboards:
|
|
91
|
+
commitSha: fileTree.sha || 'dev',
|
|
92
|
+
storyboards: discoveryResult.storyboards,
|
|
133
93
|
registeredAt: new Date().toISOString(),
|
|
134
94
|
metadata: {
|
|
135
95
|
environment: 'development',
|
|
136
96
|
isLocal: true,
|
|
137
97
|
},
|
|
138
98
|
};
|
|
139
|
-
console.log('[LocalRegistry] Built snapshot from:',
|
|
99
|
+
console.log('[LocalRegistry] Built snapshot from FileTree:', {
|
|
100
|
+
sha: fileTree.sha,
|
|
101
|
+
storyboards: discoveryResult.storyboards.length,
|
|
102
|
+
errors: discoveryResult.errors.length,
|
|
103
|
+
});
|
|
140
104
|
return snapshot;
|
|
141
105
|
}
|
|
142
106
|
/**
|
|
143
|
-
* Invalidate cache for a scope
|
|
107
|
+
* Invalidate cache for a scope
|
|
108
|
+
*
|
|
109
|
+
* Call this when .principal-views files change to trigger rebuild on next lookup.
|
|
110
|
+
* Debouncing should be handled by external file watcher if needed.
|
|
144
111
|
*/
|
|
145
112
|
invalidateCache(scopeName) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
if (existingTimer) {
|
|
149
|
-
clearTimeout(existingTimer);
|
|
150
|
-
}
|
|
151
|
-
// Set new timer (debounce 500ms)
|
|
152
|
-
const timer = setTimeout(() => {
|
|
153
|
-
this.cache.delete(scopeName);
|
|
154
|
-
console.log('[LocalRegistry] Cache invalidated:', scopeName);
|
|
155
|
-
this.debounceTimers.delete(scopeName);
|
|
156
|
-
}, 500);
|
|
157
|
-
this.debounceTimers.set(scopeName, timer);
|
|
113
|
+
this.cache.delete(scopeName);
|
|
114
|
+
console.log('[LocalRegistry] Cache invalidated:', scopeName);
|
|
158
115
|
}
|
|
159
116
|
async listScopes() {
|
|
160
117
|
const scopes = [];
|
|
@@ -177,28 +134,20 @@ export class LocalRegistry {
|
|
|
177
134
|
for (const workspace of this.workspaces.values()) {
|
|
178
135
|
workspaces.push({
|
|
179
136
|
scopeName: workspace.scopeName,
|
|
180
|
-
|
|
137
|
+
fileTreeSha: workspace.fileTree.sha || 'unknown',
|
|
181
138
|
});
|
|
182
139
|
}
|
|
183
140
|
return workspaces;
|
|
184
141
|
}
|
|
185
142
|
/**
|
|
186
|
-
* Cleanup:
|
|
143
|
+
* Cleanup: clear all state
|
|
187
144
|
*/
|
|
188
145
|
destroy() {
|
|
189
|
-
console.log('[LocalRegistry] Destroying and
|
|
190
|
-
// Clear all debounce timers
|
|
191
|
-
for (const timer of this.debounceTimers.values()) {
|
|
192
|
-
clearTimeout(timer);
|
|
193
|
-
}
|
|
194
|
-
this.debounceTimers.clear();
|
|
195
|
-
// Close all watchers
|
|
196
|
-
for (const workspace of this.workspaces.values()) {
|
|
197
|
-
workspace.watcher?.close();
|
|
198
|
-
}
|
|
146
|
+
console.log('[LocalRegistry] Destroying and clearing state...');
|
|
199
147
|
// Clear state
|
|
200
148
|
this.workspaces.clear();
|
|
201
149
|
this.cache.clear();
|
|
150
|
+
this.discovery.clearCache();
|
|
202
151
|
}
|
|
203
152
|
}
|
|
204
153
|
//# sourceMappingURL=LocalRegistry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalRegistry.js","sourceRoot":"","sources":["../../src/registry/LocalRegistry.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"LocalRegistry.js","sourceRoot":"","sources":["../../src/registry/LocalRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAKH,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAe/D;;GAEG;AACH,MAAM,OAAO,aAAa;IAKxB,YAAoB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;QAJlC,UAAK,GAAG,IAAI,GAAG,EAA2B,CAAC;QAC3C,eAAU,GAAG,IAAI,GAAG,EAAiC,CAAC;QAI5D,IAAI,CAAC,SAAS,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,CAAC;IAED;;;;;;;;OAQG;IACH,iBAAiB,CAAC,SAAiB,EAAE,QAAkB;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AED,KAAK,CAAC,UAAU;QACd,MAAM,MAAM,GAAgD,EAAE,CAAC;QAE/D,KAAK,MAAM,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,UAAU,EAAE;YACzC,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,SAAS;gBACf,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,4CAA4C;aAChE,CAAC,CAAC;SACJ;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,iBAAiB;QACf,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,uBAAuB;QACrB,MAAM,UAAU,GAAsD,EAAE,CAAC;QAEzE,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE;YAChD,UAAU,CAAC,IAAI,CAAC;gBACd,SAAS,EAAE,SAAS,CAAC,SAAS;gBAC9B,WAAW,EAAE,SAAS,CAAC,QAAQ,CAAC,GAAG,IAAI,SAAS;aACjD,CAAC,CAAC;SACJ;QAED,OAAO,UAAU,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,OAAO;QACL,OAAO,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;QAEhE,cAAc;QACd,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QACxB,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IAC9B,CAAC;CACF"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -137,7 +137,7 @@ export type { ExtractedSpan, ExtractedEvent } from './parsers/OtlpTraceParser';
|
|
|
137
137
|
|
|
138
138
|
// Export storyboard registries
|
|
139
139
|
export { RemoteRegistry } from './registry/RemoteRegistry';
|
|
140
|
-
export { LocalRegistry } from './registry/LocalRegistry';
|
|
140
|
+
export { LocalRegistry, type FileReader } from './registry/LocalRegistry';
|
|
141
141
|
export { CompositeRegistry } from './registry/CompositeRegistry';
|
|
142
142
|
|
|
143
143
|
// Export trace orchestrator
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* This is the main registry implementation that should be used in production.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
import type { FileTree } from '@principal-ai/repository-abstraction';
|
|
12
13
|
import type { StoryboardRegistryInterface } from '../types/registered-trace';
|
|
13
14
|
import type { VersionSnapshot } from '../types/version-registry';
|
|
14
15
|
import type { LocalRegistry } from './LocalRegistry';
|
|
@@ -51,12 +52,6 @@ export class CompositeRegistry implements StoryboardRegistryInterface {
|
|
|
51
52
|
return true;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
// Check for dev workspace path
|
|
55
|
-
if (resource.attributes?.['dev.workspace.path']) {
|
|
56
|
-
console.log('[CompositeRegistry] Dev mode detected (dev.workspace.path present)');
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
55
|
// Check for dev version patterns
|
|
61
56
|
if (
|
|
62
57
|
scope.version?.includes('-dev') ||
|
|
@@ -110,8 +105,8 @@ export class CompositeRegistry implements StoryboardRegistryInterface {
|
|
|
110
105
|
/**
|
|
111
106
|
* Register a local workspace (convenience method)
|
|
112
107
|
*/
|
|
113
|
-
registerWorkspace(scopeName: string,
|
|
114
|
-
this.localRegistry.registerWorkspace(scopeName,
|
|
108
|
+
registerWorkspace(scopeName: string, fileTree: FileTree): void {
|
|
109
|
+
this.localRegistry.registerWorkspace(scopeName, fileTree);
|
|
115
110
|
}
|
|
116
111
|
|
|
117
112
|
/**
|
|
@@ -124,10 +119,19 @@ export class CompositeRegistry implements StoryboardRegistryInterface {
|
|
|
124
119
|
/**
|
|
125
120
|
* Get list of registered local workspaces
|
|
126
121
|
*/
|
|
127
|
-
getRegisteredWorkspaces(): Array<{ scopeName: string;
|
|
122
|
+
getRegisteredWorkspaces(): Array<{ scopeName: string; fileTreeSha: string }> {
|
|
128
123
|
return this.localRegistry.getRegisteredWorkspaces();
|
|
129
124
|
}
|
|
130
125
|
|
|
126
|
+
/**
|
|
127
|
+
* Invalidate cache for a workspace (convenience method)
|
|
128
|
+
*
|
|
129
|
+
* Call this when .principal-views files change to trigger rebuild.
|
|
130
|
+
*/
|
|
131
|
+
invalidateCache(scopeName: string): void {
|
|
132
|
+
this.localRegistry.invalidateCache(scopeName);
|
|
133
|
+
}
|
|
134
|
+
|
|
131
135
|
/**
|
|
132
136
|
* Cleanup: destroy local registry watchers
|
|
133
137
|
*/
|
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* LocalRegistry -
|
|
2
|
+
* LocalRegistry - Browser-safe registry for local workspaces
|
|
3
3
|
*
|
|
4
4
|
* Features:
|
|
5
|
-
* -
|
|
6
|
-
* - No version registry lookups (uses
|
|
7
|
-
* -
|
|
5
|
+
* - Uses FileTree abstraction (browser-safe)
|
|
6
|
+
* - No version registry lookups (uses FileTree directly)
|
|
7
|
+
* - Cache invalidation via external triggers
|
|
8
8
|
* - Supports multiple registered workspaces
|
|
9
|
+
*
|
|
10
|
+
* Note: File watching must be handled externally by calling invalidateCache()
|
|
11
|
+
* when .principal-views files change.
|
|
9
12
|
*/
|
|
10
13
|
|
|
11
|
-
import {
|
|
12
|
-
import * as path from 'path';
|
|
14
|
+
import type { FileTree } from '@principal-ai/repository-abstraction';
|
|
13
15
|
import type { StoryboardRegistryInterface } from '../types/registered-trace';
|
|
14
16
|
import type { VersionSnapshot } from '../types/version-registry';
|
|
15
17
|
import { CanvasDiscovery } from '../discovery/CanvasDiscovery';
|
|
16
18
|
|
|
19
|
+
/**
|
|
20
|
+
* File reader function type
|
|
21
|
+
*/
|
|
22
|
+
export type FileReader = (path: string) => Promise<string>;
|
|
23
|
+
|
|
17
24
|
/**
|
|
18
25
|
* Workspace registration
|
|
19
26
|
*/
|
|
20
27
|
interface WorkspaceRegistration {
|
|
21
28
|
scopeName: string;
|
|
22
|
-
|
|
23
|
-
watcher?: FSWatcher;
|
|
29
|
+
fileTree: FileTree;
|
|
24
30
|
}
|
|
25
31
|
|
|
26
32
|
/**
|
|
@@ -29,66 +35,37 @@ interface WorkspaceRegistration {
|
|
|
29
35
|
export class LocalRegistry implements StoryboardRegistryInterface {
|
|
30
36
|
private cache = new Map<string, VersionSnapshot>();
|
|
31
37
|
private workspaces = new Map<string, WorkspaceRegistration>();
|
|
32
|
-
private
|
|
38
|
+
private discovery: CanvasDiscovery;
|
|
39
|
+
|
|
40
|
+
constructor(private fileReader: FileReader) {
|
|
41
|
+
this.discovery = new CanvasDiscovery();
|
|
42
|
+
}
|
|
33
43
|
|
|
34
44
|
/**
|
|
35
|
-
* Register a local workspace
|
|
45
|
+
* Register a local workspace
|
|
46
|
+
*
|
|
47
|
+
* File watching should be handled externally. When .principal-views files change,
|
|
48
|
+
* call invalidateCache(scopeName) to rebuild the snapshot.
|
|
36
49
|
*
|
|
37
50
|
* @param scopeName - Scope name (e.g., "checkout-service")
|
|
38
|
-
* @param
|
|
51
|
+
* @param fileTree - FileTree for the workspace
|
|
39
52
|
*/
|
|
40
|
-
registerWorkspace(scopeName: string,
|
|
53
|
+
registerWorkspace(scopeName: string, fileTree: FileTree): void {
|
|
41
54
|
// Check if already registered
|
|
42
55
|
if (this.workspaces.has(scopeName)) {
|
|
43
56
|
console.log('[LocalRegistry] Workspace already registered:', scopeName);
|
|
44
57
|
return;
|
|
45
58
|
}
|
|
46
59
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const watcher = watch(
|
|
52
|
-
principalViewsPath,
|
|
53
|
-
{ recursive: true },
|
|
54
|
-
(eventType, filename) => {
|
|
55
|
-
if (filename && this.shouldReload(filename)) {
|
|
56
|
-
console.log('[LocalRegistry] File changed:', filename);
|
|
57
|
-
this.invalidateCache(scopeName);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
);
|
|
60
|
+
this.workspaces.set(scopeName, {
|
|
61
|
+
scopeName,
|
|
62
|
+
fileTree,
|
|
63
|
+
});
|
|
61
64
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
console.log('[LocalRegistry] Registered workspace:', {
|
|
69
|
-
scopeName,
|
|
70
|
-
workspacePath,
|
|
71
|
-
watching: principalViewsPath,
|
|
72
|
-
});
|
|
73
|
-
} catch (error) {
|
|
74
|
-
console.error('[LocalRegistry] Failed to watch workspace:', error);
|
|
75
|
-
// Register without watcher (fallback)
|
|
76
|
-
this.workspaces.set(scopeName, {
|
|
77
|
-
scopeName,
|
|
78
|
-
workspacePath,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Check if file change should trigger reload
|
|
85
|
-
*/
|
|
86
|
-
private shouldReload(filename: string): boolean {
|
|
87
|
-
return (
|
|
88
|
-
filename.endsWith('.canvas') ||
|
|
89
|
-
filename.endsWith('.otel.canvas') ||
|
|
90
|
-
filename.endsWith('library.yaml')
|
|
91
|
-
);
|
|
65
|
+
console.log('[LocalRegistry] Registered workspace:', {
|
|
66
|
+
scopeName,
|
|
67
|
+
fileTreeSha: fileTree.sha,
|
|
68
|
+
});
|
|
92
69
|
}
|
|
93
70
|
|
|
94
71
|
/**
|
|
@@ -100,9 +77,6 @@ export class LocalRegistry implements StoryboardRegistryInterface {
|
|
|
100
77
|
return;
|
|
101
78
|
}
|
|
102
79
|
|
|
103
|
-
// Stop watching
|
|
104
|
-
workspace.watcher?.close();
|
|
105
|
-
|
|
106
80
|
// Clear cache
|
|
107
81
|
this.cache.delete(scopeName);
|
|
108
82
|
|
|
@@ -116,8 +90,8 @@ export class LocalRegistry implements StoryboardRegistryInterface {
|
|
|
116
90
|
scope: { name: string; version: string },
|
|
117
91
|
resource: { attributes?: Record<string, unknown> }
|
|
118
92
|
): Promise<VersionSnapshot | null> {
|
|
119
|
-
const
|
|
120
|
-
if (!
|
|
93
|
+
const workspace = this.workspaces.get(scope.name);
|
|
94
|
+
if (!workspace) {
|
|
121
95
|
return null; // Not a registered local workspace
|
|
122
96
|
}
|
|
123
97
|
|
|
@@ -128,9 +102,9 @@ export class LocalRegistry implements StoryboardRegistryInterface {
|
|
|
128
102
|
return this.cache.get(cacheKey)!;
|
|
129
103
|
}
|
|
130
104
|
|
|
131
|
-
// Build VersionSnapshot from
|
|
132
|
-
console.log('[LocalRegistry] Building snapshot from
|
|
133
|
-
const snapshot = await this.
|
|
105
|
+
// Build VersionSnapshot from FileTree
|
|
106
|
+
console.log('[LocalRegistry] Building snapshot from FileTree:', scope.name);
|
|
107
|
+
const snapshot = await this.buildFromFileTree(workspace.fileTree);
|
|
134
108
|
|
|
135
109
|
// Cache it
|
|
136
110
|
this.cache.set(cacheKey, snapshot);
|
|
@@ -139,41 +113,19 @@ export class LocalRegistry implements StoryboardRegistryInterface {
|
|
|
139
113
|
}
|
|
140
114
|
|
|
141
115
|
/**
|
|
142
|
-
*
|
|
116
|
+
* Build VersionSnapshot from FileTree using CanvasDiscovery
|
|
143
117
|
*/
|
|
144
|
-
private
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
if (workspace) {
|
|
151
|
-
return workspace.workspacePath;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// Check for workspace path in resource attributes
|
|
155
|
-
const devWorkspace = resource.attributes?.['dev.workspace.path'] as string;
|
|
156
|
-
if (devWorkspace) {
|
|
157
|
-
// Auto-register this workspace
|
|
158
|
-
this.registerWorkspace(scope.name, devWorkspace);
|
|
159
|
-
return devWorkspace;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return null;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Build VersionSnapshot from local filesystem
|
|
167
|
-
*/
|
|
168
|
-
private async buildFromFilesystem(workspacePath: string): Promise<VersionSnapshot> {
|
|
169
|
-
// For now, return an empty snapshot
|
|
170
|
-
// TODO: Implement filesystem scanning to build storyboards
|
|
171
|
-
// This will be done in the next phase when we implement the full orchestrator
|
|
118
|
+
private async buildFromFileTree(fileTree: FileTree): Promise<VersionSnapshot> {
|
|
119
|
+
// Use CanvasDiscovery to find all storyboards
|
|
120
|
+
const discoveryResult = await this.discovery.discover(fileTree, {
|
|
121
|
+
fileReader: this.fileReader,
|
|
122
|
+
includeContent: true,
|
|
123
|
+
});
|
|
172
124
|
|
|
173
125
|
const snapshot: VersionSnapshot = {
|
|
174
126
|
repositoryUrl: 'local',
|
|
175
|
-
commitSha: 'dev',
|
|
176
|
-
storyboards:
|
|
127
|
+
commitSha: fileTree.sha || 'dev',
|
|
128
|
+
storyboards: discoveryResult.storyboards,
|
|
177
129
|
registeredAt: new Date().toISOString(),
|
|
178
130
|
metadata: {
|
|
179
131
|
environment: 'development',
|
|
@@ -181,29 +133,24 @@ export class LocalRegistry implements StoryboardRegistryInterface {
|
|
|
181
133
|
},
|
|
182
134
|
};
|
|
183
135
|
|
|
184
|
-
console.log('[LocalRegistry] Built snapshot from:',
|
|
136
|
+
console.log('[LocalRegistry] Built snapshot from FileTree:', {
|
|
137
|
+
sha: fileTree.sha,
|
|
138
|
+
storyboards: discoveryResult.storyboards.length,
|
|
139
|
+
errors: discoveryResult.errors.length,
|
|
140
|
+
});
|
|
185
141
|
|
|
186
142
|
return snapshot;
|
|
187
143
|
}
|
|
188
144
|
|
|
189
145
|
/**
|
|
190
|
-
* Invalidate cache for a scope
|
|
146
|
+
* Invalidate cache for a scope
|
|
147
|
+
*
|
|
148
|
+
* Call this when .principal-views files change to trigger rebuild on next lookup.
|
|
149
|
+
* Debouncing should be handled by external file watcher if needed.
|
|
191
150
|
*/
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
if (existingTimer) {
|
|
196
|
-
clearTimeout(existingTimer);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// Set new timer (debounce 500ms)
|
|
200
|
-
const timer = setTimeout(() => {
|
|
201
|
-
this.cache.delete(scopeName);
|
|
202
|
-
console.log('[LocalRegistry] Cache invalidated:', scopeName);
|
|
203
|
-
this.debounceTimers.delete(scopeName);
|
|
204
|
-
}, 500);
|
|
205
|
-
|
|
206
|
-
this.debounceTimers.set(scopeName, timer);
|
|
151
|
+
invalidateCache(scopeName: string): void {
|
|
152
|
+
this.cache.delete(scopeName);
|
|
153
|
+
console.log('[LocalRegistry] Cache invalidated:', scopeName);
|
|
207
154
|
}
|
|
208
155
|
|
|
209
156
|
async listScopes(): Promise<Array<{ name: string; versions: string[] }>> {
|
|
@@ -226,13 +173,13 @@ export class LocalRegistry implements StoryboardRegistryInterface {
|
|
|
226
173
|
/**
|
|
227
174
|
* Get list of registered workspaces
|
|
228
175
|
*/
|
|
229
|
-
getRegisteredWorkspaces(): Array<{ scopeName: string;
|
|
230
|
-
const workspaces: Array<{ scopeName: string;
|
|
176
|
+
getRegisteredWorkspaces(): Array<{ scopeName: string; fileTreeSha: string }> {
|
|
177
|
+
const workspaces: Array<{ scopeName: string; fileTreeSha: string }> = [];
|
|
231
178
|
|
|
232
179
|
for (const workspace of this.workspaces.values()) {
|
|
233
180
|
workspaces.push({
|
|
234
181
|
scopeName: workspace.scopeName,
|
|
235
|
-
|
|
182
|
+
fileTreeSha: workspace.fileTree.sha || 'unknown',
|
|
236
183
|
});
|
|
237
184
|
}
|
|
238
185
|
|
|
@@ -240,24 +187,14 @@ export class LocalRegistry implements StoryboardRegistryInterface {
|
|
|
240
187
|
}
|
|
241
188
|
|
|
242
189
|
/**
|
|
243
|
-
* Cleanup:
|
|
190
|
+
* Cleanup: clear all state
|
|
244
191
|
*/
|
|
245
192
|
destroy(): void {
|
|
246
|
-
console.log('[LocalRegistry] Destroying and
|
|
247
|
-
|
|
248
|
-
// Clear all debounce timers
|
|
249
|
-
for (const timer of this.debounceTimers.values()) {
|
|
250
|
-
clearTimeout(timer);
|
|
251
|
-
}
|
|
252
|
-
this.debounceTimers.clear();
|
|
253
|
-
|
|
254
|
-
// Close all watchers
|
|
255
|
-
for (const workspace of this.workspaces.values()) {
|
|
256
|
-
workspace.watcher?.close();
|
|
257
|
-
}
|
|
193
|
+
console.log('[LocalRegistry] Destroying and clearing state...');
|
|
258
194
|
|
|
259
195
|
// Clear state
|
|
260
196
|
this.workspaces.clear();
|
|
261
197
|
this.cache.clear();
|
|
198
|
+
this.discovery.clearCache();
|
|
262
199
|
}
|
|
263
200
|
}
|