@llm-dev-ops/agentics-cli 1.4.13 → 1.4.15

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 (116) hide show
  1. package/dist/adapters/base-adapter.d.ts.map +1 -1
  2. package/dist/adapters/base-adapter.js +66 -18
  3. package/dist/adapters/base-adapter.js.map +1 -1
  4. package/dist/agents/cli-ux-agent.d.ts +9 -3
  5. package/dist/agents/cli-ux-agent.d.ts.map +1 -1
  6. package/dist/agents/cli-ux-agent.js +13 -67
  7. package/dist/agents/cli-ux-agent.js.map +1 -1
  8. package/dist/agents/decision-event.d.ts +1 -1
  9. package/dist/agents/decision-event.d.ts.map +1 -1
  10. package/dist/agents/decision-event.js +12 -7
  11. package/dist/agents/decision-event.js.map +1 -1
  12. package/dist/auth/internal-allowlist.d.ts +19 -17
  13. package/dist/auth/internal-allowlist.d.ts.map +1 -1
  14. package/dist/auth/internal-allowlist.js +20 -90
  15. package/dist/auth/internal-allowlist.js.map +1 -1
  16. package/dist/auth/role-permissions.d.ts +23 -6
  17. package/dist/auth/role-permissions.d.ts.map +1 -1
  18. package/dist/auth/role-permissions.js +25 -37
  19. package/dist/auth/role-permissions.js.map +1 -1
  20. package/dist/cli/index.js +346 -33
  21. package/dist/cli/index.js.map +1 -1
  22. package/dist/commands/demo.d.ts +30 -0
  23. package/dist/commands/demo.d.ts.map +1 -0
  24. package/dist/commands/demo.js +393 -0
  25. package/dist/commands/demo.js.map +1 -0
  26. package/dist/commands/diligence.d.ts.map +1 -1
  27. package/dist/commands/diligence.js +10 -15
  28. package/dist/commands/diligence.js.map +1 -1
  29. package/dist/commands/export.d.ts.map +1 -1
  30. package/dist/commands/export.js +5 -7
  31. package/dist/commands/export.js.map +1 -1
  32. package/dist/commands/inspect.d.ts +17 -4
  33. package/dist/commands/inspect.d.ts.map +1 -1
  34. package/dist/commands/inspect.js +189 -77
  35. package/dist/commands/inspect.js.map +1 -1
  36. package/dist/commands/quantify.d.ts.map +1 -1
  37. package/dist/commands/quantify.js +12 -0
  38. package/dist/commands/quantify.js.map +1 -1
  39. package/dist/commands/readiness.d.ts +47 -0
  40. package/dist/commands/readiness.d.ts.map +1 -0
  41. package/dist/commands/readiness.js +270 -0
  42. package/dist/commands/readiness.js.map +1 -0
  43. package/dist/commands/simulate.d.ts +6 -0
  44. package/dist/commands/simulate.d.ts.map +1 -1
  45. package/dist/commands/simulate.js +167 -123
  46. package/dist/commands/simulate.js.map +1 -1
  47. package/dist/commands/whoami.js +3 -3
  48. package/dist/commands/whoami.js.map +1 -1
  49. package/dist/config/endpoints.js +2 -2
  50. package/dist/config/endpoints.js.map +1 -1
  51. package/dist/contracts/adr-command-semantics.js +3 -3
  52. package/dist/contracts/adr-command-semantics.js.map +1 -1
  53. package/dist/contracts/canonical.d.ts +207 -0
  54. package/dist/contracts/canonical.d.ts.map +1 -0
  55. package/dist/contracts/canonical.js +191 -0
  56. package/dist/contracts/canonical.js.map +1 -0
  57. package/dist/contracts/index.d.ts +3 -1
  58. package/dist/contracts/index.d.ts.map +1 -1
  59. package/dist/contracts/index.js +2 -0
  60. package/dist/contracts/index.js.map +1 -1
  61. package/dist/contracts/schemas/index.d.ts +194 -5
  62. package/dist/contracts/schemas/index.d.ts.map +1 -1
  63. package/dist/contracts/schemas/index.js +106 -0
  64. package/dist/contracts/schemas/index.js.map +1 -1
  65. package/dist/contracts/validator.d.ts +1 -1
  66. package/dist/contracts/validator.d.ts.map +1 -1
  67. package/dist/contracts/validator.js +17 -5
  68. package/dist/contracts/validator.js.map +1 -1
  69. package/dist/gates/argument-guard.js +1 -1
  70. package/dist/gates/argument-guard.js.map +1 -1
  71. package/dist/gates/execution-gate.d.ts +24 -54
  72. package/dist/gates/execution-gate.d.ts.map +1 -1
  73. package/dist/gates/execution-gate.js +79 -166
  74. package/dist/gates/execution-gate.js.map +1 -1
  75. package/dist/gates/index.d.ts +6 -0
  76. package/dist/gates/index.d.ts.map +1 -1
  77. package/dist/gates/index.js +8 -0
  78. package/dist/gates/index.js.map +1 -1
  79. package/dist/gates/meta-simulation-detector.d.ts +48 -0
  80. package/dist/gates/meta-simulation-detector.d.ts.map +1 -0
  81. package/dist/gates/meta-simulation-detector.js +45 -0
  82. package/dist/gates/meta-simulation-detector.js.map +1 -0
  83. package/dist/gates/readiness-gate.d.ts +108 -0
  84. package/dist/gates/readiness-gate.d.ts.map +1 -0
  85. package/dist/gates/readiness-gate.js +194 -0
  86. package/dist/gates/readiness-gate.js.map +1 -0
  87. package/dist/gates/ruvector-acceptance-gate.d.ts +78 -0
  88. package/dist/gates/ruvector-acceptance-gate.d.ts.map +1 -0
  89. package/dist/gates/ruvector-acceptance-gate.js +191 -0
  90. package/dist/gates/ruvector-acceptance-gate.js.map +1 -0
  91. package/dist/modules/artifact-handoff.d.ts.map +1 -1
  92. package/dist/modules/artifact-handoff.js +26 -0
  93. package/dist/modules/artifact-handoff.js.map +1 -1
  94. package/dist/modules/command-parser.d.ts +1 -1
  95. package/dist/modules/command-parser.d.ts.map +1 -1
  96. package/dist/modules/command-parser.js +3 -1
  97. package/dist/modules/command-parser.js.map +1 -1
  98. package/dist/modules/output-renderer.d.ts +13 -1
  99. package/dist/modules/output-renderer.d.ts.map +1 -1
  100. package/dist/modules/output-renderer.js +68 -0
  101. package/dist/modules/output-renderer.js.map +1 -1
  102. package/dist/runtime/claude-code-runner.d.ts.map +1 -1
  103. package/dist/runtime/claude-code-runner.js +165 -0
  104. package/dist/runtime/claude-code-runner.js.map +1 -1
  105. package/dist/synthesis/dynamic-router.d.ts +80 -0
  106. package/dist/synthesis/dynamic-router.d.ts.map +1 -0
  107. package/dist/synthesis/dynamic-router.js +63 -0
  108. package/dist/synthesis/dynamic-router.js.map +1 -0
  109. package/dist/synthesis/prompts/index.d.ts.map +1 -1
  110. package/dist/synthesis/prompts/index.js +100 -23
  111. package/dist/synthesis/prompts/index.js.map +1 -1
  112. package/dist/types/index.d.ts +59 -0
  113. package/dist/types/index.d.ts.map +1 -1
  114. package/dist/types/index.js +8 -0
  115. package/dist/types/index.js.map +1 -1
  116. package/package.json +1 -1
@@ -1,38 +1,20 @@
1
1
  /**
2
- * Execution Gate Module
2
+ * Execution Gate Module — Credential Pre-flight
3
3
  *
4
- * PURPOSE: Global execution gate that controls command access based on
5
- * user entitlement (internal email or paid API key).
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
- * ENTITLEMENTS:
8
- * - "internal" - Internal maintainers (allow-listed by email)
9
- * - "paid" - Users with a valid API key
10
- * - "none" - No entitlement, blocked from operational commands
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`
12
+ * 3. GCP credentials from `gcloud auth login`
11
13
  *
12
- * LOGIC:
13
- * - Identity commands (login, logout, whoami, help, version) always allowed
14
- * - Internal or paid users get full access to all commands
15
- * - Users with no entitlement are blocked
16
- */
17
- /**
18
- * Entitlement types supported by the execution gate.
14
+ * If any credential exists, the request proceeds and the platform
15
+ * enforces actual policy.
19
16
  */
20
17
  export type Entitlement = 'internal' | 'paid' | 'none';
21
- /**
22
- * Resolve the entitlement for the currently authenticated user.
23
- *
24
- * Checks in order:
25
- * 1. AGENTICS_USER_EMAIL environment variable
26
- * 2. Email stored in credentials file (~/.agentics/credentials.json)
27
- * 3. gcloud authenticated account
28
- *
29
- * @returns The user's entitlement: 'internal' for allow-listed users, 'none' otherwise
30
- */
31
- export declare function resolveEntitlement(): Entitlement;
32
- /**
33
- * Exit code for blocked execution.
34
- * Uses PERMISSION_DENIED (77) to indicate access is denied.
35
- */
36
18
  export declare const EXECUTION_BLOCKED_EXIT_CODE: 77;
37
19
  export interface ExecutionGateResult {
38
20
  allowed: boolean;
@@ -42,38 +24,26 @@ export interface ExecutionGateResult {
42
24
  /**
43
25
  * Check if a command is allowed to execute.
44
26
  *
45
- * This is the SINGLE, CENTRALIZED execution gate.
46
- * It must be called BEFORE:
47
- * - command parsing (post-parse)
48
- * - network calls
49
- * - domain service invocation
50
- *
51
- * Execution flow:
52
- * 1. Always allow identity and help commands
53
- * 2. Resolve user entitlement
54
- * 3. If entitlement === "internal" or "paid" → allow execution
55
- * 4. Otherwise → block execution
56
- *
57
- * @param command - The command name (e.g., 'plan', 'simulate', 'login')
58
- * @returns ExecutionGateResult indicating if execution is allowed
27
+ * For identity/help commands: always allowed (transport-level).
28
+ * For all other commands: checks whether any credential source exists.
29
+ * The platform decides actual authorization when the request arrives.
59
30
  */
60
- export declare function checkExecutionGate(command: string): ExecutionGateResult;
31
+ export declare function checkExecutionGate(command: string): Promise<ExecutionGateResult>;
61
32
  /**
62
33
  * Enforce the execution gate. Exits the process if blocked.
63
- *
64
- * @param command - The command name to check
65
34
  */
66
- export declare function enforceExecutionGate(command: string): void;
35
+ export declare function enforceExecutionGate(command: string): Promise<void>;
67
36
  /**
68
- * Check if execution is enabled for the current user.
69
- *
70
- * @returns true if the user has internal or paid entitlement
37
+ * @deprecated Entitlement resolution is now platform-side.
38
+ * This stub checks for credential presence only — not entitlement type.
71
39
  */
72
- export declare function isExecutionEnabled(): boolean;
40
+ export declare function resolveEntitlement(): Entitlement;
73
41
  /**
74
- * Get the list of commands that are always allowed.
75
- *
76
- * @returns Set of allowed command names
42
+ * @deprecated Use checkExecutionGate() instead.
43
+ */
44
+ export declare function isExecutionEnabled(): Promise<boolean>;
45
+ /**
46
+ * Get the list of commands that bypass the execution gate.
77
47
  */
78
48
  export declare function getAllowedCommands(): ReadonlySet<string>;
79
49
  //# sourceMappingURL=execution-gate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"execution-gate.d.ts","sourceRoot":"","sources":["../../src/gates/execution-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AA6BH;;GAEG;AACH,MAAM,MAAM,WAAW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ACH,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,OAAO,CAAC,CAG3D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,WAAW,CAAC,MAAM,CAAC,CAExD"}
@@ -1,30 +1,30 @@
1
1
  /**
2
- * Execution Gate Module
2
+ * Execution Gate Module — Credential Pre-flight
3
3
  *
4
- * PURPOSE: Global execution gate that controls command access based on
5
- * user entitlement (internal email or paid API key).
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
- * ENTITLEMENTS:
8
- * - "internal" - Internal maintainers (allow-listed by email)
9
- * - "paid" - Users with a valid API key
10
- * - "none" - No entitlement, blocked from operational commands
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`
12
+ * 3. GCP credentials from `gcloud auth login`
11
13
  *
12
- * LOGIC:
13
- * - Identity commands (login, logout, whoami, help, version) always allowed
14
- * - Internal or paid users get full access to all commands
15
- * - Users with no entitlement are blocked
14
+ * If any credential exists, the request proceeds and the platform
15
+ * enforces actual policy.
16
16
  */
17
- import * as fs from 'node:fs';
18
- import * as path from 'node:path';
19
- import * as os from 'node:os';
20
17
  import { EXIT_CODES } from '../types/index.js';
21
- import { getActiveAccount } from '../auth/gcp-identity.js';
18
+ import { hasValidCredentials } from '../auth/gcp-identity.js';
19
+ import { createCredentialStore } from '../utils/credentials.js';
22
20
  // ============================================================================
23
- // Execution Gate Configuration
21
+ // Constants
24
22
  // ============================================================================
25
23
  /**
26
- * Commands that are ALWAYS allowed, regardless of entitlement.
27
- * These are identity and help commands only.
24
+ * Commands that bypass the execution gate entirely.
25
+ * These are identity bootstrapping and help commands — the CLI must
26
+ * allow them so the user can authenticate in the first place.
27
+ * This is transport-level routing, not policy enforcement.
28
28
  */
29
29
  const ALLOWED_COMMANDS = new Set([
30
30
  'login',
@@ -32,160 +32,69 @@ const ALLOWED_COMMANDS = new Set([
32
32
  'whoami',
33
33
  'help',
34
34
  'version',
35
+ 'demo',
35
36
  ]);
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
37
  export const EXECUTION_BLOCKED_EXIT_CODE = EXIT_CODES.PERMISSION_DENIED;
143
- // ============================================================================
144
- // Execution Gate Error Message
145
- // ============================================================================
146
38
  const BLOCKED_MESSAGE = `
147
39
  ❌ Execution Disabled
148
40
 
149
41
  This command requires an active Agentics execution environment.
150
42
 
151
- The Agentics CLI is currently in explore-only mode.
43
+ No valid credentials found. To authenticate:
44
+
45
+ Option 1: Platform login (recommended)
46
+ agentics login
152
47
 
153
- Contact the Agentics team to enable execution.
48
+ Option 2: API key via environment variable
49
+ export AGENTICS_API_KEY=agentics_sk_...
50
+
51
+ Option 3: GCP authentication
52
+ gcloud auth login
154
53
  `.trim();
54
+ // ============================================================================
55
+ // Execution Gate — Credential Pre-flight
56
+ // ============================================================================
155
57
  /**
156
58
  * Check if a command is allowed to execute.
157
59
  *
158
- * This is the SINGLE, CENTRALIZED execution gate.
159
- * It must be called BEFORE:
160
- * - command parsing (post-parse)
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
60
+ * For identity/help commands: always allowed (transport-level).
61
+ * For all other commands: checks whether any credential source exists.
62
+ * The platform decides actual authorization when the request arrives.
172
63
  */
173
- export function checkExecutionGate(command) {
174
- // Always allow identity and help commands
64
+ export async function checkExecutionGate(command) {
65
+ // Identity/help commands always allowed transport-level bypass
175
66
  if (ALLOWED_COMMANDS.has(command)) {
176
67
  return { allowed: true };
177
68
  }
178
- // Resolve entitlement before applying execution gate
179
- const entitlement = resolveEntitlement();
180
- // Internal users have full access
181
- if (entitlement === 'internal') {
69
+ // 1. Check environment variables
70
+ const hasEnvCredentials = !!(process.env['AGENTICS_API_KEY'] ||
71
+ process.env['AGENTICS_AUTH_TOKEN'] ||
72
+ process.env['AGENTICS_USER_EMAIL'] ||
73
+ process.env['AGENTICS_INTERNAL_KEY']);
74
+ if (hasEnvCredentials) {
182
75
  return { allowed: true };
183
76
  }
184
- // Paid users have full access
185
- if (entitlement === 'paid') {
186
- return { allowed: true };
77
+ // 2. Check stored credentials from `agentics login`
78
+ try {
79
+ const store = createCredentialStore();
80
+ const credentials = await store.load();
81
+ if (credentials && credentials.api_key) {
82
+ return { allowed: true };
83
+ }
84
+ }
85
+ catch {
86
+ // Stored credential check failed — continue to next source
87
+ }
88
+ // 3. Check GCP credentials from `gcloud auth login`
89
+ try {
90
+ if (hasValidCredentials()) {
91
+ return { allowed: true };
92
+ }
93
+ }
94
+ catch {
95
+ // GCP credential check failed — continue
187
96
  }
188
- // Block all other commands
97
+ // No credentials found from any source
189
98
  return {
190
99
  allowed: false,
191
100
  exitCode: EXECUTION_BLOCKED_EXIT_CODE,
@@ -194,29 +103,33 @@ export function checkExecutionGate(command) {
194
103
  }
195
104
  /**
196
105
  * Enforce the execution gate. Exits the process if blocked.
197
- *
198
- * @param command - The command name to check
199
106
  */
200
- export function enforceExecutionGate(command) {
201
- const result = checkExecutionGate(command);
107
+ export async function enforceExecutionGate(command) {
108
+ const result = await checkExecutionGate(command);
202
109
  if (!result.allowed) {
203
110
  console.error(result.message);
204
111
  process.exit(result.exitCode);
205
112
  }
206
113
  }
207
114
  /**
208
- * Check if execution is enabled for the current user.
209
- *
210
- * @returns true if the user has internal or paid entitlement
115
+ * @deprecated Entitlement resolution is now platform-side.
116
+ * This stub checks for credential presence only — not entitlement type.
211
117
  */
212
- export function isExecutionEnabled() {
213
- const entitlement = resolveEntitlement();
214
- return entitlement === 'internal' || entitlement === 'paid';
118
+ export function resolveEntitlement() {
119
+ const hasCredentials = !!(process.env['AGENTICS_API_KEY'] ||
120
+ process.env['AGENTICS_AUTH_TOKEN'] ||
121
+ process.env['AGENTICS_INTERNAL_KEY']);
122
+ return hasCredentials ? 'paid' : 'none';
215
123
  }
216
124
  /**
217
- * Get the list of commands that are always allowed.
218
- *
219
- * @returns Set of allowed command names
125
+ * @deprecated Use checkExecutionGate() instead.
126
+ */
127
+ export async function isExecutionEnabled() {
128
+ const result = await checkExecutionGate('_check');
129
+ return result.allowed;
130
+ }
131
+ /**
132
+ * Get the list of commands that bypass the execution gate.
220
133
  */
221
134
  export function getAllowedCommands() {
222
135
  return ALLOWED_COMMANDS;
@@ -1 +1 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kB;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"}
@@ -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;;;;;;;;;;;;;;;;;;;;;;;GAuBG;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"}
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"}
@@ -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
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/gates/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;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"}
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"}