@elevasis/core 0.2.1 → 0.4.0

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.
Files changed (45) hide show
  1. package/dist/index.d.ts +63 -103
  2. package/dist/index.js +431 -111
  3. package/dist/organization-model/index.d.ts +63 -103
  4. package/dist/organization-model/index.js +431 -111
  5. package/package.json +1 -1
  6. package/src/README.md +1 -1
  7. package/src/__tests__/template-foundations-compatibility.test.ts +28 -36
  8. package/src/auth/multi-tenancy/types.ts +4 -11
  9. package/src/auth/multi-tenancy/users/api-schemas.ts +1 -1
  10. package/src/business/base-entities.test.ts +481 -0
  11. package/src/business/base-entities.ts +241 -0
  12. package/src/business/delivery/types.ts +1 -1
  13. package/src/business/index.ts +3 -0
  14. package/src/execution/index.ts +3 -6
  15. package/src/index.ts +1 -1
  16. package/src/organization-model/README.md +25 -26
  17. package/src/organization-model/__tests__/graph.test.ts +103 -71
  18. package/src/organization-model/__tests__/resolve.test.ts +22 -31
  19. package/src/organization-model/contracts.ts +3 -0
  20. package/src/organization-model/defaults.ts +59 -7
  21. package/src/organization-model/domains/features.ts +19 -54
  22. package/src/organization-model/domains/navigation.ts +266 -17
  23. package/src/organization-model/domains/shared.ts +1 -10
  24. package/src/organization-model/foundation.ts +97 -0
  25. package/src/organization-model/graph/build.ts +34 -67
  26. package/src/organization-model/graph/schema.ts +2 -4
  27. package/src/organization-model/graph/types.ts +3 -15
  28. package/src/organization-model/index.ts +2 -0
  29. package/src/organization-model/organization-graph.mdx +37 -28
  30. package/src/organization-model/organization-model.mdx +34 -36
  31. package/src/organization-model/published.ts +12 -3
  32. package/src/organization-model/schema.ts +38 -34
  33. package/src/organization-model/types.ts +5 -10
  34. package/src/platform/constants/versions.ts +1 -1
  35. package/src/platform/sse/events.ts +1 -34
  36. package/src/projects/api-schemas.ts +2 -1
  37. package/src/reference/_generated/contracts.md +10 -31
  38. package/src/reference/glossary.md +14 -18
  39. package/src/supabase/database.types.ts +0 -107
  40. package/src/test-utils/rls/RLSTestContext.ts +1 -31
  41. package/src/execution/calibration/__tests__/schemas.test.ts +0 -320
  42. package/src/execution/calibration/index.ts +0 -3
  43. package/src/execution/calibration/schemas.ts +0 -121
  44. package/src/execution/calibration/sse-events.ts +0 -125
  45. package/src/execution/calibration/types.ts +0 -190
@@ -1,190 +0,0 @@
1
- /**
2
- * Calibration Lab Type Definitions
3
- * Core types for AI model configuration optimization with cost/performance comparison
4
- */
5
-
6
- import type { AgentDefinition } from '../engine/agent/core/types'
7
- import type { WorkflowDefinition } from '../engine/workflow/types'
8
- import type { ExecutionMetricsDetail } from '../../operations/observability/types'
9
-
10
- // ============================================================================
11
- // Calibration Project Types
12
- // ============================================================================
13
-
14
- /**
15
- * Calibration project - groups related optimization runs
16
- * Provides organizational structure for iterative testing
17
- */
18
- export interface CalibrationProject {
19
- id: string
20
- organizationId: string
21
- resourceId: string
22
- resourceType: 'agent' | 'workflow'
23
- name: string
24
- description?: string | null
25
- createdAt: Date
26
- updatedAt: Date
27
- }
28
-
29
- // ============================================================================
30
- // Configuration Variant Types
31
- // ============================================================================
32
-
33
- /**
34
- * Configuration variant for testing
35
- * Defines what to override in the base agent/workflow definition
36
- */
37
- export interface ConfigVariant {
38
- variantName: string
39
- definitionOverrides?: AgentCalibrationOverrides | WorkflowCalibrationOverrides
40
- }
41
-
42
- /**
43
- * Agent definition overrides for calibration
44
- * Excludes identity/metadata fields that should not be modified
45
- */
46
- export type AgentCalibrationOverrides = Omit<
47
- Partial<AgentDefinition>,
48
- 'config' | 'contract' | 'tools' | 'metricsConfig' | 'interface'
49
- >
50
-
51
- /**
52
- * Workflow definition overrides for calibration
53
- * Excludes identity/metadata fields that should not be modified
54
- */
55
- export type WorkflowCalibrationOverrides = Omit<
56
- Partial<WorkflowDefinition>,
57
- 'config' | 'contract' | 'steps' | 'entryPoint' | 'metricsConfig' | 'interface'
58
- >
59
-
60
- // ============================================================================
61
- // Grading System Types
62
- // ============================================================================
63
-
64
- /**
65
- * Grading rubric for LLM-as-judge evaluation
66
- * Defines criteria and passing threshold
67
- */
68
- export interface GradingRubric {
69
- passingThreshold: number // 0-1, e.g., 0.7 means 70% to pass
70
- criteria: GradingCriterion[]
71
- }
72
-
73
- /**
74
- * Individual grading criterion
75
- * Weight should be 0-1, and all weights should sum to 1
76
- */
77
- export interface GradingCriterion {
78
- name: string
79
- weight: number // 0-1, weights should sum to 1
80
- description: string
81
- scoringGuide: string
82
- }
83
-
84
- /**
85
- * Grading result for a single execution or session
86
- * Contains overall score and per-criterion breakdown
87
- */
88
- export interface GradeResult {
89
- score: number // 0-1
90
- passed: boolean
91
- details: Record<string, { score: number; justification: string }>
92
- }
93
-
94
- // ============================================================================
95
- // Result Types
96
- // ============================================================================
97
-
98
- /**
99
- * Single-turn calibration result
100
- * One result per (variant × input) combination
101
- */
102
- export interface SingleCalibrationResult {
103
- executionId: string // Reference to execution_logs
104
- variantName: string
105
- inputIndex: number // Which input from testInputs array (0-based)
106
- appliedOverrides?: AgentCalibrationOverrides | WorkflowCalibrationOverrides
107
- status: 'pending' | 'running' | 'completed' | 'failed'
108
- errorMessage?: string
109
- grade?: GradeResult
110
- gradeError?: string
111
- }
112
-
113
- /**
114
- * Multi-turn session calibration result
115
- * Leverages existing sessions infrastructure
116
- */
117
- export interface SessionCalibrationResult {
118
- sessionId: string // Reference to sessions table
119
- variantName: string
120
- appliedOverrides?: AgentCalibrationOverrides | WorkflowCalibrationOverrides
121
- status: 'pending' | 'running' | 'completed' | 'failed'
122
- errorMessage?: string
123
- turnCount: number
124
- grade?: GradeResult
125
- gradeError?: string
126
- }
127
-
128
- // ============================================================================
129
- // Calibration Run Types
130
- // ============================================================================
131
-
132
- /**
133
- * Calibration run - individual test execution within a project
134
- * Contains configuration, results, and grading information
135
- */
136
- export interface CalibrationRun {
137
- id: string
138
- organizationId: string
139
- projectId: string
140
- name: string
141
- description?: string | null
142
- executionMode: 'single' | 'session'
143
- testInputs: unknown[]
144
- configVariants: ConfigVariant[]
145
- gradingRubric?: GradingRubric | null
146
- graderModel?: string | null
147
- results: (SingleCalibrationResult | SessionCalibrationResult)[]
148
- status: 'pending' | 'running' | 'completed' | 'partial' | 'failed'
149
- createdAt: Date
150
- completedAt?: Date | null
151
- }
152
-
153
- // ============================================================================
154
- // Combined Response Types
155
- // ============================================================================
156
-
157
- /**
158
- * Execution log subset for comparison view
159
- * Contains essential data without full execution context
160
- */
161
- export interface ExecutionLog {
162
- executionId: string
163
- status: 'running' | 'completed' | 'failed'
164
- input: unknown
165
- output: unknown | null
166
- error: CalibrationExecutionError | null
167
- startedAt: string
168
- completedAt: string | null
169
- }
170
-
171
- /**
172
- * Execution error information for calibration display
173
- * Subset of full execution error for UI display purposes
174
- * Named differently from ExecutionError class to avoid type conflicts
175
- */
176
- export interface CalibrationExecutionError {
177
- message: string
178
- category?: string
179
- type?: string
180
- }
181
-
182
- /**
183
- * Combined calibration run data for comparison view
184
- * Single API call returns run + execution logs + metrics
185
- */
186
- export interface CalibrationRunWithFullData {
187
- run: CalibrationRun
188
- logs: Record<string, ExecutionLog> // keyed by executionId
189
- metrics: Record<string, ExecutionMetricsDetail> // keyed by executionId
190
- }