@llm-dev-ops/agentics-cli 1.4.1 → 1.4.6
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/dist/adapters/base-adapter.d.ts.map +1 -1
- package/dist/adapters/base-adapter.js +2 -41
- package/dist/adapters/base-adapter.js.map +1 -1
- package/dist/agents/cli-ux-agent.d.ts.map +1 -1
- package/dist/agents/cli-ux-agent.js +2 -1
- package/dist/agents/cli-ux-agent.js.map +1 -1
- package/dist/cli/index.js +155 -38
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/deploy.d.ts +4 -4
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +83 -21
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/erp.d.ts +1 -1
- package/dist/commands/erp.d.ts.map +1 -1
- package/dist/commands/erp.js +3 -5
- package/dist/commands/erp.js.map +1 -1
- package/dist/commands/export.d.ts +5 -5
- package/dist/commands/export.js +5 -5
- package/dist/commands/inspect.d.ts +28 -0
- package/dist/commands/inspect.d.ts.map +1 -1
- package/dist/commands/inspect.js +113 -0
- package/dist/commands/inspect.js.map +1 -1
- package/dist/commands/login.d.ts +8 -6
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +146 -89
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/plan.d.ts +8 -5
- package/dist/commands/plan.d.ts.map +1 -1
- package/dist/commands/plan.js +84 -60
- package/dist/commands/plan.js.map +1 -1
- package/dist/commands/policy.d.ts +53 -0
- package/dist/commands/policy.d.ts.map +1 -1
- package/dist/commands/policy.js +201 -5
- package/dist/commands/policy.js.map +1 -1
- package/dist/commands/quantify.d.ts +1 -1
- package/dist/commands/quantify.d.ts.map +1 -1
- package/dist/commands/quantify.js +2 -4
- package/dist/commands/quantify.js.map +1 -1
- package/dist/commands/simulate.d.ts +3 -2
- package/dist/commands/simulate.d.ts.map +1 -1
- package/dist/commands/simulate.js +97 -36
- package/dist/commands/simulate.js.map +1 -1
- package/dist/commands/usage.d.ts +3 -3
- package/dist/commands/usage.js +7 -7
- package/dist/commands/usage.js.map +1 -1
- package/dist/commands/whoami.d.ts +2 -0
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +25 -5
- package/dist/commands/whoami.js.map +1 -1
- package/dist/gates/auth-session-gate.d.ts +47 -0
- package/dist/gates/auth-session-gate.d.ts.map +1 -0
- package/dist/gates/auth-session-gate.js +151 -0
- package/dist/gates/auth-session-gate.js.map +1 -0
- package/dist/gates/execution-gate.d.ts +12 -17
- package/dist/gates/execution-gate.d.ts.map +1 -1
- package/dist/gates/execution-gate.js +74 -46
- package/dist/gates/execution-gate.js.map +1 -1
- package/dist/gates/index.d.ts +20 -2
- package/dist/gates/index.d.ts.map +1 -1
- package/dist/gates/index.js +24 -2
- package/dist/gates/index.js.map +1 -1
- package/dist/gates/output-format-gate.d.ts +54 -0
- package/dist/gates/output-format-gate.d.ts.map +1 -0
- package/dist/gates/output-format-gate.js +136 -0
- package/dist/gates/output-format-gate.js.map +1 -0
- package/dist/gates/service-health-gate.d.ts +56 -0
- package/dist/gates/service-health-gate.d.ts.map +1 -0
- package/dist/gates/service-health-gate.js +179 -0
- package/dist/gates/service-health-gate.js.map +1 -0
- package/dist/server/routes/auth.d.ts.map +1 -1
- package/dist/server/routes/auth.js +45 -8
- package/dist/server/routes/auth.js.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/commands/login.js
CHANGED
|
@@ -3,45 +3,77 @@
|
|
|
3
3
|
*
|
|
4
4
|
* SPARC Architecture Reference: CLI Authentication
|
|
5
5
|
*
|
|
6
|
-
* PURPOSE:
|
|
6
|
+
* PURPOSE: Authenticate the CLI via browser-based auth with API key paste-back.
|
|
7
7
|
*
|
|
8
8
|
* WORKFLOW:
|
|
9
|
-
* 1.
|
|
10
|
-
* 2.
|
|
11
|
-
* 3.
|
|
12
|
-
* 4.
|
|
13
|
-
* 5.
|
|
9
|
+
* 1. Create auth session on the platform backend
|
|
10
|
+
* 2. Open browser to the verification URL where user authenticates
|
|
11
|
+
* 3. Browser shows a copyable API key after authentication
|
|
12
|
+
* 4. CLI prompts user to paste the API key
|
|
13
|
+
* 5. CLI polls the session to resolve the user's email and payment status
|
|
14
|
+
* 6. CLI presents terms and conditions for acceptance
|
|
15
|
+
* 7. Store credentials locally
|
|
14
16
|
*
|
|
15
17
|
* FORBIDDEN:
|
|
16
18
|
* - Storing credentials in plaintext in code
|
|
17
19
|
* - Logging credential values
|
|
18
20
|
* - Bypassing the authorization flow
|
|
19
21
|
*/
|
|
22
|
+
import * as readline from 'node:readline';
|
|
20
23
|
import { AuthError } from '../errors/index.js';
|
|
21
24
|
import { createCredentialStore } from '../utils/credentials.js';
|
|
22
25
|
// ============================================================================
|
|
23
26
|
// Configuration
|
|
24
27
|
// ============================================================================
|
|
25
28
|
import { isLocalhostUrl, isLocalDevMode, LocalhostInProductionError } from '../config/endpoints.js';
|
|
26
|
-
// Platform URL for authentication - uses AGENTICS_PLATFORM_URL for consistency with docs
|
|
27
29
|
const PLATFORM_URL = process.env['AGENTICS_PLATFORM_URL'] ?? 'https://platform.agentics.dev';
|
|
28
30
|
const CLI_NAME = 'Agentics CLI';
|
|
29
|
-
const CLI_VERSION = '1.4.
|
|
30
|
-
const DEFAULT_POLL_INTERVAL = 5000; // 5 seconds
|
|
31
|
-
/**
|
|
32
|
-
* Validate platform URL - apply same localhost safeguard as other endpoints
|
|
33
|
-
*/
|
|
31
|
+
const CLI_VERSION = '1.4.5';
|
|
34
32
|
function validatePlatformUrl() {
|
|
35
33
|
if (isLocalhostUrl(PLATFORM_URL) && !isLocalDevMode()) {
|
|
36
34
|
throw new LocalhostInProductionError('agentics-platform', PLATFORM_URL);
|
|
37
35
|
}
|
|
38
36
|
}
|
|
39
|
-
|
|
37
|
+
// ============================================================================
|
|
38
|
+
// Terms and Conditions
|
|
39
|
+
// ============================================================================
|
|
40
|
+
const TERMS_AND_CONDITIONS = `
|
|
41
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
42
|
+
AGENTICS PLATFORM - TERMS OF SERVICE
|
|
43
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
44
|
+
|
|
45
|
+
By using the Agentics CLI and platform services, you agree to:
|
|
46
|
+
|
|
47
|
+
1. ACCEPTABLE USE
|
|
48
|
+
You will use the platform only for lawful purposes and in
|
|
49
|
+
accordance with the Agentics Acceptable Use Policy.
|
|
50
|
+
|
|
51
|
+
2. API KEY SECURITY
|
|
52
|
+
You are responsible for keeping your API key secure. Do not
|
|
53
|
+
share your key or commit it to version control.
|
|
54
|
+
|
|
55
|
+
3. DATA HANDLING
|
|
56
|
+
The platform processes data you submit for simulation,
|
|
57
|
+
planning, and deployment operations. You retain ownership
|
|
58
|
+
of your data.
|
|
59
|
+
|
|
60
|
+
4. SERVICE AVAILABILITY
|
|
61
|
+
The platform is provided "as is". Agentics makes no
|
|
62
|
+
guarantees of uptime or availability.
|
|
63
|
+
|
|
64
|
+
5. USAGE LIMITS
|
|
65
|
+
Your account is subject to usage limits based on your plan.
|
|
66
|
+
Exceeding limits may result in throttling or suspension.
|
|
67
|
+
|
|
68
|
+
Full terms: https://agentics.dev/terms
|
|
69
|
+
Privacy policy: https://agentics.dev/privacy
|
|
70
|
+
|
|
71
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
72
|
+
`.trim();
|
|
40
73
|
// ============================================================================
|
|
41
74
|
// Login Command Implementation
|
|
42
75
|
// ============================================================================
|
|
43
76
|
export async function executeLoginCommand(input, options) {
|
|
44
|
-
// Validate platform URL - fail fast if localhost without local dev mode
|
|
45
77
|
validatePlatformUrl();
|
|
46
78
|
const correlationId = options.trace_id ?? crypto.randomUUID();
|
|
47
79
|
const credentialStore = createCredentialStore();
|
|
@@ -52,7 +84,7 @@ export async function executeLoginCommand(input, options) {
|
|
|
52
84
|
console.error('Existing credentials found. Re-authenticating...');
|
|
53
85
|
}
|
|
54
86
|
}
|
|
55
|
-
// Step 1:
|
|
87
|
+
// Step 1: Create auth session on the platform
|
|
56
88
|
console.log('');
|
|
57
89
|
console.log('Initiating authentication...');
|
|
58
90
|
let session;
|
|
@@ -66,58 +98,85 @@ export async function executeLoginCommand(input, options) {
|
|
|
66
98
|
correlationId,
|
|
67
99
|
});
|
|
68
100
|
}
|
|
69
|
-
// Step 2:
|
|
101
|
+
// Step 2: Open browser to verification URL
|
|
70
102
|
console.log('');
|
|
71
|
-
console.log('
|
|
103
|
+
console.log('Open this URL in your browser to authenticate:');
|
|
72
104
|
console.log('');
|
|
73
105
|
console.log(` ${session.verification_url}`);
|
|
74
106
|
console.log('');
|
|
75
|
-
console.log(`Your verification code: ${session.user_code}`);
|
|
76
|
-
console.log('');
|
|
77
|
-
// Step 3: Optionally open URL in browser
|
|
78
107
|
if (!input.noBrowser) {
|
|
79
108
|
await openBrowser(session.verification_url, options);
|
|
80
109
|
console.log('(Browser opened automatically)');
|
|
81
110
|
console.log('');
|
|
82
111
|
}
|
|
83
|
-
console.log('
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
112
|
+
console.log('After authenticating, copy the API key shown in your browser.');
|
|
113
|
+
console.log('');
|
|
114
|
+
// Step 3: Prompt user to paste API key
|
|
115
|
+
const apiKey = await promptForApiKey();
|
|
116
|
+
if (!apiKey) {
|
|
117
|
+
throw new AuthError({
|
|
118
|
+
type: 'denied',
|
|
119
|
+
message: 'No API key provided. Authentication cancelled.',
|
|
120
|
+
correlationId,
|
|
121
|
+
});
|
|
92
122
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
throw error;
|
|
96
|
-
}
|
|
123
|
+
// Validate key format
|
|
124
|
+
if (!apiKey.startsWith('agentics_sk_')) {
|
|
97
125
|
throw new AuthError({
|
|
98
|
-
type: '
|
|
99
|
-
message:
|
|
126
|
+
type: 'denied',
|
|
127
|
+
message: 'Invalid API key format. Keys start with "agentics_sk_". Please try again.',
|
|
100
128
|
correlationId,
|
|
101
129
|
});
|
|
102
130
|
}
|
|
103
|
-
|
|
131
|
+
console.log('');
|
|
132
|
+
console.log('Verifying...');
|
|
133
|
+
// Step 4: Poll session to resolve email and payment status
|
|
134
|
+
let email;
|
|
135
|
+
let userId;
|
|
136
|
+
let paymentStatus = 'unknown';
|
|
137
|
+
try {
|
|
138
|
+
const sessionData = await fetchSessionData(session.device_code, correlationId);
|
|
139
|
+
if (sessionData) {
|
|
140
|
+
email = sessionData.email;
|
|
141
|
+
userId = sessionData.user_id;
|
|
142
|
+
paymentStatus = sessionData.payment_status ?? 'unknown';
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
// Session data fetch failed — proceed with key only.
|
|
147
|
+
// The key itself is the proof of authentication.
|
|
148
|
+
if (options.verbose) {
|
|
149
|
+
console.error('Could not fetch session metadata. Proceeding with API key only.');
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
// Step 5: Show terms and conditions
|
|
153
|
+
console.log('');
|
|
154
|
+
console.log(TERMS_AND_CONDITIONS);
|
|
155
|
+
console.log('');
|
|
156
|
+
const accepted = await promptForTermsAcceptance();
|
|
157
|
+
if (!accepted) {
|
|
104
158
|
throw new AuthError({
|
|
105
|
-
type: '
|
|
106
|
-
message: '
|
|
159
|
+
type: 'denied',
|
|
160
|
+
message: 'You must accept the terms of service to use the Agentics CLI.',
|
|
107
161
|
correlationId,
|
|
108
162
|
});
|
|
109
163
|
}
|
|
110
|
-
// Step
|
|
111
|
-
const userEmail = process.env['AGENTICS_USER_EMAIL'];
|
|
164
|
+
// Step 6: Store credentials
|
|
112
165
|
await credentialStore.save({
|
|
113
166
|
api_key: apiKey,
|
|
114
167
|
created_at: new Date().toISOString(),
|
|
115
|
-
email
|
|
168
|
+
email,
|
|
169
|
+
user_id: userId,
|
|
170
|
+
payment_status: paymentStatus,
|
|
116
171
|
});
|
|
117
172
|
const credentialsPath = credentialStore.getCredentialsPath?.() ?? '~/.agentics/credentials.json';
|
|
118
173
|
console.log('');
|
|
119
|
-
console.log('
|
|
120
|
-
|
|
174
|
+
console.log('Authentication successful!');
|
|
175
|
+
if (email) {
|
|
176
|
+
console.log(` Logged in as: ${email}`);
|
|
177
|
+
}
|
|
178
|
+
console.log(` Credentials stored at: ${credentialsPath}`);
|
|
179
|
+
console.log('');
|
|
121
180
|
return {
|
|
122
181
|
success: true,
|
|
123
182
|
message: 'Authentication successful',
|
|
@@ -149,14 +208,14 @@ async function createAuthSession(correlationId, options) {
|
|
|
149
208
|
}
|
|
150
209
|
return data;
|
|
151
210
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
211
|
+
/**
|
|
212
|
+
* Fetch session data once to resolve email and payment status.
|
|
213
|
+
* The session should be completed by the time the user has their API key.
|
|
214
|
+
*/
|
|
215
|
+
async function fetchSessionData(deviceCode, correlationId) {
|
|
216
|
+
// Try a few times since there may be a brief delay between the user
|
|
217
|
+
// copying the key and the session being marked complete
|
|
218
|
+
for (let attempt = 0; attempt < 5; attempt++) {
|
|
160
219
|
try {
|
|
161
220
|
const response = await fetch(`${PLATFORM_URL}/v1/cli/auth/sessions/${deviceCode}`, {
|
|
162
221
|
headers: {
|
|
@@ -164,48 +223,48 @@ async function pollForCompletion(deviceCode, intervalMs, correlationId, options)
|
|
|
164
223
|
},
|
|
165
224
|
});
|
|
166
225
|
if (!response.ok) {
|
|
167
|
-
|
|
168
|
-
throw new AuthError({
|
|
169
|
-
type: 'expired',
|
|
170
|
-
message: 'Session not found or expired.',
|
|
171
|
-
correlationId,
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
continue; // Retry on other errors
|
|
226
|
+
return null;
|
|
175
227
|
}
|
|
176
228
|
const result = await response.json();
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
return result.api_key;
|
|
180
|
-
case 'denied':
|
|
181
|
-
throw new AuthError({
|
|
182
|
-
type: 'denied',
|
|
183
|
-
message: 'Authorization was denied by the user.',
|
|
184
|
-
correlationId,
|
|
185
|
-
});
|
|
186
|
-
case 'expired':
|
|
187
|
-
throw new AuthError({
|
|
188
|
-
type: 'expired',
|
|
189
|
-
message: 'Authentication session expired.',
|
|
190
|
-
correlationId,
|
|
191
|
-
});
|
|
192
|
-
case 'pending':
|
|
193
|
-
// Show progress indicator
|
|
194
|
-
process.stdout.write('.');
|
|
195
|
-
break;
|
|
229
|
+
if (result.status === 'completed') {
|
|
230
|
+
return result;
|
|
196
231
|
}
|
|
232
|
+
// Brief wait between attempts
|
|
233
|
+
await sleep(1000);
|
|
197
234
|
}
|
|
198
|
-
catch
|
|
199
|
-
|
|
200
|
-
throw error;
|
|
201
|
-
}
|
|
202
|
-
// Network error, continue polling
|
|
203
|
-
if (options.verbose) {
|
|
204
|
-
console.error(`Poll error: ${error instanceof Error ? error.message : 'Unknown'}`);
|
|
205
|
-
}
|
|
235
|
+
catch {
|
|
236
|
+
return null;
|
|
206
237
|
}
|
|
207
238
|
}
|
|
208
|
-
return
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
// ============================================================================
|
|
242
|
+
// Interactive Prompts
|
|
243
|
+
// ============================================================================
|
|
244
|
+
function promptForApiKey() {
|
|
245
|
+
return new Promise((resolve) => {
|
|
246
|
+
const rl = readline.createInterface({
|
|
247
|
+
input: process.stdin,
|
|
248
|
+
output: process.stderr,
|
|
249
|
+
});
|
|
250
|
+
rl.question('Paste your API key: ', (answer) => {
|
|
251
|
+
rl.close();
|
|
252
|
+
resolve(answer.trim());
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
function promptForTermsAcceptance() {
|
|
257
|
+
return new Promise((resolve) => {
|
|
258
|
+
const rl = readline.createInterface({
|
|
259
|
+
input: process.stdin,
|
|
260
|
+
output: process.stderr,
|
|
261
|
+
});
|
|
262
|
+
rl.question('Do you accept the terms of service? (yes/no): ', (answer) => {
|
|
263
|
+
rl.close();
|
|
264
|
+
const normalized = answer.trim().toLowerCase();
|
|
265
|
+
resolve(normalized === 'yes' || normalized === 'y');
|
|
266
|
+
});
|
|
267
|
+
});
|
|
209
268
|
}
|
|
210
269
|
// ============================================================================
|
|
211
270
|
// Helper Functions
|
|
@@ -227,7 +286,6 @@ async function openBrowser(url, options) {
|
|
|
227
286
|
command = `start "" "${url}"`;
|
|
228
287
|
}
|
|
229
288
|
else {
|
|
230
|
-
// Linux and others
|
|
231
289
|
command = `xdg-open "${url}" 2>/dev/null || sensible-browser "${url}" 2>/dev/null || x-www-browser "${url}" 2>/dev/null`;
|
|
232
290
|
}
|
|
233
291
|
await execAsync(command);
|
|
@@ -236,7 +294,6 @@ async function openBrowser(url, options) {
|
|
|
236
294
|
}
|
|
237
295
|
}
|
|
238
296
|
catch {
|
|
239
|
-
// Browser opening failed, user can manually navigate
|
|
240
297
|
if (options.verbose) {
|
|
241
298
|
console.error('Could not open browser automatically. Please navigate to the URL manually.');
|
|
242
299
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yB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AElC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QAClC,IAAI,OAAe,CAAC;QAEpB,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;YAC1B,OAAO,GAAG,SAAS,GAAG,GAAG,CAAC;QAC5B,CAAC;aAAM,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;YAChC,OAAO,GAAG,aAAa,GAAG,GAAG,CAAC;QAChC,CAAC;aAAM,CAAC;YACN,OAAO,GAAG,aAAa,GAAG,sCAAsC,GAAG,mCAAmC,GAAG,eAAe,CAAC;QAC3H,CAAC;QAED,MAAM,SAAS,CAAC,OAAO,CAAC,CAAC;QAEzB,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,4EAA4E,CAAC,CAAC;QAC9F,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/commands/plan.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* - list List all plans from Ruvector
|
|
12
12
|
* - inspect Retrieve a specific plan by ID from Ruvector (NO PLANNER CALLS)
|
|
13
13
|
* - delete Delete a plan from Ruvector
|
|
14
|
-
* - approve
|
|
14
|
+
* - approve Approve a plan and persist status change
|
|
15
15
|
*
|
|
16
16
|
* CRITICAL RULES:
|
|
17
17
|
* - plan inspect MUST NOT call planner
|
|
@@ -133,7 +133,10 @@ export declare function executePlanListCommand(input: PlanListInput, options: Co
|
|
|
133
133
|
*/
|
|
134
134
|
export declare function formatPlansListForDisplay(plans: PlanSummary[]): string;
|
|
135
135
|
/**
|
|
136
|
-
* Create a new plan record
|
|
136
|
+
* Create a new plan record.
|
|
137
|
+
*
|
|
138
|
+
* Plans are persisted in the Ruvector backend service (same as list/inspect/approve).
|
|
139
|
+
* The CLI is a thin client - no local filesystem writes.
|
|
137
140
|
*/
|
|
138
141
|
export declare function executePlanCreateCommand(input: PlanCreateInput, options: CommandOptions): Promise<PlanCreateResult>;
|
|
139
142
|
/**
|
|
@@ -157,10 +160,10 @@ export declare function executePlanInspectCommand(input: PlanInspectInput, optio
|
|
|
157
160
|
*/
|
|
158
161
|
export declare function executePlanDeleteCommand(input: PlanDeleteInput, options: CommandOptions): Promise<PlanDeleteResult>;
|
|
159
162
|
/**
|
|
160
|
-
* Approve a plan
|
|
163
|
+
* Approve a plan.
|
|
161
164
|
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
165
|
+
* Verifies the plan exists in Ruvector and marks it as approved.
|
|
166
|
+
* For authorized users (internal email or paid API key), this performs real approval.
|
|
164
167
|
*/
|
|
165
168
|
export declare function executePlanApproveCommand(input: PlanApproveInput, options: CommandOptions): Promise<PlanApproveResult>;
|
|
166
169
|
//# sourceMappingURL=plan.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/commands/plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/commands/plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACd,MAAM,mBAAmB,CAAC;AA2B3B,eAAO,MAAM,eAAe;;;;;;;;CAQlB,CAAC;AAuEX;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;C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AAM,CAmBtE;AAMD;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAC5C,KAAK,EAAE,eAAe,EACtB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,gBAAgB,CAAC,CA8E3B;AAED;;GAEG;AACH;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,iBAAiB,CAAC,CA2F5B;AAED;;GAEG;AACH;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,KAAK,EAAE,eAAe,EACtB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,gBAAgB,CAAC,CAkD3B;AAED;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,iBAAiB,CAAC,CAkF5B"}
|
package/dist/commands/plan.js
CHANGED
|
@@ -11,18 +11,17 @@
|
|
|
11
11
|
* - list List all plans from Ruvector
|
|
12
12
|
* - inspect Retrieve a specific plan by ID from Ruvector (NO PLANNER CALLS)
|
|
13
13
|
* - delete Delete a plan from Ruvector
|
|
14
|
-
* - approve
|
|
14
|
+
* - approve Approve a plan and persist status change
|
|
15
15
|
*
|
|
16
16
|
* CRITICAL RULES:
|
|
17
17
|
* - plan inspect MUST NOT call planner
|
|
18
18
|
* - plan inspect MUST NOT interpret UUID as intent
|
|
19
19
|
* - Persistence is mandatory - failure to persist = command failure
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
|
-
import * as path from 'node:path';
|
|
21
|
+
// NOTE: fs and path imports removed - plan create now uses backend persistence
|
|
23
22
|
import * as crypto from 'node:crypto';
|
|
24
23
|
import { ManifestsAdapter, PlannerAdapter, RuvectorAdapter, } from '../adapters/base-adapter.js';
|
|
25
|
-
|
|
24
|
+
// Note: Auth is now handled by gates/auth-session-gate.ts which validates both platform and GCP credentials
|
|
26
25
|
import { createOrchestrationEngine, } from '../modules/orchestration-engine.js';
|
|
27
26
|
import { createArtifactHandoff } from '../modules/artifact-handoff.js';
|
|
28
27
|
import { createAuditTrail } from '../audit/audit-trail.js';
|
|
@@ -46,16 +45,18 @@ export const PLAN_EXIT_CODES = {
|
|
|
46
45
|
// ============================================================================
|
|
47
46
|
/**
|
|
48
47
|
* Assert that the user is authenticated.
|
|
49
|
-
*
|
|
48
|
+
* Uses the auth session gate which validates BOTH platform and GCP credentials.
|
|
49
|
+
* The gate is already enforced in CLI entry point, so this is a safety check.
|
|
50
50
|
*/
|
|
51
51
|
async function assertAuthenticated(correlationId) {
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
|
|
52
|
+
// Import dynamically to avoid circular dependencies
|
|
53
|
+
const { checkAuthSessionGate } = await import('../gates/auth-session-gate.js');
|
|
54
|
+
const result = await checkAuthSessionGate();
|
|
55
|
+
if (!result.authenticated) {
|
|
55
56
|
throw new CLIError({
|
|
56
57
|
code: 'ECLI-PLAN-AUTH',
|
|
57
58
|
category: 'AUTH_ERROR',
|
|
58
|
-
message: 'Login required. Run `agentics login` to authenticate.',
|
|
59
|
+
message: 'Login required. Run `agentics login` or `gcloud auth login` to authenticate.',
|
|
59
60
|
module: 'plan',
|
|
60
61
|
correlationId,
|
|
61
62
|
recoverable: true,
|
|
@@ -101,36 +102,20 @@ function generateChecksum(data) {
|
|
|
101
102
|
// ============================================================================
|
|
102
103
|
// Storage Configuration
|
|
103
104
|
// ============================================================================
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
// ============================================================================
|
|
118
|
-
// Storage Operations (Legacy - for local CRUD only)
|
|
105
|
+
// NOTE: Local filesystem storage has been REMOVED.
|
|
106
|
+
// All plan operations now use the Ruvector backend service.
|
|
107
|
+
// This ensures consistency across: plan create, plan list, plan inspect,
|
|
108
|
+
// plan approve, and plan delete.
|
|
109
|
+
//
|
|
110
|
+
// REMOVED FUNCTIONS (no longer needed):
|
|
111
|
+
// - getPlansDir()
|
|
112
|
+
// - ensurePlansDir()
|
|
113
|
+
// - getPlanPath()
|
|
114
|
+
// - savePlan()
|
|
115
|
+
// - generatePlanId()
|
|
116
|
+
//
|
|
117
|
+
// ID GENERATION: Now uses crypto.randomUUID() for backend-compatible UUIDs.
|
|
119
118
|
// ============================================================================
|
|
120
|
-
function savePlan(plan) {
|
|
121
|
-
ensurePlansDir();
|
|
122
|
-
const filePath = getPlanPath(plan.id);
|
|
123
|
-
fs.writeFileSync(filePath, JSON.stringify(plan, null, 2), 'utf-8');
|
|
124
|
-
}
|
|
125
|
-
// Note: loadPlan, deletePlanRecord, listAllPlans removed - now using Ruvector storage
|
|
126
|
-
// ============================================================================
|
|
127
|
-
// ID Generation
|
|
128
|
-
// ============================================================================
|
|
129
|
-
function generatePlanId() {
|
|
130
|
-
const timestamp = Date.now().toString(36);
|
|
131
|
-
const random = Math.random().toString(36).substring(2, 8);
|
|
132
|
-
return `plan-${timestamp}-${random}`;
|
|
133
|
-
}
|
|
134
119
|
// ============================================================================
|
|
135
120
|
// Validation
|
|
136
121
|
// ============================================================================
|
|
@@ -426,39 +411,78 @@ export function formatPlansListForDisplay(plans) {
|
|
|
426
411
|
// CRUD Command Implementations
|
|
427
412
|
// ============================================================================
|
|
428
413
|
/**
|
|
429
|
-
* Create a new plan record
|
|
414
|
+
* Create a new plan record.
|
|
415
|
+
*
|
|
416
|
+
* Plans are persisted in the Ruvector backend service (same as list/inspect/approve).
|
|
417
|
+
* The CLI is a thin client - no local filesystem writes.
|
|
430
418
|
*/
|
|
431
419
|
export async function executePlanCreateCommand(input, options) {
|
|
432
420
|
const startTime = Date.now();
|
|
433
421
|
const correlationId = options.trace_id ?? crypto.randomUUID();
|
|
422
|
+
// ============================================================================
|
|
423
|
+
// AUTHENTICATION CHECK - REQUIRED (consistent with other plan operations)
|
|
424
|
+
// ============================================================================
|
|
425
|
+
await assertAuthenticated(correlationId);
|
|
426
|
+
// ============================================================================
|
|
427
|
+
// INPUT VALIDATION
|
|
428
|
+
// ============================================================================
|
|
434
429
|
validatePlanName(input.name, correlationId);
|
|
430
|
+
// ============================================================================
|
|
431
|
+
// BACKEND PERSISTENCE - Ruvector Service
|
|
432
|
+
// Same backend used by: plan list, plan inspect, plan approve, plan delete
|
|
433
|
+
// ============================================================================
|
|
434
|
+
const ruvectorConfig = loadEndpointConfig('ruvector-service');
|
|
435
|
+
const ruvectorAdapter = new RuvectorAdapter(ruvectorConfig, correlationId);
|
|
435
436
|
const now = new Date().toISOString();
|
|
436
|
-
const
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
437
|
+
const planId = crypto.randomUUID(); // Backend-compatible UUID format
|
|
438
|
+
// Build RuvectorPlan payload (same format used by executePlanCommand)
|
|
439
|
+
const ruvectorPlan = {
|
|
440
|
+
id: planId,
|
|
441
|
+
type: 'plan',
|
|
442
|
+
intent: input.name.trim(),
|
|
443
|
+
plan: {
|
|
444
|
+
name: input.name.trim(),
|
|
445
|
+
description: input.description?.trim() ?? '',
|
|
446
|
+
manifest_query: input.manifest_query,
|
|
447
|
+
metadata: input.metadata,
|
|
448
|
+
},
|
|
442
449
|
created_at: now,
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
450
|
+
org_id: process.env['AGENTICS_ORG_ID'] ?? 'unknown',
|
|
451
|
+
user_id: process.env['AGENTICS_USER_ID'] ?? 'unknown',
|
|
452
|
+
checksum: generateChecksum({
|
|
453
|
+
name: input.name,
|
|
454
|
+
description: input.description,
|
|
455
|
+
manifest_query: input.manifest_query,
|
|
456
|
+
}),
|
|
446
457
|
};
|
|
447
458
|
try {
|
|
448
|
-
|
|
459
|
+
await ruvectorAdapter.storePlan(ruvectorPlan);
|
|
449
460
|
}
|
|
450
461
|
catch (error) {
|
|
462
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
451
463
|
throw new CLIError({
|
|
452
|
-
code: 'ECLI-PLAN-
|
|
453
|
-
category: '
|
|
454
|
-
message:
|
|
455
|
-
details: {
|
|
464
|
+
code: 'ECLI-PLAN-CREATE',
|
|
465
|
+
category: 'NETWORK_ERROR',
|
|
466
|
+
message: `Failed to create plan in backend: ${errorMessage}`,
|
|
467
|
+
details: { plan_id: planId },
|
|
456
468
|
module: 'plan',
|
|
457
469
|
correlationId,
|
|
458
|
-
recoverable:
|
|
459
|
-
exitCode: PLAN_EXIT_CODES.
|
|
470
|
+
recoverable: true,
|
|
471
|
+
exitCode: PLAN_EXIT_CODES.STORAGE_ERROR,
|
|
460
472
|
});
|
|
461
473
|
}
|
|
474
|
+
// Map to PlanRecord for response (consistent with other commands)
|
|
475
|
+
const plan = {
|
|
476
|
+
id: planId,
|
|
477
|
+
name: input.name.trim(),
|
|
478
|
+
description: input.description?.trim() ?? '',
|
|
479
|
+
status: 'draft',
|
|
480
|
+
manifest_query: input.manifest_query,
|
|
481
|
+
created_at: now,
|
|
482
|
+
updated_at: now,
|
|
483
|
+
version: 1,
|
|
484
|
+
metadata: input.metadata,
|
|
485
|
+
};
|
|
462
486
|
return {
|
|
463
487
|
plan,
|
|
464
488
|
timing: Date.now() - startTime,
|
|
@@ -611,10 +635,10 @@ export async function executePlanDeleteCommand(input, options) {
|
|
|
611
635
|
}
|
|
612
636
|
}
|
|
613
637
|
/**
|
|
614
|
-
* Approve a plan
|
|
638
|
+
* Approve a plan.
|
|
615
639
|
*
|
|
616
|
-
*
|
|
617
|
-
*
|
|
640
|
+
* Verifies the plan exists in Ruvector and marks it as approved.
|
|
641
|
+
* For authorized users (internal email or paid API key), this performs real approval.
|
|
618
642
|
*/
|
|
619
643
|
export async function executePlanApproveCommand(input, options) {
|
|
620
644
|
const startTime = Date.now();
|
|
@@ -687,8 +711,8 @@ export async function executePlanApproveCommand(input, options) {
|
|
|
687
711
|
};
|
|
688
712
|
return {
|
|
689
713
|
plan,
|
|
690
|
-
previous_status: '
|
|
691
|
-
advisory:
|
|
714
|
+
previous_status: 'draft',
|
|
715
|
+
advisory: false,
|
|
692
716
|
timing: Date.now() - startTime,
|
|
693
717
|
};
|
|
694
718
|
}
|