@baselineos/frame 0.1.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.
- package/.turbo/turbo-build.log +14 -0
- package/.turbo/turbo-test.log +15 -0
- package/LICENSE +17 -0
- package/README.md +19 -0
- package/dist/index.d.ts +168 -0
- package/dist/index.js +800 -0
- package/package.json +34 -0
- package/src/__tests__/smoke.test.ts +15 -0
- package/src/__tests__/workflow.test.ts +46 -0
- package/src/config/frame-system-config.json +313 -0
- package/src/index.ts +20 -0
- package/src/system.ts +677 -0
- package/tsconfig.json +9 -0
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@baselineos/frame",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Baseline Frame — Context & Control Layer",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@baselineos/protocol-core": "1.0.0"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"tsup": "^8.0.0",
|
|
20
|
+
"typescript": "^5.7.0",
|
|
21
|
+
"vitest": "^2.1.0"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsup src/index.ts --format esm --dts",
|
|
28
|
+
"dev": "tsup src/index.ts --format esm --dts --watch",
|
|
29
|
+
"test": "vitest run",
|
|
30
|
+
"lint": "eslint src/",
|
|
31
|
+
"typecheck": "tsc --noEmit",
|
|
32
|
+
"clean": "rm -rf dist"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { BaselineFrameSystem } from '../index.js';
|
|
3
|
+
|
|
4
|
+
describe('frame', () => {
|
|
5
|
+
it('should instantiate BaselineFrameSystem', () => {
|
|
6
|
+
const frame = new BaselineFrameSystem();
|
|
7
|
+
expect(frame).toBeDefined();
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('should report initialized status', () => {
|
|
11
|
+
const frame = new BaselineFrameSystem();
|
|
12
|
+
const status = frame.getStatus();
|
|
13
|
+
expect(status.initialized).toBe(true);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { BaselineFrameSystem } from '../index.js';
|
|
3
|
+
|
|
4
|
+
describe('frame workflow', () => {
|
|
5
|
+
it('switches context and processes a command', () => {
|
|
6
|
+
const frame = new BaselineFrameSystem();
|
|
7
|
+
const switched = frame.switchContext('default');
|
|
8
|
+
expect(switched.success).toBe(true);
|
|
9
|
+
|
|
10
|
+
const result = frame.processCommand('status');
|
|
11
|
+
expect(result.success).toBe(true);
|
|
12
|
+
expect(result.context).toBe('default');
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('denies commands when context/mode permissions are insufficient', () => {
|
|
16
|
+
const frame = new BaselineFrameSystem();
|
|
17
|
+
const switched = frame.switchContext('system');
|
|
18
|
+
expect(switched.success).toBe(true);
|
|
19
|
+
|
|
20
|
+
const result = frame.processCommand('write:config');
|
|
21
|
+
expect(result.success).toBe(false);
|
|
22
|
+
expect(result.error).toBe('Permission denied by context/mode');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('supports context lifecycle create/activate/archive', () => {
|
|
26
|
+
const frame = new BaselineFrameSystem();
|
|
27
|
+
const manager = frame.getContextManager();
|
|
28
|
+
|
|
29
|
+
const created = manager.createContext('temp', {
|
|
30
|
+
description: 'Temp context',
|
|
31
|
+
mode: 'development',
|
|
32
|
+
environment: 'dev',
|
|
33
|
+
permissions: ['read'],
|
|
34
|
+
authority: 'user',
|
|
35
|
+
});
|
|
36
|
+
expect(created).toBe(true);
|
|
37
|
+
|
|
38
|
+
const activated = manager.activateContext('temp');
|
|
39
|
+
expect(activated).toBe(true);
|
|
40
|
+
expect(manager.getCurrentContext()?.name).toBe('temp');
|
|
41
|
+
|
|
42
|
+
const archived = manager.archiveContext('temp');
|
|
43
|
+
expect(archived).toBe(true);
|
|
44
|
+
expect(manager.getCurrentContext()).toBe(null);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
{
|
|
2
|
+
"system": {
|
|
3
|
+
"name": "Baseline Frame System",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "Context and control layer for Baseline Protocol",
|
|
6
|
+
"type": "frame-layer",
|
|
7
|
+
"architecture": "context-control"
|
|
8
|
+
},
|
|
9
|
+
"modes": {
|
|
10
|
+
"development": {
|
|
11
|
+
"description": "Development mode with full access and debugging capabilities",
|
|
12
|
+
"permissions": ["read", "write", "execute", "debug", "test"],
|
|
13
|
+
"environment": "dev",
|
|
14
|
+
"features": ["hot-reload", "debugging", "testing", "profiling", "logging"],
|
|
15
|
+
"security": "relaxed",
|
|
16
|
+
"performance": "development"
|
|
17
|
+
},
|
|
18
|
+
"production": {
|
|
19
|
+
"description": "Production mode with restricted access and security focus",
|
|
20
|
+
"permissions": ["read", "execute", "monitor"],
|
|
21
|
+
"environment": "prod",
|
|
22
|
+
"features": ["monitoring", "logging", "security", "performance", "scalability"],
|
|
23
|
+
"security": "strict",
|
|
24
|
+
"performance": "optimized"
|
|
25
|
+
},
|
|
26
|
+
"testing": {
|
|
27
|
+
"description": "Testing mode for validation and quality assurance",
|
|
28
|
+
"permissions": ["read", "write", "execute", "test"],
|
|
29
|
+
"environment": "test",
|
|
30
|
+
"features": ["validation", "testing", "reporting", "coverage", "mocking"],
|
|
31
|
+
"security": "moderate",
|
|
32
|
+
"performance": "testing"
|
|
33
|
+
},
|
|
34
|
+
"maintenance": {
|
|
35
|
+
"description": "Maintenance mode for system operations and administration",
|
|
36
|
+
"permissions": ["read", "write", "execute", "admin", "system"],
|
|
37
|
+
"environment": "maintenance",
|
|
38
|
+
"features": ["backup", "restore", "upgrade", "repair", "diagnostics"],
|
|
39
|
+
"security": "elevated",
|
|
40
|
+
"performance": "maintenance"
|
|
41
|
+
},
|
|
42
|
+
"staging": {
|
|
43
|
+
"description": "Staging mode for pre-production testing and validation",
|
|
44
|
+
"permissions": ["read", "write", "execute", "test", "monitor"],
|
|
45
|
+
"environment": "staging",
|
|
46
|
+
"features": ["validation", "testing", "monitoring", "performance", "security"],
|
|
47
|
+
"security": "moderate",
|
|
48
|
+
"performance": "production-like"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"contexts": {
|
|
52
|
+
"default": {
|
|
53
|
+
"description": "Default application context for general operations",
|
|
54
|
+
"mode": "development",
|
|
55
|
+
"environment": "dev",
|
|
56
|
+
"permissions": ["read", "write", "execute"],
|
|
57
|
+
"authority": "user",
|
|
58
|
+
"scope": "application"
|
|
59
|
+
},
|
|
60
|
+
"user": {
|
|
61
|
+
"description": "User-specific context with personalized settings",
|
|
62
|
+
"mode": "development",
|
|
63
|
+
"environment": "dev",
|
|
64
|
+
"permissions": ["read", "write", "execute"],
|
|
65
|
+
"authority": "user",
|
|
66
|
+
"scope": "user"
|
|
67
|
+
},
|
|
68
|
+
"system": {
|
|
69
|
+
"description": "System-level context for core operations",
|
|
70
|
+
"mode": "production",
|
|
71
|
+
"environment": "prod",
|
|
72
|
+
"permissions": ["read", "execute", "monitor"],
|
|
73
|
+
"authority": "system",
|
|
74
|
+
"scope": "system"
|
|
75
|
+
},
|
|
76
|
+
"admin": {
|
|
77
|
+
"description": "Administrative context for system management",
|
|
78
|
+
"mode": "maintenance",
|
|
79
|
+
"environment": "maintenance",
|
|
80
|
+
"permissions": ["read", "write", "execute", "admin"],
|
|
81
|
+
"authority": "admin",
|
|
82
|
+
"scope": "system"
|
|
83
|
+
},
|
|
84
|
+
"developer": {
|
|
85
|
+
"description": "Developer context for development and testing",
|
|
86
|
+
"mode": "development",
|
|
87
|
+
"environment": "dev",
|
|
88
|
+
"permissions": ["read", "write", "execute", "debug", "test"],
|
|
89
|
+
"authority": "developer",
|
|
90
|
+
"scope": "development"
|
|
91
|
+
},
|
|
92
|
+
"tester": {
|
|
93
|
+
"description": "Testing context for quality assurance",
|
|
94
|
+
"mode": "testing",
|
|
95
|
+
"environment": "test",
|
|
96
|
+
"permissions": ["read", "write", "execute", "test"],
|
|
97
|
+
"authority": "developer",
|
|
98
|
+
"scope": "testing"
|
|
99
|
+
},
|
|
100
|
+
"deployment": {
|
|
101
|
+
"description": "Deployment context for release management",
|
|
102
|
+
"mode": "staging",
|
|
103
|
+
"environment": "staging",
|
|
104
|
+
"permissions": ["read", "write", "execute", "deploy"],
|
|
105
|
+
"authority": "admin",
|
|
106
|
+
"scope": "deployment"
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"authorities": {
|
|
110
|
+
"user": {
|
|
111
|
+
"level": 1,
|
|
112
|
+
"permissions": ["read", "write"],
|
|
113
|
+
"description": "Standard user permissions for basic operations",
|
|
114
|
+
"scope": "user",
|
|
115
|
+
"restrictions": ["system", "admin"]
|
|
116
|
+
},
|
|
117
|
+
"developer": {
|
|
118
|
+
"level": 2,
|
|
119
|
+
"permissions": ["read", "write", "execute", "debug", "test"],
|
|
120
|
+
"description": "Developer permissions for development and testing",
|
|
121
|
+
"scope": "development",
|
|
122
|
+
"restrictions": ["system", "admin"]
|
|
123
|
+
},
|
|
124
|
+
"admin": {
|
|
125
|
+
"level": 3,
|
|
126
|
+
"permissions": ["read", "write", "execute", "admin", "deploy"],
|
|
127
|
+
"description": "Administrative permissions for system management",
|
|
128
|
+
"scope": "system",
|
|
129
|
+
"restrictions": ["system"]
|
|
130
|
+
},
|
|
131
|
+
"system": {
|
|
132
|
+
"level": 4,
|
|
133
|
+
"permissions": ["read", "write", "execute", "admin", "system", "core"],
|
|
134
|
+
"description": "System-level permissions for core operations",
|
|
135
|
+
"scope": "core",
|
|
136
|
+
"restrictions": []
|
|
137
|
+
},
|
|
138
|
+
"superuser": {
|
|
139
|
+
"level": 5,
|
|
140
|
+
"permissions": ["read", "write", "execute", "admin", "system", "core", "override"],
|
|
141
|
+
"description": "Superuser permissions with override capabilities",
|
|
142
|
+
"scope": "all",
|
|
143
|
+
"restrictions": []
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"environments": {
|
|
147
|
+
"dev": {
|
|
148
|
+
"name": "dev",
|
|
149
|
+
"type": "development",
|
|
150
|
+
"description": "Development environment for active development",
|
|
151
|
+
"variables": {
|
|
152
|
+
"NODE_ENV": "development",
|
|
153
|
+
"DEBUG": "true",
|
|
154
|
+
"LOG_LEVEL": "debug",
|
|
155
|
+
"API_URL": "http://localhost:3000",
|
|
156
|
+
"DATABASE_URL": "mongodb://localhost:27017/dev",
|
|
157
|
+
"CACHE_TTL": "300"
|
|
158
|
+
},
|
|
159
|
+
"features": ["hot-reload", "debugging", "profiling"]
|
|
160
|
+
},
|
|
161
|
+
"test": {
|
|
162
|
+
"name": "test",
|
|
163
|
+
"type": "testing",
|
|
164
|
+
"description": "Testing environment for quality assurance",
|
|
165
|
+
"variables": {
|
|
166
|
+
"NODE_ENV": "test",
|
|
167
|
+
"DEBUG": "true",
|
|
168
|
+
"LOG_LEVEL": "debug",
|
|
169
|
+
"API_URL": "http://localhost:3001",
|
|
170
|
+
"DATABASE_URL": "mongodb://localhost:27017/test",
|
|
171
|
+
"CACHE_TTL": "60"
|
|
172
|
+
},
|
|
173
|
+
"features": ["testing", "mocking", "coverage"]
|
|
174
|
+
},
|
|
175
|
+
"staging": {
|
|
176
|
+
"name": "staging",
|
|
177
|
+
"type": "staging",
|
|
178
|
+
"description": "Staging environment for pre-production validation",
|
|
179
|
+
"variables": {
|
|
180
|
+
"NODE_ENV": "staging",
|
|
181
|
+
"DEBUG": "false",
|
|
182
|
+
"LOG_LEVEL": "info",
|
|
183
|
+
"API_URL": "https://staging-api.example.com",
|
|
184
|
+
"DATABASE_URL": "mongodb://staging-db:27017/staging",
|
|
185
|
+
"CACHE_TTL": "1800"
|
|
186
|
+
},
|
|
187
|
+
"features": ["monitoring", "validation", "performance"]
|
|
188
|
+
},
|
|
189
|
+
"prod": {
|
|
190
|
+
"name": "prod",
|
|
191
|
+
"type": "production",
|
|
192
|
+
"description": "Production environment for live operations",
|
|
193
|
+
"variables": {
|
|
194
|
+
"NODE_ENV": "production",
|
|
195
|
+
"DEBUG": "false",
|
|
196
|
+
"LOG_LEVEL": "warn",
|
|
197
|
+
"API_URL": "https://api.example.com",
|
|
198
|
+
"DATABASE_URL": "mongodb://prod-db:27017/production",
|
|
199
|
+
"CACHE_TTL": "3600"
|
|
200
|
+
},
|
|
201
|
+
"features": ["monitoring", "security", "scalability"]
|
|
202
|
+
},
|
|
203
|
+
"maintenance": {
|
|
204
|
+
"name": "maintenance",
|
|
205
|
+
"type": "maintenance",
|
|
206
|
+
"description": "Maintenance environment for system operations",
|
|
207
|
+
"variables": {
|
|
208
|
+
"NODE_ENV": "maintenance",
|
|
209
|
+
"DEBUG": "true",
|
|
210
|
+
"LOG_LEVEL": "info",
|
|
211
|
+
"API_URL": "http://localhost:3002",
|
|
212
|
+
"DATABASE_URL": "mongodb://localhost:27017/maintenance",
|
|
213
|
+
"CACHE_TTL": "0"
|
|
214
|
+
},
|
|
215
|
+
"features": ["backup", "restore", "diagnostics"]
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
"permissions": {
|
|
219
|
+
"read": {
|
|
220
|
+
"description": "Read access to resources and data",
|
|
221
|
+
"scope": "data",
|
|
222
|
+
"level": 1
|
|
223
|
+
},
|
|
224
|
+
"write": {
|
|
225
|
+
"description": "Write access to resources and data",
|
|
226
|
+
"scope": "data",
|
|
227
|
+
"level": 2
|
|
228
|
+
},
|
|
229
|
+
"execute": {
|
|
230
|
+
"description": "Execute commands and operations",
|
|
231
|
+
"scope": "operations",
|
|
232
|
+
"level": 2
|
|
233
|
+
},
|
|
234
|
+
"debug": {
|
|
235
|
+
"description": "Debug and development capabilities",
|
|
236
|
+
"scope": "development",
|
|
237
|
+
"level": 2
|
|
238
|
+
},
|
|
239
|
+
"test": {
|
|
240
|
+
"description": "Testing and validation capabilities",
|
|
241
|
+
"scope": "testing",
|
|
242
|
+
"level": 2
|
|
243
|
+
},
|
|
244
|
+
"monitor": {
|
|
245
|
+
"description": "Monitoring and observation capabilities",
|
|
246
|
+
"scope": "monitoring",
|
|
247
|
+
"level": 1
|
|
248
|
+
},
|
|
249
|
+
"admin": {
|
|
250
|
+
"description": "Administrative and management capabilities",
|
|
251
|
+
"scope": "system",
|
|
252
|
+
"level": 3
|
|
253
|
+
},
|
|
254
|
+
"deploy": {
|
|
255
|
+
"description": "Deployment and release capabilities",
|
|
256
|
+
"scope": "deployment",
|
|
257
|
+
"level": 3
|
|
258
|
+
},
|
|
259
|
+
"system": {
|
|
260
|
+
"description": "System-level capabilities",
|
|
261
|
+
"scope": "core",
|
|
262
|
+
"level": 4
|
|
263
|
+
},
|
|
264
|
+
"core": {
|
|
265
|
+
"description": "Core system capabilities",
|
|
266
|
+
"scope": "core",
|
|
267
|
+
"level": 4
|
|
268
|
+
},
|
|
269
|
+
"override": {
|
|
270
|
+
"description": "Override and emergency capabilities",
|
|
271
|
+
"scope": "all",
|
|
272
|
+
"level": 5
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
"security": {
|
|
276
|
+
"authentication": {
|
|
277
|
+
"required": true,
|
|
278
|
+
"methods": ["token", "oauth", "sso"],
|
|
279
|
+
"timeout": 3600
|
|
280
|
+
},
|
|
281
|
+
"authorization": {
|
|
282
|
+
"required": true,
|
|
283
|
+
"method": "role-based",
|
|
284
|
+
"audit": true
|
|
285
|
+
},
|
|
286
|
+
"encryption": {
|
|
287
|
+
"data_at_rest": true,
|
|
288
|
+
"data_in_transit": true,
|
|
289
|
+
"algorithm": "AES-256"
|
|
290
|
+
},
|
|
291
|
+
"logging": {
|
|
292
|
+
"enabled": true,
|
|
293
|
+
"level": "info",
|
|
294
|
+
"retention": "90d"
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
"performance": {
|
|
298
|
+
"caching": {
|
|
299
|
+
"enabled": true,
|
|
300
|
+
"strategy": "lru",
|
|
301
|
+
"max_size": "100MB"
|
|
302
|
+
},
|
|
303
|
+
"monitoring": {
|
|
304
|
+
"enabled": true,
|
|
305
|
+
"metrics": ["cpu", "memory", "response_time"],
|
|
306
|
+
"alerts": true
|
|
307
|
+
},
|
|
308
|
+
"optimization": {
|
|
309
|
+
"enabled": true,
|
|
310
|
+
"strategies": ["compression", "minification", "bundling"]
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export {
|
|
2
|
+
BaselineFrameSystem,
|
|
3
|
+
ContextManager,
|
|
4
|
+
ModeManager,
|
|
5
|
+
AuthorityManager,
|
|
6
|
+
EnvironmentManager,
|
|
7
|
+
} from './system.js';
|
|
8
|
+
|
|
9
|
+
export type {
|
|
10
|
+
FrameSystemConfig,
|
|
11
|
+
ModeConfig,
|
|
12
|
+
ContextConfig,
|
|
13
|
+
AuthorityConfig,
|
|
14
|
+
ContextEntry,
|
|
15
|
+
ModeEntry,
|
|
16
|
+
AuthorityEntry,
|
|
17
|
+
EnvironmentEntry,
|
|
18
|
+
FrameCommandResult,
|
|
19
|
+
FrameStatus,
|
|
20
|
+
} from './system.js';
|