@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.
@@ -0,0 +1,14 @@
1
+
2
+ > @baselineos/frame@0.1.0 build /home/runner/work/baseline/baseline/packages/frame
3
+ > tsup src/index.ts --format esm --dts
4
+
5
+ CLI Building entry: src/index.ts
6
+ CLI Using tsconfig: tsconfig.json
7
+ CLI tsup v8.5.1
8
+ CLI Target: es2022
9
+ ESM Build start
10
+ ESM dist/index.js 23.73 KB
11
+ ESM ⚡️ Build success in 192ms
12
+ DTS Build start
13
+ DTS ⚡️ Build success in 13865ms
14
+ DTS dist/index.d.ts 5.17 KB
@@ -0,0 +1,15 @@
1
+
2
+ > @baselineos/frame@0.1.0 test /home/runner/work/baseline/baseline/packages/frame
3
+ > vitest run
4
+
5
+
6
+  RUN  v2.1.9 /home/runner/work/baseline/baseline/packages/frame
7
+
8
+ ✓ src/__tests__/workflow.test.ts (3 tests) 79ms
9
+ ✓ src/__tests__/smoke.test.ts (2 tests) 32ms
10
+
11
+  Test Files  2 passed (2)
12
+  Tests  5 passed (5)
13
+  Start at  14:02:30
14
+  Duration  4.74s (transform 1.11s, setup 0ms, collect 1.24s, tests 111ms, environment 0ms, prepare 1.22s)
15
+
package/LICENSE ADDED
@@ -0,0 +1,17 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ Copyright 2026 Baseline Protocol Foundation
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # @baselineos/frame
2
+
3
+ Frame layer package for Baseline.
4
+
5
+ ## Purpose
6
+
7
+ Implements context and control modeling (scope, authority, run mode framing) for deterministic workflow execution.
8
+
9
+ ## Commands
10
+
11
+ ```bash
12
+ pnpm --filter @baselineos/frame build
13
+ pnpm --filter @baselineos/frame test
14
+ ```
15
+
16
+ ## Integration
17
+
18
+ - Depends on: `@baselineos/protocol-core`
19
+ - Consumed by: `@baselineos/cli`, `baselineos`
@@ -0,0 +1,168 @@
1
+ /**
2
+ * Baseline Frame System
3
+ *
4
+ * The context and control layer of the Baseline Protocol that manages
5
+ * intent recognition, mode switching, environment context, and authority
6
+ * management.
7
+ *
8
+ * @license Apache-2.0
9
+ */
10
+ interface FrameSystemConfig {
11
+ system: {
12
+ name: string;
13
+ version: string;
14
+ description: string;
15
+ };
16
+ modes: Record<string, ModeConfig>;
17
+ contexts: Record<string, ContextConfig>;
18
+ authorities: Record<string, AuthorityConfig>;
19
+ environments?: Record<string, EnvironmentEntry>;
20
+ }
21
+ interface ModeConfig {
22
+ description: string;
23
+ permissions: string[];
24
+ environment: string;
25
+ features: string[];
26
+ }
27
+ interface ContextConfig {
28
+ description: string;
29
+ mode: string;
30
+ environment: string;
31
+ permissions: string[];
32
+ authority?: string;
33
+ }
34
+ interface AuthorityConfig {
35
+ level: number;
36
+ permissions: string[];
37
+ description: string;
38
+ }
39
+ interface ContextEntry {
40
+ name: string;
41
+ description: string;
42
+ mode: string;
43
+ environment: string;
44
+ permissions: string[];
45
+ authority: string;
46
+ status: 'active' | 'inactive' | 'archived';
47
+ createdAt: number;
48
+ updatedAt: number;
49
+ lastActivatedAt?: number;
50
+ archivedAt?: number;
51
+ }
52
+ interface ModeEntry {
53
+ name: string;
54
+ description: string;
55
+ permissions: string[];
56
+ environment: string;
57
+ features: string[];
58
+ }
59
+ interface AuthorityEntry {
60
+ name: string;
61
+ level: number;
62
+ permissions: string[];
63
+ description: string;
64
+ }
65
+ interface EnvironmentEntry {
66
+ name: string;
67
+ type: string;
68
+ description: string;
69
+ variables: Record<string, string>;
70
+ features?: string[];
71
+ }
72
+ interface FrameCommandResult {
73
+ success: boolean;
74
+ command?: string;
75
+ context?: string;
76
+ mode?: string | ModeEntry | null;
77
+ authority?: string;
78
+ environment?: string;
79
+ result?: unknown;
80
+ error?: string;
81
+ details?: string;
82
+ required?: string[];
83
+ current?: string;
84
+ available?: string[];
85
+ description?: string;
86
+ permissions?: string[] | {
87
+ context: string[];
88
+ mode: string[];
89
+ };
90
+ timestamp?: string;
91
+ }
92
+ interface FrameStatus {
93
+ initialized: boolean;
94
+ contextHistory: number;
95
+ currentMode: ModeEntry | null;
96
+ currentEnvironment: string | undefined;
97
+ activeContexts: number;
98
+ systemName: string;
99
+ version: string;
100
+ currentAuthority?: string | null;
101
+ }
102
+ declare class ContextManager {
103
+ private contexts;
104
+ private currentContext;
105
+ private history;
106
+ initialize(contextConfig: Record<string, ContextConfig>): void;
107
+ createContext(name: string, config: ContextConfig): boolean;
108
+ setContext(contextName: string): boolean;
109
+ activateContext(contextName: string): boolean;
110
+ archiveContext(contextName: string): boolean;
111
+ getCurrentContext(): ContextEntry | null;
112
+ getContext(contextName: string): ContextEntry | undefined;
113
+ listContexts(): string[];
114
+ getContextHistory(): string[];
115
+ getActiveContexts(): ContextEntry[];
116
+ getContextTimeline(): Array<{
117
+ name: string;
118
+ action: 'create' | 'activate' | 'archive';
119
+ timestamp: number;
120
+ }>;
121
+ }
122
+ declare class ModeManager {
123
+ private modes;
124
+ private currentMode;
125
+ initialize(modeConfig: Record<string, ModeConfig>): void;
126
+ setMode(modeName: string): boolean;
127
+ getCurrentMode(): ModeEntry | null;
128
+ getMode(modeName: string): ModeEntry | undefined;
129
+ processInMode(modeName: string, command: string, options: Record<string, unknown>, args: string[]): Record<string, unknown>;
130
+ }
131
+ declare class AuthorityManager {
132
+ private authorities;
133
+ private currentAuthority;
134
+ initialize(authorityConfig: Record<string, AuthorityConfig>): void;
135
+ getCurrentAuthority(): AuthorityEntry | null;
136
+ setAuthority(authorityName: string): boolean;
137
+ checkPermission(authorityName: string, command: string, options: Record<string, unknown>): boolean;
138
+ getRequiredPermissions(command: string, options?: Record<string, unknown>): string[];
139
+ }
140
+ declare class EnvironmentManager {
141
+ private environments;
142
+ private currentEnvironment;
143
+ initialize(envConfig?: Record<string, EnvironmentEntry>): void;
144
+ getCurrentEnvironment(): EnvironmentEntry | null;
145
+ setEnvironment(envName: string): boolean;
146
+ getEnvironmentVariable(name: string): string | undefined;
147
+ }
148
+ declare class BaselineFrameSystem {
149
+ private config;
150
+ private context;
151
+ private modeManager;
152
+ private authorityManager;
153
+ private environmentManager;
154
+ private initialized;
155
+ constructor();
156
+ private loadConfiguration;
157
+ private initializeSystem;
158
+ processCommand(command: string, options?: Record<string, unknown>, args?: string[]): FrameCommandResult;
159
+ switchContext(contextName: string): FrameCommandResult;
160
+ switchMode(modeName: string): FrameCommandResult;
161
+ getStatus(): FrameStatus;
162
+ getContextManager(): ContextManager;
163
+ getModeManager(): ModeManager;
164
+ getAuthorityManager(): AuthorityManager;
165
+ getEnvironmentManager(): EnvironmentManager;
166
+ }
167
+
168
+ export { type AuthorityConfig, type AuthorityEntry, AuthorityManager, BaselineFrameSystem, type ContextConfig, type ContextEntry, ContextManager, type EnvironmentEntry, EnvironmentManager, type FrameCommandResult, type FrameStatus, type FrameSystemConfig, type ModeConfig, type ModeEntry, ModeManager };