@llm-dev-ops/agentics-cli 1.4.14 → 1.4.16
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/README.md +0 -1
- package/dist/adapters/base-adapter.d.ts +109 -1
- package/dist/adapters/base-adapter.d.ts.map +1 -1
- package/dist/adapters/base-adapter.js +368 -18
- package/dist/adapters/base-adapter.js.map +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js +3 -1
- package/dist/adapters/index.js.map +1 -1
- package/dist/agents/cli-ux-agent.d.ts +9 -3
- package/dist/agents/cli-ux-agent.d.ts.map +1 -1
- package/dist/agents/cli-ux-agent.js +13 -67
- package/dist/agents/cli-ux-agent.js.map +1 -1
- package/dist/agents/decision-event.d.ts +1 -1
- package/dist/agents/decision-event.d.ts.map +1 -1
- package/dist/agents/decision-event.js +12 -7
- package/dist/agents/decision-event.js.map +1 -1
- package/dist/auth/index.d.ts +1 -3
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +1 -3
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/internal-allowlist.d.ts +19 -17
- package/dist/auth/internal-allowlist.d.ts.map +1 -1
- package/dist/auth/internal-allowlist.js +20 -90
- package/dist/auth/internal-allowlist.js.map +1 -1
- package/dist/auth/role-permissions.d.ts +23 -6
- package/dist/auth/role-permissions.d.ts.map +1 -1
- package/dist/auth/role-permissions.js +25 -37
- package/dist/auth/role-permissions.js.map +1 -1
- package/dist/cli/index.js +430 -27
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/agents.d.ts +77 -0
- package/dist/commands/agents.d.ts.map +1 -0
- package/dist/commands/agents.js +378 -0
- package/dist/commands/agents.js.map +1 -0
- package/dist/commands/demo.d.ts +30 -0
- package/dist/commands/demo.d.ts.map +1 -0
- package/dist/commands/demo.js +393 -0
- package/dist/commands/demo.js.map +1 -0
- package/dist/commands/diligence.d.ts.map +1 -1
- package/dist/commands/diligence.js +10 -15
- package/dist/commands/diligence.js.map +1 -1
- package/dist/commands/export.d.ts.map +1 -1
- package/dist/commands/export.js +5 -7
- package/dist/commands/export.js.map +1 -1
- package/dist/commands/index.d.ts +2 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +1 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/inspect.d.ts +17 -4
- package/dist/commands/inspect.d.ts.map +1 -1
- package/dist/commands/inspect.js +189 -77
- package/dist/commands/inspect.js.map +1 -1
- package/dist/commands/quantify.d.ts.map +1 -1
- package/dist/commands/quantify.js +12 -0
- package/dist/commands/quantify.js.map +1 -1
- package/dist/commands/readiness.d.ts +47 -0
- package/dist/commands/readiness.d.ts.map +1 -0
- package/dist/commands/readiness.js +270 -0
- package/dist/commands/readiness.js.map +1 -0
- package/dist/commands/simulate.d.ts +6 -0
- package/dist/commands/simulate.d.ts.map +1 -1
- package/dist/commands/simulate.js +167 -123
- package/dist/commands/simulate.js.map +1 -1
- package/dist/commands/whoami.d.ts +1 -6
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +4 -28
- package/dist/commands/whoami.js.map +1 -1
- package/dist/config/endpoints.d.ts.map +1 -1
- package/dist/config/endpoints.js +150 -2
- package/dist/config/endpoints.js.map +1 -1
- package/dist/contracts/adr-command-semantics.d.ts.map +1 -1
- package/dist/contracts/adr-command-semantics.js +17 -3
- package/dist/contracts/adr-command-semantics.js.map +1 -1
- package/dist/contracts/canonical.d.ts +207 -0
- package/dist/contracts/canonical.d.ts.map +1 -0
- package/dist/contracts/canonical.js +191 -0
- package/dist/contracts/canonical.js.map +1 -0
- package/dist/contracts/index.d.ts +3 -1
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +2 -0
- package/dist/contracts/index.js.map +1 -1
- package/dist/contracts/schemas/index.d.ts +709 -5
- package/dist/contracts/schemas/index.d.ts.map +1 -1
- package/dist/contracts/schemas/index.js +415 -0
- package/dist/contracts/schemas/index.js.map +1 -1
- package/dist/contracts/validator.d.ts +3 -3
- package/dist/contracts/validator.d.ts.map +1 -1
- package/dist/contracts/validator.js +48 -5
- package/dist/contracts/validator.js.map +1 -1
- package/dist/gates/argument-guard.js +1 -1
- package/dist/gates/argument-guard.js.map +1 -1
- package/dist/gates/auth-session-gate.d.ts +2 -2
- package/dist/gates/auth-session-gate.d.ts.map +1 -1
- package/dist/gates/auth-session-gate.js +2 -26
- package/dist/gates/auth-session-gate.js.map +1 -1
- package/dist/gates/execution-gate.d.ts +23 -54
- package/dist/gates/execution-gate.d.ts.map +1 -1
- package/dist/gates/execution-gate.js +66 -166
- package/dist/gates/execution-gate.js.map +1 -1
- package/dist/gates/index.d.ts +6 -0
- package/dist/gates/index.d.ts.map +1 -1
- package/dist/gates/index.js +8 -0
- package/dist/gates/index.js.map +1 -1
- package/dist/gates/meta-simulation-detector.d.ts +48 -0
- package/dist/gates/meta-simulation-detector.d.ts.map +1 -0
- package/dist/gates/meta-simulation-detector.js +45 -0
- package/dist/gates/meta-simulation-detector.js.map +1 -0
- package/dist/gates/readiness-gate.d.ts +108 -0
- package/dist/gates/readiness-gate.d.ts.map +1 -0
- package/dist/gates/readiness-gate.js +194 -0
- package/dist/gates/readiness-gate.js.map +1 -0
- package/dist/gates/ruvector-acceptance-gate.d.ts +78 -0
- package/dist/gates/ruvector-acceptance-gate.d.ts.map +1 -0
- package/dist/gates/ruvector-acceptance-gate.js +191 -0
- package/dist/gates/ruvector-acceptance-gate.js.map +1 -0
- package/dist/modules/artifact-handoff.d.ts.map +1 -1
- package/dist/modules/artifact-handoff.js +26 -0
- package/dist/modules/artifact-handoff.js.map +1 -1
- package/dist/modules/command-parser.d.ts +1 -1
- package/dist/modules/command-parser.d.ts.map +1 -1
- package/dist/modules/command-parser.js +5 -1
- package/dist/modules/command-parser.js.map +1 -1
- package/dist/modules/output-renderer.d.ts +13 -1
- package/dist/modules/output-renderer.d.ts.map +1 -1
- package/dist/modules/output-renderer.js +68 -0
- package/dist/modules/output-renderer.js.map +1 -1
- package/dist/runtime/claude-code-runner.d.ts.map +1 -1
- package/dist/runtime/claude-code-runner.js +165 -0
- package/dist/runtime/claude-code-runner.js.map +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +59 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/routes/agents.d.ts +36 -0
- package/dist/server/routes/agents.d.ts.map +1 -0
- package/dist/server/routes/agents.js +263 -0
- package/dist/server/routes/agents.js.map +1 -0
- package/dist/server/routes/index.d.ts +1 -0
- package/dist/server/routes/index.d.ts.map +1 -1
- package/dist/server/routes/index.js +2 -0
- package/dist/server/routes/index.js.map +1 -1
- package/dist/synthesis/dynamic-router.d.ts +80 -0
- package/dist/synthesis/dynamic-router.d.ts.map +1 -0
- package/dist/synthesis/dynamic-router.js +63 -0
- package/dist/synthesis/dynamic-router.js.map +1 -0
- package/dist/synthesis/prompts/index.d.ts.map +1 -1
- package/dist/synthesis/prompts/index.js +100 -23
- package/dist/synthesis/prompts/index.js.map +1 -1
- package/dist/types/index.d.ts +86 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +8 -0
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,30 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Execution Gate Module
|
|
2
|
+
* Execution Gate Module — Credential Pre-flight
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* ARCHITECTURE:
|
|
5
|
+
* The CLI does NOT resolve entitlements, maintain email allowlists,
|
|
6
|
+
* or enforce access policy locally. Authorization is a platform concern.
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* This gate checks whether ANY credential source exists before sending
|
|
9
|
+
* a request that would be guaranteed to 401. It checks:
|
|
10
|
+
* 1. Environment variables (AGENTICS_API_KEY, AGENTICS_AUTH_TOKEN, etc.)
|
|
11
|
+
* 2. Stored credentials from `agentics login`
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* - Internal or paid users get full access to all commands
|
|
15
|
-
* - Users with no entitlement are blocked
|
|
13
|
+
* If any credential exists, the request proceeds and the platform
|
|
14
|
+
* enforces actual policy.
|
|
16
15
|
*/
|
|
17
|
-
import * as fs from 'node:fs';
|
|
18
|
-
import * as path from 'node:path';
|
|
19
|
-
import * as os from 'node:os';
|
|
20
16
|
import { EXIT_CODES } from '../types/index.js';
|
|
21
|
-
import {
|
|
17
|
+
import { createCredentialStore } from '../utils/credentials.js';
|
|
22
18
|
// ============================================================================
|
|
23
|
-
//
|
|
19
|
+
// Constants
|
|
24
20
|
// ============================================================================
|
|
25
21
|
/**
|
|
26
|
-
* Commands that
|
|
27
|
-
* These are identity and help commands
|
|
22
|
+
* Commands that bypass the execution gate entirely.
|
|
23
|
+
* These are identity bootstrapping and help commands — the CLI must
|
|
24
|
+
* allow them so the user can authenticate in the first place.
|
|
25
|
+
* This is transport-level routing, not policy enforcement.
|
|
28
26
|
*/
|
|
29
27
|
const ALLOWED_COMMANDS = new Set([
|
|
30
28
|
'login',
|
|
@@ -32,160 +30,58 @@ const ALLOWED_COMMANDS = new Set([
|
|
|
32
30
|
'whoami',
|
|
33
31
|
'help',
|
|
34
32
|
'version',
|
|
33
|
+
'demo',
|
|
35
34
|
]);
|
|
36
|
-
/**
|
|
37
|
-
* Default internal emails (fallback if config file doesn't exist).
|
|
38
|
-
*/
|
|
39
|
-
const DEFAULT_INTERNAL_EMAILS = [
|
|
40
|
-
'nick@nicholasruest.com',
|
|
41
|
-
'sales@globalbusinessadvisors.co',
|
|
42
|
-
'nicholasruest1@gmail.com',
|
|
43
|
-
'nick.ruest@agentics.org',
|
|
44
|
-
'ruv@ruv.net',
|
|
45
|
-
'ruv@agentics.org',
|
|
46
|
-
'cvsrohit@gmail.com',
|
|
47
|
-
'rishubcheddlla@gmail.com',
|
|
48
|
-
];
|
|
49
|
-
/**
|
|
50
|
-
* Load internal emails from config file or use defaults.
|
|
51
|
-
* Config file: ~/.agentics/internal-users.json
|
|
52
|
-
* Format: { "emails": ["email1@example.com", "email2@example.com"] }
|
|
53
|
-
*/
|
|
54
|
-
function loadInternalEmails() {
|
|
55
|
-
try {
|
|
56
|
-
const configPath = path.join(os.homedir(), '.agentics', 'internal-users.json');
|
|
57
|
-
if (fs.existsSync(configPath)) {
|
|
58
|
-
const content = fs.readFileSync(configPath, 'utf-8');
|
|
59
|
-
const config = JSON.parse(content);
|
|
60
|
-
if (Array.isArray(config.emails)) {
|
|
61
|
-
return new Set(config.emails.map((e) => e.toLowerCase()));
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
catch {
|
|
66
|
-
// Config file doesn't exist or is invalid, use defaults
|
|
67
|
-
}
|
|
68
|
-
// Create default config file if it doesn't exist
|
|
69
|
-
try {
|
|
70
|
-
const configDir = path.join(os.homedir(), '.agentics');
|
|
71
|
-
const configPath = path.join(configDir, 'internal-users.json');
|
|
72
|
-
if (!fs.existsSync(configPath)) {
|
|
73
|
-
if (!fs.existsSync(configDir)) {
|
|
74
|
-
fs.mkdirSync(configDir, { recursive: true });
|
|
75
|
-
}
|
|
76
|
-
fs.writeFileSync(configPath, JSON.stringify({ emails: DEFAULT_INTERNAL_EMAILS }, null, 2));
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
catch {
|
|
80
|
-
// Failed to create config file, continue with defaults
|
|
81
|
-
}
|
|
82
|
-
return new Set(DEFAULT_INTERNAL_EMAILS.map(e => e.toLowerCase()));
|
|
83
|
-
}
|
|
84
|
-
// Load internal emails once at startup
|
|
85
|
-
const INTERNAL_EMAILS = loadInternalEmails();
|
|
86
|
-
/**
|
|
87
|
-
* Resolve the entitlement for the currently authenticated user.
|
|
88
|
-
*
|
|
89
|
-
* Checks in order:
|
|
90
|
-
* 1. AGENTICS_USER_EMAIL environment variable
|
|
91
|
-
* 2. Email stored in credentials file (~/.agentics/credentials.json)
|
|
92
|
-
* 3. gcloud authenticated account
|
|
93
|
-
*
|
|
94
|
-
* @returns The user's entitlement: 'internal' for allow-listed users, 'none' otherwise
|
|
95
|
-
*/
|
|
96
|
-
export function resolveEntitlement() {
|
|
97
|
-
// Check environment variable first (simplest path for internal users)
|
|
98
|
-
const envEmail = process.env['AGENTICS_USER_EMAIL'];
|
|
99
|
-
if (envEmail && INTERNAL_EMAILS.has(envEmail.toLowerCase())) {
|
|
100
|
-
return 'internal';
|
|
101
|
-
}
|
|
102
|
-
// Check stored credentials for email and payment status
|
|
103
|
-
const storedCreds = getStoredCredentials();
|
|
104
|
-
if (storedCreds?.email && INTERNAL_EMAILS.has(storedCreds.email.toLowerCase())) {
|
|
105
|
-
return 'internal';
|
|
106
|
-
}
|
|
107
|
-
// Check if API key holder has paid status
|
|
108
|
-
if (storedCreds?.api_key && storedCreds.payment_status === 'paid') {
|
|
109
|
-
return 'paid';
|
|
110
|
-
}
|
|
111
|
-
// Fall back to gcloud account
|
|
112
|
-
const account = getActiveAccount();
|
|
113
|
-
if (account && INTERNAL_EMAILS.has(account.toLowerCase())) {
|
|
114
|
-
return 'internal';
|
|
115
|
-
}
|
|
116
|
-
// If user has a valid API key, treat as paid (API keys are issued to paying users)
|
|
117
|
-
if (storedCreds?.api_key) {
|
|
118
|
-
return 'paid';
|
|
119
|
-
}
|
|
120
|
-
return 'none';
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Read stored credentials (sync).
|
|
124
|
-
*/
|
|
125
|
-
function getStoredCredentials() {
|
|
126
|
-
try {
|
|
127
|
-
const credPath = path.join(os.homedir(), '.agentics', 'credentials.json');
|
|
128
|
-
const content = fs.readFileSync(credPath, 'utf-8');
|
|
129
|
-
const creds = JSON.parse(content);
|
|
130
|
-
if (!creds.api_key)
|
|
131
|
-
return null;
|
|
132
|
-
return creds;
|
|
133
|
-
}
|
|
134
|
-
catch {
|
|
135
|
-
return null;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Exit code for blocked execution.
|
|
140
|
-
* Uses PERMISSION_DENIED (77) to indicate access is denied.
|
|
141
|
-
*/
|
|
142
35
|
export const EXECUTION_BLOCKED_EXIT_CODE = EXIT_CODES.PERMISSION_DENIED;
|
|
143
|
-
// ============================================================================
|
|
144
|
-
// Execution Gate Error Message
|
|
145
|
-
// ============================================================================
|
|
146
36
|
const BLOCKED_MESSAGE = `
|
|
147
37
|
❌ Execution Disabled
|
|
148
38
|
|
|
149
39
|
This command requires an active Agentics execution environment.
|
|
150
40
|
|
|
151
|
-
|
|
41
|
+
No valid credentials found. To authenticate:
|
|
42
|
+
|
|
43
|
+
Option 1: Platform login (recommended)
|
|
44
|
+
agentics login
|
|
45
|
+
|
|
46
|
+
Option 2: API key via environment variable
|
|
47
|
+
export AGENTICS_API_KEY=agentics_sk_...
|
|
152
48
|
|
|
153
|
-
Contact the Agentics team to enable execution.
|
|
154
49
|
`.trim();
|
|
50
|
+
// ============================================================================
|
|
51
|
+
// Execution Gate — Credential Pre-flight
|
|
52
|
+
// ============================================================================
|
|
155
53
|
/**
|
|
156
54
|
* Check if a command is allowed to execute.
|
|
157
55
|
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
* - network calls
|
|
162
|
-
* - domain service invocation
|
|
163
|
-
*
|
|
164
|
-
* Execution flow:
|
|
165
|
-
* 1. Always allow identity and help commands
|
|
166
|
-
* 2. Resolve user entitlement
|
|
167
|
-
* 3. If entitlement === "internal" or "paid" → allow execution
|
|
168
|
-
* 4. Otherwise → block execution
|
|
169
|
-
*
|
|
170
|
-
* @param command - The command name (e.g., 'plan', 'simulate', 'login')
|
|
171
|
-
* @returns ExecutionGateResult indicating if execution is allowed
|
|
56
|
+
* For identity/help commands: always allowed (transport-level).
|
|
57
|
+
* For all other commands: checks whether any credential source exists.
|
|
58
|
+
* The platform decides actual authorization when the request arrives.
|
|
172
59
|
*/
|
|
173
|
-
export function checkExecutionGate(command) {
|
|
174
|
-
//
|
|
60
|
+
export async function checkExecutionGate(command) {
|
|
61
|
+
// Identity/help commands always allowed — transport-level bypass
|
|
175
62
|
if (ALLOWED_COMMANDS.has(command)) {
|
|
176
63
|
return { allowed: true };
|
|
177
64
|
}
|
|
178
|
-
//
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
65
|
+
// 1. Check environment variables
|
|
66
|
+
const hasEnvCredentials = !!(process.env['AGENTICS_API_KEY'] ||
|
|
67
|
+
process.env['AGENTICS_AUTH_TOKEN'] ||
|
|
68
|
+
process.env['AGENTICS_USER_EMAIL'] ||
|
|
69
|
+
process.env['AGENTICS_INTERNAL_KEY']);
|
|
70
|
+
if (hasEnvCredentials) {
|
|
182
71
|
return { allowed: true };
|
|
183
72
|
}
|
|
184
|
-
//
|
|
185
|
-
|
|
186
|
-
|
|
73
|
+
// 2. Check stored credentials from `agentics login`
|
|
74
|
+
try {
|
|
75
|
+
const store = createCredentialStore();
|
|
76
|
+
const credentials = await store.load();
|
|
77
|
+
if (credentials && credentials.api_key) {
|
|
78
|
+
return { allowed: true };
|
|
79
|
+
}
|
|
187
80
|
}
|
|
188
|
-
|
|
81
|
+
catch {
|
|
82
|
+
// Stored credential check failed — continue to next source
|
|
83
|
+
}
|
|
84
|
+
// No credentials found from any source
|
|
189
85
|
return {
|
|
190
86
|
allowed: false,
|
|
191
87
|
exitCode: EXECUTION_BLOCKED_EXIT_CODE,
|
|
@@ -194,29 +90,33 @@ export function checkExecutionGate(command) {
|
|
|
194
90
|
}
|
|
195
91
|
/**
|
|
196
92
|
* Enforce the execution gate. Exits the process if blocked.
|
|
197
|
-
*
|
|
198
|
-
* @param command - The command name to check
|
|
199
93
|
*/
|
|
200
|
-
export function enforceExecutionGate(command) {
|
|
201
|
-
const result = checkExecutionGate(command);
|
|
94
|
+
export async function enforceExecutionGate(command) {
|
|
95
|
+
const result = await checkExecutionGate(command);
|
|
202
96
|
if (!result.allowed) {
|
|
203
97
|
console.error(result.message);
|
|
204
98
|
process.exit(result.exitCode);
|
|
205
99
|
}
|
|
206
100
|
}
|
|
207
101
|
/**
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
* @returns true if the user has internal or paid entitlement
|
|
102
|
+
* @deprecated Entitlement resolution is now platform-side.
|
|
103
|
+
* This stub checks for credential presence only — not entitlement type.
|
|
211
104
|
*/
|
|
212
|
-
export function
|
|
213
|
-
const
|
|
214
|
-
|
|
105
|
+
export function resolveEntitlement() {
|
|
106
|
+
const hasCredentials = !!(process.env['AGENTICS_API_KEY'] ||
|
|
107
|
+
process.env['AGENTICS_AUTH_TOKEN'] ||
|
|
108
|
+
process.env['AGENTICS_INTERNAL_KEY']);
|
|
109
|
+
return hasCredentials ? 'paid' : 'none';
|
|
215
110
|
}
|
|
216
111
|
/**
|
|
217
|
-
*
|
|
218
|
-
|
|
219
|
-
|
|
112
|
+
* @deprecated Use checkExecutionGate() instead.
|
|
113
|
+
*/
|
|
114
|
+
export async function isExecutionEnabled() {
|
|
115
|
+
const result = await checkExecutionGate('_check');
|
|
116
|
+
return result.allowed;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Get the list of commands that bypass the execution gate.
|
|
220
120
|
*/
|
|
221
121
|
export function getAllowedCommands() {
|
|
222
122
|
return ALLOWED_COMMANDS;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-gate.js","sourceRoot":"","sources":["../../src/gates/execution-gate.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"execution-gate.js","sourceRoot":"","sources":["../../src/gates/execution-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E;;;;;GAKG;A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QACrC,OAAO,EAAE,eAAe;KACzB,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAAe;IACxD,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACjD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC9B,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAChC,MAAM,cAAc,GAAG,CAAC,CAAC,CACvB,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;QAC/B,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CACrC,CAAC;IACF,OAAO,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB;IACtC,MAAM,MAAM,GAAG,MAAM,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAClD,OAAO,MAAM,CAAC,OAAO,CAAC;AACxB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,gBAAgB,CAAC;AAC1B,CAAC"}
|
package/dist/gates/index.d.ts
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
* 4. Output Format Gate - Enforces strict JSON output
|
|
12
12
|
* 5. Argument Guard Gate - Validates argument types per ADR-001
|
|
13
13
|
* 6. Lineage Gate - Enforces simulation traceability per ADR-004
|
|
14
|
+
* 7. Readiness Gate - Enforces execution safety when execution-gated
|
|
15
|
+
* 8. Ruvector Acceptance Gate - Mandatory blocking persistence (ADR-004)
|
|
14
16
|
*
|
|
15
17
|
* CRITICAL REQUIREMENTS MET:
|
|
16
18
|
* - CLI requires Ruvector-backed services (Service Health Gate)
|
|
@@ -21,6 +23,8 @@
|
|
|
21
23
|
* - Enforces strict JSON outputs (Output Format Gate)
|
|
22
24
|
* - Never allows narrative output (Output Format Gate)
|
|
23
25
|
* - Enterprise artifacts trace to governed simulations (Lineage Gate)
|
|
26
|
+
* - Simulations block until ruvector accepts (Ruvector Acceptance Gate)
|
|
27
|
+
* - Meta-simulations route to Tier-1 simulator (Meta-Simulation Detector)
|
|
24
28
|
*/
|
|
25
29
|
export { checkExecutionGate, enforceExecutionGate, isExecutionEnabled, getAllowedCommands, resolveEntitlement, EXECUTION_BLOCKED_EXIT_CODE, type ExecutionGateResult, type Entitlement, } from './execution-gate.js';
|
|
26
30
|
export { enforceAuthSessionGate, checkAuthSessionGate, requiresAuthentication, AUTH_REQUIRED_EXIT_CODE, AuthSessionRequiredError, type AuthSessionGateResult, } from './auth-session-gate.js';
|
|
@@ -28,4 +32,6 @@ export { enforceServiceHealthGate, checkServiceHealthGate, requiresHealthCheck,
|
|
|
28
32
|
export { enforceOutputFormatGate, checkOutputFormatGate, requiresStructuredOutput, getDefaultFormat, INVALID_FORMAT_EXIT_CODE, InvalidOutputFormatError, type OutputFormatGateResult, } from './output-format-gate.js';
|
|
29
33
|
export { checkArgumentGuard, enforceArgumentGuard, requiresArgumentValidation, type ArgumentGuardResult, } from './argument-guard.js';
|
|
30
34
|
export { checkLineageGate, enforceLineageGate, requiresLineageValidation, LINEAGE_VIOLATION_EXIT_CODE, type LineageGateResult, } from './lineage-gate.js';
|
|
35
|
+
export { blockUntilRuvectorAccepts, blockUntilLineageAccepted, buildRuvectorRootedGraph, validateRuvectorRootedGraph, RUVECTOR_ACCEPTANCE_EXIT_CODE, } from './ruvector-acceptance-gate.js';
|
|
36
|
+
export { isMetaSimulation, getMetaSimulationTier, buildTier1Route, META_SIMULATION_EXIT_CODE, type Tier1Route, } from './meta-simulation-detector.js';
|
|
31
37
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gates/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gates/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,2BAA2B,EAC3B,KAAK,mBAAmB,EACxB,KAAK,WAAW,GACjB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,KAAK,qBAAqB,GAC3B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,mBAAmB,EACnB,6BAA6B,EAC7B,kBAAkB,EAClB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,GAC7B,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,EAChB,wBAAwB,EACxB,wBAAwB,EACxB,KAAK,sBAAsB,GAC5B,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,EAC1B,KAAK,mBAAmB,GACzB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB,EACzB,2BAA2B,EAC3B,KAAK,iBAAiB,GACvB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,yBAAyB,EACzB,KAAK,UAAU,GAChB,MAAM,+BAA+B,CAAC"}
|
package/dist/gates/index.js
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
* 4. Output Format Gate - Enforces strict JSON output
|
|
12
12
|
* 5. Argument Guard Gate - Validates argument types per ADR-001
|
|
13
13
|
* 6. Lineage Gate - Enforces simulation traceability per ADR-004
|
|
14
|
+
* 7. Readiness Gate - Enforces execution safety when execution-gated
|
|
15
|
+
* 8. Ruvector Acceptance Gate - Mandatory blocking persistence (ADR-004)
|
|
14
16
|
*
|
|
15
17
|
* CRITICAL REQUIREMENTS MET:
|
|
16
18
|
* - CLI requires Ruvector-backed services (Service Health Gate)
|
|
@@ -21,6 +23,8 @@
|
|
|
21
23
|
* - Enforces strict JSON outputs (Output Format Gate)
|
|
22
24
|
* - Never allows narrative output (Output Format Gate)
|
|
23
25
|
* - Enterprise artifacts trace to governed simulations (Lineage Gate)
|
|
26
|
+
* - Simulations block until ruvector accepts (Ruvector Acceptance Gate)
|
|
27
|
+
* - Meta-simulations route to Tier-1 simulator (Meta-Simulation Detector)
|
|
24
28
|
*/
|
|
25
29
|
// Execution Gate - Hard kill-switch
|
|
26
30
|
export { checkExecutionGate, enforceExecutionGate, isExecutionEnabled, getAllowedCommands, resolveEntitlement, EXECUTION_BLOCKED_EXIT_CODE, } from './execution-gate.js';
|
|
@@ -34,4 +38,8 @@ export { enforceOutputFormatGate, checkOutputFormatGate, requiresStructuredOutpu
|
|
|
34
38
|
export { checkArgumentGuard, enforceArgumentGuard, requiresArgumentValidation, } from './argument-guard.js';
|
|
35
39
|
// Lineage Gate - Enforces simulation traceability per ADR-004
|
|
36
40
|
export { checkLineageGate, enforceLineageGate, requiresLineageValidation, LINEAGE_VIOLATION_EXIT_CODE, } from './lineage-gate.js';
|
|
41
|
+
// Ruvector Acceptance Gate - Mandatory blocking persistence (Gate 8)
|
|
42
|
+
export { blockUntilRuvectorAccepts, blockUntilLineageAccepted, buildRuvectorRootedGraph, validateRuvectorRootedGraph, RUVECTOR_ACCEPTANCE_EXIT_CODE, } from './ruvector-acceptance-gate.js';
|
|
43
|
+
// Meta-Simulation Detector - Tier-1 routing for meta-simulation requests
|
|
44
|
+
export { isMetaSimulation, getMetaSimulationTier, buildTier1Route, META_SIMULATION_EXIT_CODE, } from './meta-simulation-detector.js';
|
|
37
45
|
//# sourceMappingURL=index.js.map
|
package/dist/gates/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/gates/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/gates/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,oCAAoC;AACpC,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,2BAA2B,GAG5B,MAAM,qBAAqB,CAAC;AAE7B,qDAAqD;AACrD,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,GAEzB,MAAM,wBAAwB,CAAC;AAEhC,2DAA2D;AAC3D,OAAO,EACL,wBAAwB,EACxB,sBAAsB,EACtB,mBAAmB,EACnB,6BAA6B,EAC7B,kBAAkB,GAGnB,MAAM,0BAA0B,CAAC;AAElC,mDAAmD;AACnD,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,EAChB,wBAAwB,EACxB,wBAAwB,GAEzB,MAAM,yBAAyB,CAAC;AAEjC,6DAA6D;AAC7D,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,GAE3B,MAAM,qBAAqB,CAAC;AAE7B,8DAA8D;AAC9D,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB,EACzB,2BAA2B,GAE5B,MAAM,mBAAmB,CAAC;AAE3B,qEAAqE;AACrE,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACxB,2BAA2B,EAC3B,6BAA6B,GAC9B,MAAM,+BAA+B,CAAC;AAEvC,yEAAyE;AACzE,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,yBAAyB,GAE1B,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meta-Simulation Detector — Thin Passthrough
|
|
3
|
+
*
|
|
4
|
+
* ARCHITECTURE:
|
|
5
|
+
* The CLI does NOT classify whether a request is a meta-simulation.
|
|
6
|
+
* That is platform-side intent classification. The CLI sends the raw
|
|
7
|
+
* description to the platform, which returns tier routing decisions.
|
|
8
|
+
*
|
|
9
|
+
* REMOVED (moved to platform):
|
|
10
|
+
* - META_SIMULATION_PHRASES / phrase matching
|
|
11
|
+
* - META_SIMULATION_KEYWORDS / keyword matching
|
|
12
|
+
* - isMetaSimulation() / local classification logic
|
|
13
|
+
* - buildTier1Route() / confidence scoring + tier routing
|
|
14
|
+
* - getMetaSimulationTier() / local tier assignment
|
|
15
|
+
*
|
|
16
|
+
* WHAT REMAINS:
|
|
17
|
+
* - Type definitions (for contract compatibility)
|
|
18
|
+
* - Exit code constant
|
|
19
|
+
* - Deprecated stubs for callers that haven't migrated
|
|
20
|
+
*/
|
|
21
|
+
export declare const META_SIMULATION_EXIT_CODE = 142;
|
|
22
|
+
/** Tier-1 routing configuration returned by platform */
|
|
23
|
+
export interface Tier1Route {
|
|
24
|
+
tier: 'tier-1';
|
|
25
|
+
endpoint: '/v1/simulate';
|
|
26
|
+
adapter: 'simulation-engine';
|
|
27
|
+
metaSimulation: true;
|
|
28
|
+
confidence: number;
|
|
29
|
+
detectedSignals: string[];
|
|
30
|
+
originalDescription: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Meta-simulation detection is now platform-side.
|
|
34
|
+
* The CLI sends the raw description; the platform classifies it.
|
|
35
|
+
* Always returns false — the platform will route appropriately.
|
|
36
|
+
*/
|
|
37
|
+
export declare function isMetaSimulation(_description: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated Tier routing is now platform-side.
|
|
40
|
+
* Always returns null — the platform determines the tier.
|
|
41
|
+
*/
|
|
42
|
+
export declare function getMetaSimulationTier(_description: string): 'tier-1' | null;
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated Tier-1 route construction is now platform-side.
|
|
45
|
+
* This stub should not be called — the platform returns routing info.
|
|
46
|
+
*/
|
|
47
|
+
export declare function buildTier1Route(_description: string, _correlationId: string): never;
|
|
48
|
+
//# sourceMappingURL=meta-simulation-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta-simulation-detector.d.ts","sourceRoot":"","sources":["../../src/gates/meta-simulation-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAE7C,wDAAwD;AACxD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,EAAE,mBAAmB,CAAC;IAC7B,cAAc,EAAE,IAAI,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,MAAM,GACnB,QAAQ,GAAG,IAAI,CAEjB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,MAAM,GACrB,KAAK,CAKP"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meta-Simulation Detector — Thin Passthrough
|
|
3
|
+
*
|
|
4
|
+
* ARCHITECTURE:
|
|
5
|
+
* The CLI does NOT classify whether a request is a meta-simulation.
|
|
6
|
+
* That is platform-side intent classification. The CLI sends the raw
|
|
7
|
+
* description to the platform, which returns tier routing decisions.
|
|
8
|
+
*
|
|
9
|
+
* REMOVED (moved to platform):
|
|
10
|
+
* - META_SIMULATION_PHRASES / phrase matching
|
|
11
|
+
* - META_SIMULATION_KEYWORDS / keyword matching
|
|
12
|
+
* - isMetaSimulation() / local classification logic
|
|
13
|
+
* - buildTier1Route() / confidence scoring + tier routing
|
|
14
|
+
* - getMetaSimulationTier() / local tier assignment
|
|
15
|
+
*
|
|
16
|
+
* WHAT REMAINS:
|
|
17
|
+
* - Type definitions (for contract compatibility)
|
|
18
|
+
* - Exit code constant
|
|
19
|
+
* - Deprecated stubs for callers that haven't migrated
|
|
20
|
+
*/
|
|
21
|
+
export const META_SIMULATION_EXIT_CODE = 142;
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated Meta-simulation detection is now platform-side.
|
|
24
|
+
* The CLI sends the raw description; the platform classifies it.
|
|
25
|
+
* Always returns false — the platform will route appropriately.
|
|
26
|
+
*/
|
|
27
|
+
export function isMetaSimulation(_description) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated Tier routing is now platform-side.
|
|
32
|
+
* Always returns null — the platform determines the tier.
|
|
33
|
+
*/
|
|
34
|
+
export function getMetaSimulationTier(_description) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated Tier-1 route construction is now platform-side.
|
|
39
|
+
* This stub should not be called — the platform returns routing info.
|
|
40
|
+
*/
|
|
41
|
+
export function buildTier1Route(_description, _correlationId) {
|
|
42
|
+
throw new Error('buildTier1Route() removed: meta-simulation routing is now platform-side. ' +
|
|
43
|
+
'Send the description to the platform and use its routing response.');
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=meta-simulation-detector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta-simulation-detector.js","sourceRoot":"","sources":["../../src/gates/meta-simulation-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAa7C;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,YAAoB;IACnD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACnC,YAAoB;IAEpB,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC7B,YAAoB,EACpB,cAAsB;IAEtB,MAAM,IAAI,KAAK,CACb,2EAA2E;QAC3E,oEAAoE,CACrE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Readiness Gate — Gate 7 (Execution Safety Enforcement)
|
|
3
|
+
*
|
|
4
|
+
* PURPOSE: Enforce that write-path commands (deploy run, erp export in
|
|
5
|
+
* execute mode, rollback, live sync) are blocked when the platform state
|
|
6
|
+
* is INTEGRATION_READY_EXECUTION_GATED. This gate ensures no ERP writes
|
|
7
|
+
* or production deployments occur until all prerequisites are met.
|
|
8
|
+
*
|
|
9
|
+
* INVARIANTS ENFORCED:
|
|
10
|
+
* - No production writes when execution_gate is LOCKED
|
|
11
|
+
* - No deploy run / deploy rollback when connectors are missing
|
|
12
|
+
* - No erp export --mode=execute when systems are BLOCKED
|
|
13
|
+
* - Read-only and integration-mode commands always allowed
|
|
14
|
+
*
|
|
15
|
+
* EXIT CODE: 111 (READINESS_GATE_VIOLATION)
|
|
16
|
+
*
|
|
17
|
+
* BEHAVIOR:
|
|
18
|
+
* - Commands that perform external writes (deploy run, deploy rollback)
|
|
19
|
+
* are blocked when the readiness state has execution_gate.locked = true.
|
|
20
|
+
* - Commands that are read-only (readiness show, inspect, erp list) are
|
|
21
|
+
* always permitted regardless of readiness state.
|
|
22
|
+
* - The gate reads state from ~/.agentics/exports/decision-readiness/readiness-state.json.
|
|
23
|
+
* If the file does not exist, the gate assumes INSPECTION_ONLY (most restrictive).
|
|
24
|
+
*/
|
|
25
|
+
import type { CommandObject } from '../types/index.js';
|
|
26
|
+
export declare const READINESS_GATE_EXIT_CODE = 111;
|
|
27
|
+
/**
|
|
28
|
+
* Canonical readiness states.
|
|
29
|
+
* Transitions: INSPECTION_ONLY -> INTEGRATION_READY_EXECUTION_GATED -> EXECUTION_READY
|
|
30
|
+
*/
|
|
31
|
+
export type ReadinessState = 'INSPECTION_ONLY' | 'INTEGRATION_READY_EXECUTION_GATED' | 'EXECUTION_READY';
|
|
32
|
+
export interface ReadinessGateResult {
|
|
33
|
+
/** Whether the command passed readiness validation */
|
|
34
|
+
allowed: boolean;
|
|
35
|
+
/** Error message if validation failed */
|
|
36
|
+
message: string;
|
|
37
|
+
/** Exit code if validation failed */
|
|
38
|
+
exitCode: number;
|
|
39
|
+
/** Whether this command requires readiness validation */
|
|
40
|
+
readinessRequired: boolean;
|
|
41
|
+
/** Current readiness state (if loaded) */
|
|
42
|
+
state?: ReadinessState;
|
|
43
|
+
}
|
|
44
|
+
export interface ReadinessStateFile {
|
|
45
|
+
schema: string;
|
|
46
|
+
state: ReadinessState;
|
|
47
|
+
simulation_id: string;
|
|
48
|
+
plan_ref: string;
|
|
49
|
+
determined_at: string;
|
|
50
|
+
execution_gate: {
|
|
51
|
+
locked: boolean;
|
|
52
|
+
reason: string;
|
|
53
|
+
prerequisites_total: number;
|
|
54
|
+
prerequisites_completed: number;
|
|
55
|
+
critical_blockers: Array<{
|
|
56
|
+
id: number;
|
|
57
|
+
system: string;
|
|
58
|
+
severity: string;
|
|
59
|
+
effort: string;
|
|
60
|
+
}>;
|
|
61
|
+
};
|
|
62
|
+
integration_readiness: {
|
|
63
|
+
entities_ready: number;
|
|
64
|
+
entities_blocked: number;
|
|
65
|
+
entities_total: number;
|
|
66
|
+
readiness_pct: number;
|
|
67
|
+
systems_ready: string[];
|
|
68
|
+
systems_blocked: string[];
|
|
69
|
+
};
|
|
70
|
+
financial_posture: {
|
|
71
|
+
annual_api_spend_usd: number;
|
|
72
|
+
year1_investment_usd: number;
|
|
73
|
+
annual_savings_usd: number;
|
|
74
|
+
roi_payback_months: number;
|
|
75
|
+
npv_5yr_usd: number;
|
|
76
|
+
};
|
|
77
|
+
audit_matrix: {
|
|
78
|
+
result: string;
|
|
79
|
+
checks_passed: number;
|
|
80
|
+
checks_total: number;
|
|
81
|
+
last_audit: string;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Load readiness state from the canonical artifact path.
|
|
86
|
+
* Returns null if the file does not exist or is invalid.
|
|
87
|
+
*/
|
|
88
|
+
export declare function loadReadinessState(): ReadinessStateFile | null;
|
|
89
|
+
/**
|
|
90
|
+
* Check whether a command passes readiness validation.
|
|
91
|
+
* Returns a result indicating whether the command is allowed.
|
|
92
|
+
*
|
|
93
|
+
* Write-path commands are blocked when:
|
|
94
|
+
* 1. The readiness state file exists AND execution_gate.locked === true
|
|
95
|
+
* 2. The readiness state file does not exist (defaults to most restrictive)
|
|
96
|
+
*
|
|
97
|
+
* Read-only commands always pass.
|
|
98
|
+
*/
|
|
99
|
+
export declare function checkReadinessGate(cmd: CommandObject): ReadinessGateResult;
|
|
100
|
+
/**
|
|
101
|
+
* Enforce readiness gate — exits the process if validation fails.
|
|
102
|
+
*/
|
|
103
|
+
export declare function enforceReadinessGate(cmd: CommandObject): void;
|
|
104
|
+
/**
|
|
105
|
+
* Check if a command requires readiness validation.
|
|
106
|
+
*/
|
|
107
|
+
export declare function requiresReadinessValidation(primary: string, sub?: string): boolean;
|
|
108
|
+
//# sourceMappingURL=readiness-gate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readiness-gate.d.ts","source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