@principal-ai/principal-view-core 0.22.0 → 0.22.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.
package/dist/index.d.ts CHANGED
@@ -24,6 +24,8 @@ export { selectScenario, matchesCondition, hasEventMatching, computeAggregates,
24
24
  export type { WorkflowTemplate, WorkflowScenario, WorkflowMode, ScenarioCondition, ScenarioTemplate, Assertion, FlowDirective, LogTemplates, FormattingOptions, OtelEvent, OtelSignal, WorkflowContext, WorkflowResult, ScenarioMatchResult, SpanTreeNode, } from './workflow/types';
25
25
  export type { OtelExportTraceServiceRequest, OtelResourceSpansData, OtelScopeSpans, OtelSpanData, OtelResourceData, OtelKeyValue, OtelAnyValue, OtelSpanEvent, OtelLink, OtelSpanStatus, OtelInstrumentationScope, TraceInfo, WorkflowMatchInfo, OtelAttributes, OtelAttributeValue, OtelLog, OtelSpan, OtelResource, OtelSeverity, OtelSeverityText, OtelSeverityNumber, } from './types/otel';
26
26
  export { getAttributeStringValue, findAttribute, getAttributeValue, flattenResourceAttributes, parseNanoTime, getSpanDuration, isErrorSeverity, isWarnSeverity, } from './types/otel';
27
+ export type { VersionIdentifier, VersionSnapshot, RegisterVersionRequest, GetVersionResponse, VersionRegistry, } from './types/version-registry';
28
+ export { InMemoryVersionRegistry, createInMemoryVersionRegistry } from './registry/VersionRegistry';
27
29
  export { groupSpansByTrace } from './utils/traceAggregation';
28
30
  export { SpanMatcher } from './matchers/SpanMatcher';
29
31
  export type { SpanMatchResult } from './matchers/SpanMatcher';
@@ -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,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ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EACL,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,EACtB,6BAA6B,EAC7B,aAAa,GACd,MAAM,cAAc,CAAC;AAGtB,YAAY,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC"}
package/dist/index.js CHANGED
@@ -22,6 +22,7 @@ export { parseTemplate, ParsedTemplate } from './workflow/template-parser';
22
22
  export { selectScenario, matchesCondition, hasEventMatching, computeAggregates, evaluateAssertion, getNestedValue, setNestedValue, } from './workflow/scenario-matcher';
23
23
  // Export OTEL helper functions
24
24
  export { getAttributeStringValue, findAttribute, getAttributeValue, flattenResourceAttributes, parseNanoTime, getSpanDuration, isErrorSeverity, isWarnSeverity, } from './types/otel';
25
+ export { InMemoryVersionRegistry, createInMemoryVersionRegistry } from './registry/VersionRegistry';
25
26
  // Export trace aggregation utilities
26
27
  export { groupSpansByTrace } from './utils/traceAggregation';
27
28
  // Export span matcher
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAkCH,mFAAmF;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,oCAAoC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,2CAA2C;AAC3C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAGtF,iDAAiD;AACjD,mEAAmE;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE3E,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB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AACvE,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAO9F,gFAAgF;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAOvD,gEAAgE;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAGpE,oEAAoE;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAYlD,+CAA+C;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAqB9D,uFAAuF;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAI5D,+EAA+E;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAehE,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,EACtB,6BAA6B,EAC7B,aAAa,GACd,MAAM,cAAc,CAAC;AAItB,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAEjF,4FAA4F;AAC5F,mFAAmF;AACnF,EAAE;AACF,kFAAkF;AAClF,mDAAmD;AACnD,oDAAoD;AACpD,+DAA+D;AAC/D,0FAA0F;AAC1F,uDAAuD;AACvD,8CAA8C;AAC9C,qEAAqE;AACrE,gEAAgE;AAChE,EAAE;AACF,wGAAwG;AACxG,sGAAsG;AACtG,sEAAsE;AACtE,uEAAuE"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * In-Memory Version Registry Implementation
3
+ *
4
+ * This is a simple in-memory implementation of the VersionRegistry interface,
5
+ * useful for testing and development. For production use, implement a persistent
6
+ * backend (database, S3, etc.).
7
+ */
8
+ import type { VersionRegistry, RegisterVersionRequest, GetVersionResponse, VersionIdentifier } from '../types/version-registry';
9
+ /**
10
+ * In-memory version registry for testing and development
11
+ */
12
+ export declare class InMemoryVersionRegistry implements VersionRegistry {
13
+ private versions;
14
+ /**
15
+ * Create a unique key for a version
16
+ */
17
+ private getKey;
18
+ /**
19
+ * Register a new version snapshot
20
+ */
21
+ register(request: RegisterVersionRequest): Promise<void>;
22
+ /**
23
+ * Get a version snapshot by repository URL and commit SHA
24
+ */
25
+ get(repositoryUrl: string, commitSha: string): Promise<GetVersionResponse>;
26
+ /**
27
+ * Check if a version exists in the registry
28
+ */
29
+ exists(repositoryUrl: string, commitSha: string): Promise<boolean>;
30
+ /**
31
+ * Delete a version from the registry
32
+ */
33
+ delete(repositoryUrl: string, commitSha: string): Promise<void>;
34
+ /**
35
+ * List all versions for a repository
36
+ */
37
+ listVersions(repositoryUrl: string): Promise<VersionIdentifier[]>;
38
+ /**
39
+ * Clear all versions (for testing)
40
+ */
41
+ clear(): void;
42
+ /**
43
+ * Get the number of versions in the registry (for testing)
44
+ */
45
+ get size(): number;
46
+ }
47
+ /**
48
+ * Create a new in-memory version registry
49
+ */
50
+ export declare function createInMemoryVersionRegistry(): InMemoryVersionRegistry;
51
+ //# sourceMappingURL=VersionRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VersionRegistry.d.ts","sourceRoot":"","sources":["../../src/registry/VersionRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,eAAe,EAEf,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAEnC;;GAEG;AACH,qBAAa,uBAAwB,YAAW,eAAe;IAC7D,OAAO,CAAC,QAAQ,CAA2C;IAE3D;;OAEG;IACH,OAAO,CAAC,MAAM;IAId;;OAEG;IACG,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAc9D;;OAEG;IACG,GAAG,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAiBhF;;OAEG;IACG,MAAM,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKxE;;OAEG;IACG,MAAM,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKrE;;OAEG;IACG,YAAY,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAevE;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF;AAED;;GAEG;AACH,wBAAgB,6BAA6B,IAAI,uBAAuB,CAEvE"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * In-Memory Version Registry Implementation
3
+ *
4
+ * This is a simple in-memory implementation of the VersionRegistry interface,
5
+ * useful for testing and development. For production use, implement a persistent
6
+ * backend (database, S3, etc.).
7
+ */
8
+ /**
9
+ * In-memory version registry for testing and development
10
+ */
11
+ export class InMemoryVersionRegistry {
12
+ constructor() {
13
+ this.versions = new Map();
14
+ }
15
+ /**
16
+ * Create a unique key for a version
17
+ */
18
+ getKey(repositoryUrl, commitSha) {
19
+ return `${repositoryUrl}@${commitSha}`;
20
+ }
21
+ /**
22
+ * Register a new version snapshot
23
+ */
24
+ async register(request) {
25
+ const key = this.getKey(request.repositoryUrl, request.commitSha);
26
+ const snapshot = {
27
+ repositoryUrl: request.repositoryUrl,
28
+ commitSha: request.commitSha,
29
+ storyboards: request.storyboards,
30
+ registeredAt: new Date().toISOString(),
31
+ metadata: request.metadata,
32
+ };
33
+ this.versions.set(key, snapshot);
34
+ }
35
+ /**
36
+ * Get a version snapshot by repository URL and commit SHA
37
+ */
38
+ async get(repositoryUrl, commitSha) {
39
+ const key = this.getKey(repositoryUrl, commitSha);
40
+ const snapshot = this.versions.get(key);
41
+ if (!snapshot) {
42
+ return {
43
+ found: false,
44
+ error: `Version not found: ${repositoryUrl}@${commitSha}`,
45
+ };
46
+ }
47
+ return {
48
+ found: true,
49
+ snapshot,
50
+ };
51
+ }
52
+ /**
53
+ * Check if a version exists in the registry
54
+ */
55
+ async exists(repositoryUrl, commitSha) {
56
+ const key = this.getKey(repositoryUrl, commitSha);
57
+ return this.versions.has(key);
58
+ }
59
+ /**
60
+ * Delete a version from the registry
61
+ */
62
+ async delete(repositoryUrl, commitSha) {
63
+ const key = this.getKey(repositoryUrl, commitSha);
64
+ this.versions.delete(key);
65
+ }
66
+ /**
67
+ * List all versions for a repository
68
+ */
69
+ async listVersions(repositoryUrl) {
70
+ const versions = [];
71
+ for (const [key, snapshot] of this.versions.entries()) {
72
+ if (snapshot.repositoryUrl === repositoryUrl) {
73
+ versions.push({
74
+ repositoryUrl: snapshot.repositoryUrl,
75
+ commitSha: snapshot.commitSha,
76
+ });
77
+ }
78
+ }
79
+ return versions.sort((a, b) => a.commitSha.localeCompare(b.commitSha));
80
+ }
81
+ /**
82
+ * Clear all versions (for testing)
83
+ */
84
+ clear() {
85
+ this.versions.clear();
86
+ }
87
+ /**
88
+ * Get the number of versions in the registry (for testing)
89
+ */
90
+ get size() {
91
+ return this.versions.size;
92
+ }
93
+ }
94
+ /**
95
+ * Create a new in-memory version registry
96
+ */
97
+ export function createInMemoryVersionRegistry() {
98
+ return new InMemoryVersionRegistry();
99
+ }
100
+ //# sourceMappingURL=VersionRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VersionRegistry.js","sourceRoot":"","sources":["../../src/registry/VersionRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAUH;;GAEG;AACH,MAAM,OAAO,uBAAuB;IAApC;QACU,aAAQ,GAAiC,IAAI,GAAG,EAAE,CAAC;IA6F7D,CAAC;IA3FC;;OAEG;IACK,MAAM,CAAC,aAAqB,EAAE,SAAiB;QACrD,OAAO,GAAG,aAAa,IAAI,SAAS,EAAE,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ,C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,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY,CAAC,aAAqB;QACtC,MAAM,QAAQ,GAAwB,EAAE,CAAC;QAEzC,KAAK,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE;YACrD,IAAI,QAAQ,CAAC,aAAa,KAAK,aAAa,EAAE;gBAC5C,QAAQ,CAAC,IAAI,CAAC;oBACZ,aAAa,EAAE,QAAQ,CAAC,aAAa;oBACrC,SAAS,EAAE,QAAQ,CAAC,SAAS;iBAC9B,CAAC,CAAC;aACJ;SACF;QAED,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IACzE,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC5B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,6BAA6B;IAC3C,OAAO,IAAI,uBAAuB,EAAE,CAAC;AACvC,CAAC"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Version Registry Types
3
+ *
4
+ * Defines the data structures for storing and retrieving versioned storyboard snapshots.
5
+ * The version registry indexes storyboards by repository URL and commit SHA, allowing
6
+ * traces to reference the exact workflow definitions that were active at the time of execution.
7
+ */
8
+ import type { DiscoveredStoryboard } from '../discovery/types';
9
+ /**
10
+ * Version identifier combining repository URL and commit SHA
11
+ */
12
+ export interface VersionIdentifier {
13
+ /** Git repository URL (e.g., "https://github.com/org/repo") */
14
+ repositoryUrl: string;
15
+ /** Git commit SHA (full 40-character hash) */
16
+ commitSha: string;
17
+ }
18
+ /**
19
+ * Complete snapshot of storyboards at a specific version
20
+ *
21
+ * This should be stored in the version registry when a version is built/deployed,
22
+ * and retrieved when processing traces that reference this version.
23
+ */
24
+ export interface VersionSnapshot extends VersionIdentifier {
25
+ /**
26
+ * Complete storyboard definitions as discovered from the codebase at this version.
27
+ * Includes all metadata: canvas info, workflow paths, package names, etc.
28
+ */
29
+ storyboards: DiscoveredStoryboard[];
30
+ /** When this version was registered */
31
+ registeredAt?: string;
32
+ /** Optional metadata about the build/deployment */
33
+ metadata?: {
34
+ /** Build/deployment environment (e.g., "production", "staging") */
35
+ environment?: string;
36
+ /** Branch name */
37
+ branch?: string;
38
+ /** Git tag if applicable */
39
+ tag?: string;
40
+ /** Additional custom metadata */
41
+ [key: string]: unknown;
42
+ };
43
+ }
44
+ /**
45
+ * Request to register a new version in the registry
46
+ */
47
+ export interface RegisterVersionRequest {
48
+ /** Repository URL */
49
+ repositoryUrl: string;
50
+ /** Commit SHA */
51
+ commitSha: string;
52
+ /** Discovered storyboards from this version */
53
+ storyboards: DiscoveredStoryboard[];
54
+ /** Optional metadata */
55
+ metadata?: VersionSnapshot['metadata'];
56
+ }
57
+ /**
58
+ * Response from querying the version registry
59
+ */
60
+ export interface GetVersionResponse {
61
+ /** Whether the version was found */
62
+ found: boolean;
63
+ /** Version snapshot if found */
64
+ snapshot?: VersionSnapshot;
65
+ /** Error message if not found or error occurred */
66
+ error?: string;
67
+ }
68
+ /**
69
+ * Version registry interface
70
+ *
71
+ * Implementations might use:
72
+ * - A database (PostgreSQL, MongoDB, etc.)
73
+ * - A key-value store (Redis, DynamoDB)
74
+ * - A file-based registry (S3, local filesystem)
75
+ * - An in-memory cache for testing
76
+ */
77
+ export interface VersionRegistry {
78
+ /**
79
+ * Register a new version snapshot
80
+ * @param request - Version registration request
81
+ * @returns Promise that resolves when registered
82
+ */
83
+ register(request: RegisterVersionRequest): Promise<void>;
84
+ /**
85
+ * Get a version snapshot by repository URL and commit SHA
86
+ * @param repositoryUrl - Repository URL
87
+ * @param commitSha - Commit SHA
88
+ * @returns Promise with version snapshot if found
89
+ */
90
+ get(repositoryUrl: string, commitSha: string): Promise<GetVersionResponse>;
91
+ /**
92
+ * Check if a version exists in the registry
93
+ * @param repositoryUrl - Repository URL
94
+ * @param commitSha - Commit SHA
95
+ * @returns Promise with boolean indicating if version exists
96
+ */
97
+ exists(repositoryUrl: string, commitSha: string): Promise<boolean>;
98
+ /**
99
+ * Delete a version from the registry (for cleanup)
100
+ * @param repositoryUrl - Repository URL
101
+ * @param commitSha - Commit SHA
102
+ * @returns Promise that resolves when deleted
103
+ */
104
+ delete?(repositoryUrl: string, commitSha: string): Promise<void>;
105
+ /**
106
+ * List all versions for a repository (optional, for debugging/admin)
107
+ * @param repositoryUrl - Repository URL
108
+ * @returns Promise with array of version identifiers
109
+ */
110
+ listVersions?(repositoryUrl: string): Promise<VersionIdentifier[]>;
111
+ }
112
+ //# sourceMappingURL=version-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version-registry.d.ts","sourceRoot":"","sources":["../../src/types/version-registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,+DAA+D;IAC/D,aAAa,EAAE,MAAM,CAAC;IACtB,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD;;;OAGG;IACH,WAAW,EAAE,oBAAoB,EAAE,CAAC;IAEpC,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,mDAAmD;IACnD,QAAQ,CAAC,EAAE;QACT,mEAAmE;QACnE,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,kBAAkB;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,4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rieving versioned storyboard snapshots.
5
+ * The version registry indexes storyboards by repository URL and commit SHA, allowing
6
+ * traces to reference the exact workflow definitions that were active at the time of execution.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=version-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version-registry.js","sourceRoot":"","sources":["../../src/types/version-registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@principal-ai/principal-view-core",
3
- "version": "0.22.0",
3
+ "version": "0.22.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",
@@ -42,6 +42,7 @@
42
42
  "@opentelemetry/sdk-trace-base": "2.2.0",
43
43
  "@opentelemetry/semantic-conventions": "1.38.0",
44
44
  "@principal-ai/codebase-composition": "^0.2.43",
45
+ "@principal-ai/principal-view-core": "^0.22.0",
45
46
  "@principal-ai/repository-abstraction": "^0.5.3",
46
47
  "date-fns": "3.0.0",
47
48
  "handlebars": "^4.7.8",
package/src/index.ts CHANGED
@@ -126,6 +126,16 @@ export {
126
126
  isWarnSeverity,
127
127
  } from './types/otel';
128
128
 
129
+ // Export version registry types and implementation
130
+ export type {
131
+ VersionIdentifier,
132
+ VersionSnapshot,
133
+ RegisterVersionRequest,
134
+ GetVersionResponse,
135
+ VersionRegistry,
136
+ } from './types/version-registry';
137
+ export { InMemoryVersionRegistry, createInMemoryVersionRegistry } from './registry/VersionRegistry';
138
+
129
139
  // Export trace aggregation utilities
130
140
  export { groupSpansByTrace } from './utils/traceAggregation';
131
141
 
@@ -0,0 +1,223 @@
1
+ /**
2
+ * Tests for InMemoryVersionRegistry
3
+ */
4
+
5
+ import { describe, it, expect, beforeEach } from 'vitest';
6
+ import { InMemoryVersionRegistry, createInMemoryVersionRegistry } from './VersionRegistry';
7
+ import type { RegisterVersionRequest } from '../types/version-registry';
8
+
9
+ describe('InMemoryVersionRegistry', () => {
10
+ let registry: InMemoryVersionRegistry;
11
+
12
+ beforeEach(() => {
13
+ registry = createInMemoryVersionRegistry();
14
+ });
15
+
16
+ describe('register', () => {
17
+ it('should register a new version', async () => {
18
+ const request: RegisterVersionRequest = {
19
+ repositoryUrl: 'https://github.com/test/repo',
20
+ commitSha: 'abc123',
21
+ storyboards: [
22
+ {
23
+ id: 'test-storyboard',
24
+ name: 'Test Storyboard',
25
+ path: '.principal-views/test.otel.canvas',
26
+ basename: 'test',
27
+ scope: 'root',
28
+ canvas: {
29
+ id: 'test',
30
+ name: 'Test',
31
+ path: '.principal-views/test.otel.canvas',
32
+ basename: 'test',
33
+ type: 'otel',
34
+ scope: 'root',
35
+ },
36
+ workflows: [],
37
+ },
38
+ ],
39
+ };
40
+
41
+ await registry.register(request);
42
+
43
+ const response = await registry.get('https://github.com/test/repo', 'abc123');
44
+ expect(response.found).toBe(true);
45
+ expect(response.snapshot).toBeDefined();
46
+ expect(response.snapshot?.repositoryUrl).toBe('https://github.com/test/repo');
47
+ expect(response.snapshot?.commitSha).toBe('abc123');
48
+ expect(response.snapshot?.storyboards).toHaveLength(1);
49
+ expect(response.snapshot?.registeredAt).toBeDefined();
50
+ });
51
+
52
+ it('should overwrite existing version with same repository and commit', async () => {
53
+ const request1: RegisterVersionRequest = {
54
+ repositoryUrl: 'https://github.com/test/repo',
55
+ commitSha: 'abc123',
56
+ storyboards: [],
57
+ };
58
+
59
+ const request2: RegisterVersionRequest = {
60
+ repositoryUrl: 'https://github.com/test/repo',
61
+ commitSha: 'abc123',
62
+ storyboards: [
63
+ {
64
+ id: 'new-storyboard',
65
+ name: 'New Storyboard',
66
+ path: '.principal-views/new.otel.canvas',
67
+ basename: 'new',
68
+ scope: 'root',
69
+ canvas: {
70
+ id: 'new',
71
+ name: 'New',
72
+ path: '.principal-views/new.otel.canvas',
73
+ basename: 'new',
74
+ type: 'otel',
75
+ scope: 'root',
76
+ },
77
+ workflows: [],
78
+ },
79
+ ],
80
+ };
81
+
82
+ await registry.register(request1);
83
+ await registry.register(request2);
84
+
85
+ const response = await registry.get('https://github.com/test/repo', 'abc123');
86
+ expect(response.found).toBe(true);
87
+ expect(response.snapshot?.storyboards).toHaveLength(1);
88
+ expect(response.snapshot?.storyboards[0].id).toBe('new-storyboard');
89
+ });
90
+ });
91
+
92
+ describe('get', () => {
93
+ it('should return found=false when version does not exist', async () => {
94
+ const response = await registry.get('https://github.com/test/repo', 'nonexistent');
95
+ expect(response.found).toBe(false);
96
+ expect(response.snapshot).toBeUndefined();
97
+ expect(response.error).toBeDefined();
98
+ });
99
+
100
+ it('should return found=true when version exists', async () => {
101
+ const request: RegisterVersionRequest = {
102
+ repositoryUrl: 'https://github.com/test/repo',
103
+ commitSha: 'abc123',
104
+ storyboards: [],
105
+ };
106
+
107
+ await registry.register(request);
108
+
109
+ const response = await registry.get('https://github.com/test/repo', 'abc123');
110
+ expect(response.found).toBe(true);
111
+ expect(response.snapshot).toBeDefined();
112
+ });
113
+ });
114
+
115
+ describe('exists', () => {
116
+ it('should return false when version does not exist', async () => {
117
+ const exists = await registry.exists('https://github.com/test/repo', 'nonexistent');
118
+ expect(exists).toBe(false);
119
+ });
120
+
121
+ it('should return true when version exists', async () => {
122
+ const request: RegisterVersionRequest = {
123
+ repositoryUrl: 'https://github.com/test/repo',
124
+ commitSha: 'abc123',
125
+ storyboards: [],
126
+ };
127
+
128
+ await registry.register(request);
129
+
130
+ const exists = await registry.exists('https://github.com/test/repo', 'abc123');
131
+ expect(exists).toBe(true);
132
+ });
133
+ });
134
+
135
+ describe('delete', () => {
136
+ it('should delete a version', async () => {
137
+ const request: RegisterVersionRequest = {
138
+ repositoryUrl: 'https://github.com/test/repo',
139
+ commitSha: 'abc123',
140
+ storyboards: [],
141
+ };
142
+
143
+ await registry.register(request);
144
+ expect(await registry.exists('https://github.com/test/repo', 'abc123')).toBe(true);
145
+
146
+ await registry.delete('https://github.com/test/repo', 'abc123');
147
+ expect(await registry.exists('https://github.com/test/repo', 'abc123')).toBe(false);
148
+ });
149
+
150
+ it('should not throw when deleting non-existent version', async () => {
151
+ await expect(
152
+ registry.delete('https://github.com/test/repo', 'nonexistent')
153
+ ).resolves.toBeUndefined();
154
+ });
155
+ });
156
+
157
+ describe('listVersions', () => {
158
+ it('should return empty array when no versions exist', async () => {
159
+ const versions = await registry.listVersions('https://github.com/test/repo');
160
+ expect(versions).toEqual([]);
161
+ });
162
+
163
+ it('should return all versions for a repository', async () => {
164
+ await registry.register({
165
+ repositoryUrl: 'https://github.com/test/repo',
166
+ commitSha: 'abc123',
167
+ storyboards: [],
168
+ });
169
+
170
+ await registry.register({
171
+ repositoryUrl: 'https://github.com/test/repo',
172
+ commitSha: 'def456',
173
+ storyboards: [],
174
+ });
175
+
176
+ await registry.register({
177
+ repositoryUrl: 'https://github.com/other/repo',
178
+ commitSha: 'xyz789',
179
+ storyboards: [],
180
+ });
181
+
182
+ const versions = await registry.listVersions('https://github.com/test/repo');
183
+ expect(versions).toHaveLength(2);
184
+ expect(versions[0].commitSha).toBe('abc123');
185
+ expect(versions[1].commitSha).toBe('def456');
186
+ });
187
+
188
+ it('should return sorted versions', async () => {
189
+ await registry.register({
190
+ repositoryUrl: 'https://github.com/test/repo',
191
+ commitSha: 'zzz',
192
+ storyboards: [],
193
+ });
194
+
195
+ await registry.register({
196
+ repositoryUrl: 'https://github.com/test/repo',
197
+ commitSha: 'aaa',
198
+ storyboards: [],
199
+ });
200
+
201
+ const versions = await registry.listVersions('https://github.com/test/repo');
202
+ expect(versions[0].commitSha).toBe('aaa');
203
+ expect(versions[1].commitSha).toBe('zzz');
204
+ });
205
+ });
206
+
207
+ describe('clear', () => {
208
+ it('should clear all versions', async () => {
209
+ await registry.register({
210
+ repositoryUrl: 'https://github.com/test/repo',
211
+ commitSha: 'abc123',
212
+ storyboards: [],
213
+ });
214
+
215
+ expect(registry.size).toBe(1);
216
+
217
+ registry.clear();
218
+
219
+ expect(registry.size).toBe(0);
220
+ expect(await registry.exists('https://github.com/test/repo', 'abc123')).toBe(false);
221
+ });
222
+ });
223
+ });
@@ -0,0 +1,121 @@
1
+ /**
2
+ * In-Memory Version Registry Implementation
3
+ *
4
+ * This is a simple in-memory implementation of the VersionRegistry interface,
5
+ * useful for testing and development. For production use, implement a persistent
6
+ * backend (database, S3, etc.).
7
+ */
8
+
9
+ import type {
10
+ VersionRegistry,
11
+ VersionSnapshot,
12
+ RegisterVersionRequest,
13
+ GetVersionResponse,
14
+ VersionIdentifier,
15
+ } from '../types/version-registry';
16
+
17
+ /**
18
+ * In-memory version registry for testing and development
19
+ */
20
+ export class InMemoryVersionRegistry implements VersionRegistry {
21
+ private versions: Map<string, VersionSnapshot> = new Map();
22
+
23
+ /**
24
+ * Create a unique key for a version
25
+ */
26
+ private getKey(repositoryUrl: string, commitSha: string): string {
27
+ return `${repositoryUrl}@${commitSha}`;
28
+ }
29
+
30
+ /**
31
+ * Register a new version snapshot
32
+ */
33
+ async register(request: RegisterVersionRequest): Promise<void> {
34
+ const key = this.getKey(request.repositoryUrl, request.commitSha);
35
+
36
+ const snapshot: VersionSnapshot = {
37
+ repositoryUrl: request.repositoryUrl,
38
+ commitSha: request.commitSha,
39
+ storyboards: request.storyboards,
40
+ registeredAt: new Date().toISOString(),
41
+ metadata: request.metadata,
42
+ };
43
+
44
+ this.versions.set(key, snapshot);
45
+ }
46
+
47
+ /**
48
+ * Get a version snapshot by repository URL and commit SHA
49
+ */
50
+ async get(repositoryUrl: string, commitSha: string): Promise<GetVersionResponse> {
51
+ const key = this.getKey(repositoryUrl, commitSha);
52
+ const snapshot = this.versions.get(key);
53
+
54
+ if (!snapshot) {
55
+ return {
56
+ found: false,
57
+ error: `Version not found: ${repositoryUrl}@${commitSha}`,
58
+ };
59
+ }
60
+
61
+ return {
62
+ found: true,
63
+ snapshot,
64
+ };
65
+ }
66
+
67
+ /**
68
+ * Check if a version exists in the registry
69
+ */
70
+ async exists(repositoryUrl: string, commitSha: string): Promise<boolean> {
71
+ const key = this.getKey(repositoryUrl, commitSha);
72
+ return this.versions.has(key);
73
+ }
74
+
75
+ /**
76
+ * Delete a version from the registry
77
+ */
78
+ async delete(repositoryUrl: string, commitSha: string): Promise<void> {
79
+ const key = this.getKey(repositoryUrl, commitSha);
80
+ this.versions.delete(key);
81
+ }
82
+
83
+ /**
84
+ * List all versions for a repository
85
+ */
86
+ async listVersions(repositoryUrl: string): Promise<VersionIdentifier[]> {
87
+ const versions: VersionIdentifier[] = [];
88
+
89
+ for (const [key, snapshot] of this.versions.entries()) {
90
+ if (snapshot.repositoryUrl === repositoryUrl) {
91
+ versions.push({
92
+ repositoryUrl: snapshot.repositoryUrl,
93
+ commitSha: snapshot.commitSha,
94
+ });
95
+ }
96
+ }
97
+
98
+ return versions.sort((a, b) => a.commitSha.localeCompare(b.commitSha));
99
+ }
100
+
101
+ /**
102
+ * Clear all versions (for testing)
103
+ */
104
+ clear(): void {
105
+ this.versions.clear();
106
+ }
107
+
108
+ /**
109
+ * Get the number of versions in the registry (for testing)
110
+ */
111
+ get size(): number {
112
+ return this.versions.size;
113
+ }
114
+ }
115
+
116
+ /**
117
+ * Create a new in-memory version registry
118
+ */
119
+ export function createInMemoryVersionRegistry(): InMemoryVersionRegistry {
120
+ return new InMemoryVersionRegistry();
121
+ }
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Version Registry Types
3
+ *
4
+ * Defines the data structures for storing and retrieving versioned storyboard snapshots.
5
+ * The version registry indexes storyboards by repository URL and commit SHA, allowing
6
+ * traces to reference the exact workflow definitions that were active at the time of execution.
7
+ */
8
+
9
+ import type { DiscoveredStoryboard } from '../discovery/types';
10
+
11
+ /**
12
+ * Version identifier combining repository URL and commit SHA
13
+ */
14
+ export interface VersionIdentifier {
15
+ /** Git repository URL (e.g., "https://github.com/org/repo") */
16
+ repositoryUrl: string;
17
+ /** Git commit SHA (full 40-character hash) */
18
+ commitSha: string;
19
+ }
20
+
21
+ /**
22
+ * Complete snapshot of storyboards at a specific version
23
+ *
24
+ * This should be stored in the version registry when a version is built/deployed,
25
+ * and retrieved when processing traces that reference this version.
26
+ */
27
+ export interface VersionSnapshot extends VersionIdentifier {
28
+ /**
29
+ * Complete storyboard definitions as discovered from the codebase at this version.
30
+ * Includes all metadata: canvas info, workflow paths, package names, etc.
31
+ */
32
+ storyboards: DiscoveredStoryboard[];
33
+
34
+ /** When this version was registered */
35
+ registeredAt?: string;
36
+
37
+ /** Optional metadata about the build/deployment */
38
+ metadata?: {
39
+ /** Build/deployment environment (e.g., "production", "staging") */
40
+ environment?: string;
41
+ /** Branch name */
42
+ branch?: string;
43
+ /** Git tag if applicable */
44
+ tag?: string;
45
+ /** Additional custom metadata */
46
+ [key: string]: unknown;
47
+ };
48
+ }
49
+
50
+ /**
51
+ * Request to register a new version in the registry
52
+ */
53
+ export interface RegisterVersionRequest {
54
+ /** Repository URL */
55
+ repositoryUrl: string;
56
+ /** Commit SHA */
57
+ commitSha: string;
58
+ /** Discovered storyboards from this version */
59
+ storyboards: DiscoveredStoryboard[];
60
+ /** Optional metadata */
61
+ metadata?: VersionSnapshot['metadata'];
62
+ }
63
+
64
+ /**
65
+ * Response from querying the version registry
66
+ */
67
+ export interface GetVersionResponse {
68
+ /** Whether the version was found */
69
+ found: boolean;
70
+ /** Version snapshot if found */
71
+ snapshot?: VersionSnapshot;
72
+ /** Error message if not found or error occurred */
73
+ error?: string;
74
+ }
75
+
76
+ /**
77
+ * Version registry interface
78
+ *
79
+ * Implementations might use:
80
+ * - A database (PostgreSQL, MongoDB, etc.)
81
+ * - A key-value store (Redis, DynamoDB)
82
+ * - A file-based registry (S3, local filesystem)
83
+ * - An in-memory cache for testing
84
+ */
85
+ export interface VersionRegistry {
86
+ /**
87
+ * Register a new version snapshot
88
+ * @param request - Version registration request
89
+ * @returns Promise that resolves when registered
90
+ */
91
+ register(request: RegisterVersionRequest): Promise<void>;
92
+
93
+ /**
94
+ * Get a version snapshot by repository URL and commit SHA
95
+ * @param repositoryUrl - Repository URL
96
+ * @param commitSha - Commit SHA
97
+ * @returns Promise with version snapshot if found
98
+ */
99
+ get(repositoryUrl: string, commitSha: string): Promise<GetVersionResponse>;
100
+
101
+ /**
102
+ * Check if a version exists in the registry
103
+ * @param repositoryUrl - Repository URL
104
+ * @param commitSha - Commit SHA
105
+ * @returns Promise with boolean indicating if version exists
106
+ */
107
+ exists(repositoryUrl: string, commitSha: string): Promise<boolean>;
108
+
109
+ /**
110
+ * Delete a version from the registry (for cleanup)
111
+ * @param repositoryUrl - Repository URL
112
+ * @param commitSha - Commit SHA
113
+ * @returns Promise that resolves when deleted
114
+ */
115
+ delete?(repositoryUrl: string, commitSha: string): Promise<void>;
116
+
117
+ /**
118
+ * List all versions for a repository (optional, for debugging/admin)
119
+ * @param repositoryUrl - Repository URL
120
+ * @returns Promise with array of version identifiers
121
+ */
122
+ listVersions?(repositoryUrl: string): Promise<VersionIdentifier[]>;
123
+ }