@agentuity/cli 3.0.0-alpha.4 → 3.0.0-alpha.7
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/build-report.d.ts +1 -1
- package/dist/build-report.d.ts.map +1 -1
- package/dist/build-report.js +0 -1
- package/dist/build-report.js.map +1 -1
- package/dist/cmd/cloud/deploy.d.ts.map +1 -1
- package/dist/cmd/cloud/deploy.js +101 -46
- package/dist/cmd/cloud/deploy.js.map +1 -1
- package/dist/cmd/cloud/index.d.ts.map +1 -1
- package/dist/cmd/cloud/index.js +0 -4
- package/dist/cmd/cloud/index.js.map +1 -1
- package/dist/cmd/cloud/sandbox/exec.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/exec.js +41 -24
- package/dist/cmd/cloud/sandbox/exec.js.map +1 -1
- package/dist/cmd/cloud/sandbox/job/logs.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/job/logs.js +1 -0
- package/dist/cmd/cloud/sandbox/job/logs.js.map +1 -1
- package/dist/cmd/cloud/sandbox/run.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/run.js +34 -5
- package/dist/cmd/cloud/sandbox/run.js.map +1 -1
- package/dist/cmd/cloud/sandbox/util.d.ts +9 -0
- package/dist/cmd/cloud/sandbox/util.d.ts.map +1 -1
- package/dist/cmd/cloud/sandbox/util.js +20 -1
- package/dist/cmd/cloud/sandbox/util.js.map +1 -1
- package/dist/cmd/cloud/session/get.d.ts.map +1 -1
- package/dist/cmd/cloud/session/get.js +1 -41
- package/dist/cmd/cloud/session/get.js.map +1 -1
- package/dist/cmd/coder/start.d.ts.map +1 -1
- package/dist/cmd/coder/start.js +2 -0
- package/dist/cmd/coder/start.js.map +1 -1
- package/dist/cmd/coder/tui-init.js +1 -1
- package/dist/cmd/coder/tui-init.js.map +1 -1
- package/dist/cmd/project/create.d.ts.map +1 -1
- package/dist/cmd/project/create.js +0 -2
- package/dist/cmd/project/create.js.map +1 -1
- package/dist/cmd/project/frameworks.d.ts.map +1 -1
- package/dist/cmd/project/frameworks.js +18 -4
- package/dist/cmd/project/frameworks.js.map +1 -1
- package/dist/cmd/project/index.d.ts.map +1 -1
- package/dist/cmd/project/index.js +0 -3
- package/dist/cmd/project/index.js.map +1 -1
- package/dist/cmd/project/template-flow.d.ts +0 -1
- package/dist/cmd/project/template-flow.d.ts.map +1 -1
- package/dist/cmd/project/template-flow.js +1 -104
- package/dist/cmd/project/template-flow.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/onboarding/agentPrompt.d.ts.map +1 -1
- package/dist/onboarding/agentPrompt.js +5 -8
- package/dist/onboarding/agentPrompt.js.map +1 -1
- package/dist/types.d.ts +3 -170
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +70 -84
- package/src/build-report.ts +0 -1
- package/src/cmd/ai/prompt/web.md +43 -17
- package/src/cmd/cloud/deploy.ts +120 -56
- package/src/cmd/cloud/index.ts +0 -4
- package/src/cmd/cloud/sandbox/exec.ts +49 -23
- package/src/cmd/cloud/sandbox/job/logs.ts +1 -0
- package/src/cmd/cloud/sandbox/run.ts +47 -9
- package/src/cmd/cloud/sandbox/util.ts +20 -1
- package/src/cmd/cloud/session/get.ts +1 -51
- package/src/cmd/coder/start.ts +2 -0
- package/src/cmd/coder/tui-init.ts +1 -1
- package/src/cmd/project/create.ts +0 -2
- package/src/cmd/project/frameworks.ts +16 -4
- package/src/cmd/project/index.ts +0 -3
- package/src/cmd/project/template-flow.ts +0 -127
- package/src/cmd/project/templates/vite-react/vite.config.ts +8 -0
- package/src/index.ts +0 -4
- package/src/onboarding/agentPrompt.ts +5 -8
- package/src/runtime-bootstrap.md +2 -3
- package/src/types.ts +0 -186
- package/dist/cmd/build/app-config-extractor.d.ts +0 -27
- package/dist/cmd/build/app-config-extractor.d.ts.map +0 -1
- package/dist/cmd/build/app-config-extractor.js +0 -152
- package/dist/cmd/build/app-config-extractor.js.map +0 -1
- package/dist/cmd/cloud/eval/get.d.ts +0 -2
- package/dist/cmd/cloud/eval/get.d.ts.map +0 -1
- package/dist/cmd/cloud/eval/get.js +0 -80
- package/dist/cmd/cloud/eval/get.js.map +0 -1
- package/dist/cmd/cloud/eval/index.d.ts +0 -2
- package/dist/cmd/cloud/eval/index.d.ts.map +0 -1
- package/dist/cmd/cloud/eval/index.js +0 -16
- package/dist/cmd/cloud/eval/index.js.map +0 -1
- package/dist/cmd/cloud/eval/list.d.ts +0 -2
- package/dist/cmd/cloud/eval/list.d.ts.map +0 -1
- package/dist/cmd/cloud/eval/list.js +0 -124
- package/dist/cmd/cloud/eval/list.js.map +0 -1
- package/dist/cmd/cloud/eval-run/get.d.ts +0 -2
- package/dist/cmd/cloud/eval-run/get.d.ts.map +0 -1
- package/dist/cmd/cloud/eval-run/get.js +0 -107
- package/dist/cmd/cloud/eval-run/get.js.map +0 -1
- package/dist/cmd/cloud/eval-run/index.d.ts +0 -2
- package/dist/cmd/cloud/eval-run/index.d.ts.map +0 -1
- package/dist/cmd/cloud/eval-run/index.js +0 -16
- package/dist/cmd/cloud/eval-run/index.js.map +0 -1
- package/dist/cmd/cloud/eval-run/list.d.ts +0 -2
- package/dist/cmd/cloud/eval-run/list.d.ts.map +0 -1
- package/dist/cmd/cloud/eval-run/list.js +0 -149
- package/dist/cmd/cloud/eval-run/list.js.map +0 -1
- package/dist/cmd/project/auth/generate.d.ts +0 -5
- package/dist/cmd/project/auth/generate.d.ts.map +0 -1
- package/dist/cmd/project/auth/generate.js +0 -102
- package/dist/cmd/project/auth/generate.js.map +0 -1
- package/dist/cmd/project/auth/index.d.ts +0 -2
- package/dist/cmd/project/auth/index.d.ts.map +0 -1
- package/dist/cmd/project/auth/index.js +0 -21
- package/dist/cmd/project/auth/index.js.map +0 -1
- package/dist/cmd/project/auth/init.d.ts +0 -2
- package/dist/cmd/project/auth/init.d.ts.map +0 -1
- package/dist/cmd/project/auth/init.js +0 -213
- package/dist/cmd/project/auth/init.js.map +0 -1
- package/dist/cmd/project/auth/shared.d.ts +0 -93
- package/dist/cmd/project/auth/shared.d.ts.map +0 -1
- package/dist/cmd/project/auth/shared.js +0 -451
- package/dist/cmd/project/auth/shared.js.map +0 -1
- package/dist/utils/bun-version-checker.d.ts +0 -11
- package/dist/utils/bun-version-checker.d.ts.map +0 -1
- package/dist/utils/bun-version-checker.js +0 -56
- package/dist/utils/bun-version-checker.js.map +0 -1
- package/dist/utils/dependency-checker.d.ts +0 -20
- package/dist/utils/dependency-checker.d.ts.map +0 -1
- package/dist/utils/dependency-checker.js +0 -160
- package/dist/utils/dependency-checker.js.map +0 -1
- package/dist/utils/detectSubagent.d.ts +0 -15
- package/dist/utils/detectSubagent.d.ts.map +0 -1
- package/dist/utils/detectSubagent.js +0 -28
- package/dist/utils/detectSubagent.js.map +0 -1
- package/dist/utils/stream-capture.d.ts +0 -9
- package/dist/utils/stream-capture.d.ts.map +0 -1
- package/dist/utils/stream-capture.js +0 -34
- package/dist/utils/stream-capture.js.map +0 -1
- package/dist/utils/string.d.ts +0 -6
- package/dist/utils/string.d.ts.map +0 -1
- package/dist/utils/string.js +0 -6
- package/dist/utils/string.js.map +0 -1
- package/dist/utils/version-mismatch.d.ts +0 -39
- package/dist/utils/version-mismatch.d.ts.map +0 -1
- package/dist/utils/version-mismatch.js +0 -161
- package/dist/utils/version-mismatch.js.map +0 -1
- package/dist/utils/workbench-notify.d.ts +0 -29
- package/dist/utils/workbench-notify.d.ts.map +0 -1
- package/dist/utils/workbench-notify.js +0 -56
- package/dist/utils/workbench-notify.js.map +0 -1
- package/src/cmd/build/app-config-extractor.ts +0 -186
- package/src/cmd/cloud/eval/get.ts +0 -86
- package/src/cmd/cloud/eval/index.ts +0 -16
- package/src/cmd/cloud/eval/list.ts +0 -135
- package/src/cmd/cloud/eval-run/get.ts +0 -114
- package/src/cmd/cloud/eval-run/index.ts +0 -16
- package/src/cmd/cloud/eval-run/list.ts +0 -160
- package/src/cmd/project/auth/generate.ts +0 -116
- package/src/cmd/project/auth/index.ts +0 -21
- package/src/cmd/project/auth/init.ts +0 -256
- package/src/cmd/project/auth/shared.ts +0 -566
- package/src/utils/bun-version-checker.ts +0 -70
- package/src/utils/dependency-checker.ts +0 -205
- package/src/utils/detectSubagent.ts +0 -36
- package/src/utils/stream-capture.ts +0 -39
- package/src/utils/string.ts +0 -6
- package/src/utils/version-mismatch.ts +0 -204
- package/src/utils/workbench-notify.ts +0 -67
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* App Config Extractor
|
|
3
|
-
*
|
|
4
|
-
* Extracts analytics and workbench config from the user's createApp() call
|
|
5
|
-
* in app.ts. This is the v2 approach where createApp() is the single source
|
|
6
|
-
* of truth for runtime configuration (replacing agentuity.config.ts).
|
|
7
|
-
*
|
|
8
|
-
* Uses TypeScript's compiler API to reliably detect and extract values.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import ts from 'typescript';
|
|
12
|
-
import { join } from 'node:path';
|
|
13
|
-
import type { Logger } from '../../types';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Extracted runtime config from createApp() call.
|
|
17
|
-
*/
|
|
18
|
-
export interface ExtractedAppConfig {
|
|
19
|
-
/** analytics option value: boolean, object, or undefined if not set */
|
|
20
|
-
analytics?: boolean | Record<string, unknown>;
|
|
21
|
-
/** workbench option value: boolean, string, object, or undefined if not set */
|
|
22
|
-
workbench?: boolean | string | Record<string, unknown>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Extract analytics and workbench config from a createApp() call.
|
|
27
|
-
*
|
|
28
|
-
* Uses TypeScript AST to find `createApp({ ... })` and extract the values
|
|
29
|
-
* of the `analytics` and `workbench` properties.
|
|
30
|
-
*/
|
|
31
|
-
function extractCreateAppConfig(sourceFile: ts.SourceFile): ExtractedAppConfig {
|
|
32
|
-
const result: ExtractedAppConfig = {};
|
|
33
|
-
|
|
34
|
-
// Walk the AST looking for createApp({ ... }) calls
|
|
35
|
-
function visit(node: ts.Node): void {
|
|
36
|
-
// Check for createApp(...) call
|
|
37
|
-
if (
|
|
38
|
-
ts.isCallExpression(node) &&
|
|
39
|
-
ts.isIdentifier(node.expression) &&
|
|
40
|
-
node.expression.text === 'createApp' &&
|
|
41
|
-
node.arguments.length > 0
|
|
42
|
-
) {
|
|
43
|
-
const firstArg = node.arguments[0];
|
|
44
|
-
if (!firstArg) return;
|
|
45
|
-
if (ts.isObjectLiteralExpression(firstArg)) {
|
|
46
|
-
// Found createApp({ ... }) — extract properties
|
|
47
|
-
for (const prop of firstArg.properties) {
|
|
48
|
-
if (!ts.isPropertyAssignment(prop)) continue;
|
|
49
|
-
|
|
50
|
-
const name = ts.isIdentifier(prop.name) ? prop.name.text : undefined;
|
|
51
|
-
if (!name) continue;
|
|
52
|
-
|
|
53
|
-
// prop.initializer should always exist for PropertyAssignment, but check to satisfy TS
|
|
54
|
-
if (!('initializer' in prop)) continue;
|
|
55
|
-
const initializer = (prop as { initializer: ts.Expression }).initializer;
|
|
56
|
-
|
|
57
|
-
if (name === 'analytics') {
|
|
58
|
-
const value = extractValue(initializer);
|
|
59
|
-
if (value !== undefined) {
|
|
60
|
-
if (typeof value === 'boolean') {
|
|
61
|
-
result.analytics = value;
|
|
62
|
-
} else if (typeof value === 'object') {
|
|
63
|
-
result.analytics = value as Record<string, unknown>;
|
|
64
|
-
}
|
|
65
|
-
// Ignore string/number for analytics
|
|
66
|
-
}
|
|
67
|
-
} else if (name === 'workbench') {
|
|
68
|
-
const value = extractValue(initializer);
|
|
69
|
-
if (value !== undefined) {
|
|
70
|
-
if (typeof value === 'boolean' || typeof value === 'string') {
|
|
71
|
-
result.workbench = value;
|
|
72
|
-
} else if (typeof value === 'object') {
|
|
73
|
-
result.workbench = value as Record<string, unknown>;
|
|
74
|
-
}
|
|
75
|
-
// Ignore number for workbench
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
ts.forEachChild(node, visit);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
visit(sourceFile);
|
|
86
|
-
return result;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Extract a JavaScript value from a TypeScript AST expression node.
|
|
91
|
-
* Handles: boolean literals, string literals, numeric literals,
|
|
92
|
-
* object literals (as Record), and identifier references (by name).
|
|
93
|
-
*/
|
|
94
|
-
function extractValue(
|
|
95
|
-
node: ts.Node
|
|
96
|
-
): boolean | string | number | Record<string, unknown> | undefined {
|
|
97
|
-
if (ts.isLiteralExpression(node)) {
|
|
98
|
-
// String literal or numeric literal
|
|
99
|
-
if (ts.isStringLiteral(node)) {
|
|
100
|
-
return node.text;
|
|
101
|
-
}
|
|
102
|
-
if (ts.isNumericLiteral(node)) {
|
|
103
|
-
return Number(node.text);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (node.kind === ts.SyntaxKind.TrueKeyword) {
|
|
108
|
-
return true;
|
|
109
|
-
}
|
|
110
|
-
if (node.kind === ts.SyntaxKind.FalseKeyword) {
|
|
111
|
-
return false;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if (ts.isIdentifier(node)) {
|
|
115
|
-
// Return the identifier name (e.g., a variable reference)
|
|
116
|
-
return node.text;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (ts.isObjectLiteralExpression(node)) {
|
|
120
|
-
const obj: Record<string, unknown> = {};
|
|
121
|
-
for (const prop of node.properties) {
|
|
122
|
-
if (!ts.isPropertyAssignment(prop)) continue;
|
|
123
|
-
if (!ts.isIdentifier(prop.name)) continue;
|
|
124
|
-
|
|
125
|
-
const key = prop.name.text;
|
|
126
|
-
obj[key] = extractValue(prop.initializer);
|
|
127
|
-
}
|
|
128
|
-
return obj;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return undefined;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Detect and extract analytics/workbench config from app.ts.
|
|
136
|
-
*
|
|
137
|
-
* This is the v2 approach: runtime config lives in createApp() only.
|
|
138
|
-
* The CLI reads these values at build time via AST parsing.
|
|
139
|
-
*/
|
|
140
|
-
export async function extractAppConfig(
|
|
141
|
-
rootDir: string,
|
|
142
|
-
logger: Logger
|
|
143
|
-
): Promise<ExtractedAppConfig> {
|
|
144
|
-
// Look for app.ts in root first, then src/
|
|
145
|
-
let appFile = join(rootDir, 'app.ts');
|
|
146
|
-
if (!(await Bun.file(appFile).exists())) {
|
|
147
|
-
appFile = join(rootDir, 'src', 'app.ts');
|
|
148
|
-
if (!(await Bun.file(appFile).exists())) {
|
|
149
|
-
logger.trace('[config-extract] No app.ts found');
|
|
150
|
-
return {};
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
try {
|
|
155
|
-
const source = await Bun.file(appFile).text();
|
|
156
|
-
|
|
157
|
-
// Quick bail-out before parsing
|
|
158
|
-
if (!source.includes('createApp')) {
|
|
159
|
-
logger.trace('[config-extract] No createApp call in %s', appFile);
|
|
160
|
-
return {};
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// Parse with TypeScript
|
|
164
|
-
const sourceFile = ts.createSourceFile(
|
|
165
|
-
appFile,
|
|
166
|
-
source,
|
|
167
|
-
ts.ScriptTarget.Latest,
|
|
168
|
-
true,
|
|
169
|
-
ts.ScriptKind.TS
|
|
170
|
-
);
|
|
171
|
-
|
|
172
|
-
const config = extractCreateAppConfig(sourceFile);
|
|
173
|
-
|
|
174
|
-
if (config.analytics !== undefined) {
|
|
175
|
-
logger.debug('[config-extract] Found analytics in createApp(): %o', config.analytics);
|
|
176
|
-
}
|
|
177
|
-
if (config.workbench !== undefined) {
|
|
178
|
-
logger.debug('[config-extract] Found workbench in createApp(): %o', config.workbench);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
return config;
|
|
182
|
-
} catch (error) {
|
|
183
|
-
logger.warn('[config-extract] Failed to parse app.ts:', error);
|
|
184
|
-
return {};
|
|
185
|
-
}
|
|
186
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { createSubcommand } from '../../../types';
|
|
3
|
-
import * as tui from '../../../tui';
|
|
4
|
-
import { APIError, evalGet } from '@agentuity/server';
|
|
5
|
-
import { getCommand } from '../../../command-prefix';
|
|
6
|
-
import { ErrorCode } from '../../../errors';
|
|
7
|
-
|
|
8
|
-
const EvalGetResponseSchema = z.object({
|
|
9
|
-
id: z.string().describe('Eval ID'),
|
|
10
|
-
name: z.string().describe('Eval name'),
|
|
11
|
-
identifier: z.string().nullable().describe('Stable eval identifier'),
|
|
12
|
-
agent_identifier: z.string().describe('Agent identifier'),
|
|
13
|
-
created_at: z.string().describe('Creation timestamp'),
|
|
14
|
-
updated_at: z.string().describe('Last updated timestamp'),
|
|
15
|
-
project_id: z.string().describe('Project ID'),
|
|
16
|
-
org_id: z.string().describe('Organization ID'),
|
|
17
|
-
description: z.string().nullable().describe('Eval description'),
|
|
18
|
-
devmode: z.boolean().describe('Whether this is a devmode eval'),
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
export const getSubcommand = createSubcommand({
|
|
22
|
-
name: 'get',
|
|
23
|
-
aliases: ['show', 'info'],
|
|
24
|
-
description: 'Get details about a specific eval',
|
|
25
|
-
tags: ['read-only', 'fast', 'requires-auth'],
|
|
26
|
-
examples: [
|
|
27
|
-
{
|
|
28
|
-
command: getCommand('cloud eval get eval_abc123xyz'),
|
|
29
|
-
description: 'Get an eval by ID',
|
|
30
|
-
},
|
|
31
|
-
],
|
|
32
|
-
requires: { auth: true, apiClient: true },
|
|
33
|
-
idempotent: true,
|
|
34
|
-
schema: {
|
|
35
|
-
args: z.object({
|
|
36
|
-
eval_id: z.string().describe('Eval ID'),
|
|
37
|
-
}),
|
|
38
|
-
response: EvalGetResponseSchema,
|
|
39
|
-
},
|
|
40
|
-
async handler(ctx) {
|
|
41
|
-
const { apiClient, args, options } = ctx;
|
|
42
|
-
|
|
43
|
-
try {
|
|
44
|
-
const evalData = await evalGet(apiClient, args.eval_id);
|
|
45
|
-
|
|
46
|
-
const result = {
|
|
47
|
-
id: evalData.id,
|
|
48
|
-
name: evalData.name,
|
|
49
|
-
identifier: evalData.identifier,
|
|
50
|
-
agent_identifier: evalData.agentIdentifier,
|
|
51
|
-
created_at: evalData.createdAt,
|
|
52
|
-
updated_at: evalData.updatedAt,
|
|
53
|
-
project_id: evalData.projectId,
|
|
54
|
-
org_id: evalData.orgId,
|
|
55
|
-
description: evalData.description,
|
|
56
|
-
devmode: evalData.devmode,
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
if (options.json) {
|
|
60
|
-
return result;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const tableData: Record<string, string> = {
|
|
64
|
-
ID: evalData.id,
|
|
65
|
-
Name: evalData.name,
|
|
66
|
-
Identifier: evalData.identifier || '-',
|
|
67
|
-
Agent: evalData.agentIdentifier,
|
|
68
|
-
Project: evalData.projectId,
|
|
69
|
-
Organization: evalData.orgId,
|
|
70
|
-
Description: evalData.description || '-',
|
|
71
|
-
Devmode: evalData.devmode ? tui.colorSuccess('✓') : tui.colorError('✗'),
|
|
72
|
-
Created: new Date(evalData.createdAt).toLocaleString(),
|
|
73
|
-
Updated: new Date(evalData.updatedAt).toLocaleString(),
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
tui.table([tableData], Object.keys(tableData), { layout: 'vertical', padStart: ' ' });
|
|
77
|
-
|
|
78
|
-
return result;
|
|
79
|
-
} catch (ex) {
|
|
80
|
-
if (ex instanceof APIError && ex.status === 404) {
|
|
81
|
-
tui.fatal(`Eval ${args.eval_id} not found`, ErrorCode.RESOURCE_NOT_FOUND);
|
|
82
|
-
}
|
|
83
|
-
tui.fatal(`Failed to get eval: ${ex}`, ErrorCode.API_ERROR);
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { createCommand } from '../../../types';
|
|
2
|
-
import { getSubcommand } from './get';
|
|
3
|
-
import { listSubcommand } from './list';
|
|
4
|
-
import { getCommand } from '../../../command-prefix';
|
|
5
|
-
|
|
6
|
-
export const evalCommand = createCommand({
|
|
7
|
-
name: 'eval',
|
|
8
|
-
aliases: ['evals'],
|
|
9
|
-
description: 'Manage evals',
|
|
10
|
-
tags: ['requires-auth'],
|
|
11
|
-
examples: [
|
|
12
|
-
{ command: getCommand('cloud eval list'), description: 'List all evals' },
|
|
13
|
-
{ command: getCommand('cloud eval get <id>'), description: 'Get eval details' },
|
|
14
|
-
],
|
|
15
|
-
subcommands: [getSubcommand, listSubcommand],
|
|
16
|
-
});
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { createSubcommand } from '../../../types';
|
|
3
|
-
import * as tui from '../../../tui';
|
|
4
|
-
import { getCommand } from '../../../command-prefix';
|
|
5
|
-
import { ErrorCode } from '../../../errors';
|
|
6
|
-
import { evalList } from '@agentuity/server';
|
|
7
|
-
|
|
8
|
-
const EvalListResponseSchema = z.array(
|
|
9
|
-
z.object({
|
|
10
|
-
id: z.string().describe('Eval ID'),
|
|
11
|
-
name: z.string().describe('Eval name'),
|
|
12
|
-
identifier: z.string().nullable().describe('Stable eval identifier'),
|
|
13
|
-
agent_identifier: z.string().describe('Agent identifier'),
|
|
14
|
-
created_at: z.string().describe('Creation timestamp'),
|
|
15
|
-
updated_at: z.string().describe('Last updated timestamp'),
|
|
16
|
-
project_id: z.string().describe('Project ID'),
|
|
17
|
-
description: z.string().nullable().describe('Eval description'),
|
|
18
|
-
devmode: z.boolean().describe('Whether this is a devmode eval'),
|
|
19
|
-
})
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
export const listSubcommand = createSubcommand({
|
|
23
|
-
name: 'list',
|
|
24
|
-
aliases: ['ls'],
|
|
25
|
-
description: 'List evals',
|
|
26
|
-
tags: ['read-only', 'fast', 'requires-auth'],
|
|
27
|
-
examples: [
|
|
28
|
-
{ command: getCommand('cloud eval list'), description: 'List 10 most recent evals' },
|
|
29
|
-
{
|
|
30
|
-
command: getCommand('cloud eval list --count=25'),
|
|
31
|
-
description: 'List 25 most recent evals',
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
command: getCommand('cloud eval list --project-id=proj_*'),
|
|
35
|
-
description: 'Filter by project',
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
command: getCommand('cloud eval list --agent-id=agent_*'),
|
|
39
|
-
description: 'Filter by agent',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
command: getCommand('cloud eval list --all'),
|
|
43
|
-
description: 'List all evals regardless of project context',
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
requires: { auth: true, apiClient: true },
|
|
47
|
-
optional: { project: true },
|
|
48
|
-
idempotent: true,
|
|
49
|
-
pagination: {
|
|
50
|
-
supported: true,
|
|
51
|
-
defaultLimit: 10,
|
|
52
|
-
maxLimit: 100,
|
|
53
|
-
parameters: {
|
|
54
|
-
limit: 'count',
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
schema: {
|
|
58
|
-
options: z.object({
|
|
59
|
-
orgId: z.string().optional().describe('filter by organization id'),
|
|
60
|
-
count: z.coerce
|
|
61
|
-
.number()
|
|
62
|
-
.int()
|
|
63
|
-
.min(1)
|
|
64
|
-
.max(100)
|
|
65
|
-
.default(10)
|
|
66
|
-
.describe('Number of evals to list (1–100)'),
|
|
67
|
-
projectId: z.string().optional().describe('Filter by project ID'),
|
|
68
|
-
agentId: z.string().optional().describe('Filter by agent ID'),
|
|
69
|
-
all: z.boolean().optional().describe('List all evals regardless of project context'),
|
|
70
|
-
}),
|
|
71
|
-
response: EvalListResponseSchema,
|
|
72
|
-
},
|
|
73
|
-
webUrl: (ctx) => {
|
|
74
|
-
const projectId = ctx.opts?.all ? undefined : ctx.opts?.projectId || ctx.project?.projectId;
|
|
75
|
-
return projectId ? `/projects/${encodeURIComponent(projectId)}/evals` : undefined;
|
|
76
|
-
},
|
|
77
|
-
async handler(ctx) {
|
|
78
|
-
const { apiClient, project, opts, options } = ctx;
|
|
79
|
-
|
|
80
|
-
if (opts?.orgId && opts?.projectId) {
|
|
81
|
-
tui.fatal('--org-id and --project-id are mutually exclusive. Use one or the other.');
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const projectId = opts.all || opts.orgId ? undefined : opts.projectId || project?.projectId;
|
|
85
|
-
|
|
86
|
-
try {
|
|
87
|
-
const evals = await evalList(apiClient, {
|
|
88
|
-
orgId: opts?.orgId,
|
|
89
|
-
projectId,
|
|
90
|
-
agentId: opts.agentId,
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
const result = evals.map((e) => ({
|
|
94
|
-
id: e.id,
|
|
95
|
-
name: e.name,
|
|
96
|
-
identifier: e.identifier,
|
|
97
|
-
agent_identifier: e.agentIdentifier,
|
|
98
|
-
created_at: e.createdAt,
|
|
99
|
-
updated_at: e.updatedAt,
|
|
100
|
-
project_id: e.projectId,
|
|
101
|
-
description: e.description,
|
|
102
|
-
devmode: e.devmode,
|
|
103
|
-
}));
|
|
104
|
-
|
|
105
|
-
if (options.json) {
|
|
106
|
-
return result;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (evals.length === 0) {
|
|
110
|
-
tui.info('No evals found.');
|
|
111
|
-
return [];
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const tableData = evals.map((e) => ({
|
|
115
|
-
ID: e.id,
|
|
116
|
-
Name: e.name.length > 30 ? e.name.substring(0, 27) + '...' : e.name,
|
|
117
|
-
Agent: e.agentIdentifier || '-',
|
|
118
|
-
Devmode: e.devmode ? '✓' : '✗',
|
|
119
|
-
Created: new Date(e.createdAt).toLocaleString(),
|
|
120
|
-
}));
|
|
121
|
-
|
|
122
|
-
tui.table(tableData, [
|
|
123
|
-
{ name: 'ID', alignment: 'left' },
|
|
124
|
-
{ name: 'Name', alignment: 'left' },
|
|
125
|
-
{ name: 'Agent', alignment: 'left' },
|
|
126
|
-
{ name: 'Devmode', alignment: 'center' },
|
|
127
|
-
{ name: 'Created', alignment: 'left' },
|
|
128
|
-
]);
|
|
129
|
-
|
|
130
|
-
return result;
|
|
131
|
-
} catch (ex) {
|
|
132
|
-
tui.fatal(`Failed to list evals: ${ex}`, ErrorCode.API_ERROR);
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
});
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { createSubcommand } from '../../../types';
|
|
3
|
-
import * as tui from '../../../tui';
|
|
4
|
-
import { APIError, evalRunGet } from '@agentuity/server';
|
|
5
|
-
import { getCommand } from '../../../command-prefix';
|
|
6
|
-
import { ErrorCode } from '../../../errors';
|
|
7
|
-
|
|
8
|
-
const EvalRunGetResponseSchema = z.object({
|
|
9
|
-
id: z.string().describe('Eval run ID'),
|
|
10
|
-
eval_id: z.string().describe('Eval ID'),
|
|
11
|
-
eval_name: z.string().nullable().describe('Eval name'),
|
|
12
|
-
agent_identifier: z.string().nullable().describe('Agent identifier'),
|
|
13
|
-
session_id: z.string().describe('Session ID'),
|
|
14
|
-
created_at: z.string().describe('Creation timestamp'),
|
|
15
|
-
updated_at: z.string().describe('Last updated timestamp'),
|
|
16
|
-
project_id: z.string().describe('Project ID'),
|
|
17
|
-
org_id: z.string().describe('Organization ID'),
|
|
18
|
-
deployment_id: z.string().nullable().describe('Deployment ID'),
|
|
19
|
-
devmode: z.boolean().describe('Whether this is a devmode run'),
|
|
20
|
-
pending: z.boolean().describe('Whether the eval run is pending'),
|
|
21
|
-
success: z.boolean().describe('Whether the eval run succeeded'),
|
|
22
|
-
error: z.string().nullable().describe('Error message if failed'),
|
|
23
|
-
result: z.any().nullable().describe('Eval run result'),
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
export const getSubcommand = createSubcommand({
|
|
27
|
-
name: 'get',
|
|
28
|
-
aliases: ['show', 'info'],
|
|
29
|
-
description: 'Get details about a specific eval run',
|
|
30
|
-
tags: ['read-only', 'fast', 'requires-auth'],
|
|
31
|
-
examples: [
|
|
32
|
-
{
|
|
33
|
-
command: getCommand('cloud eval-run get evalrun_abc123xyz'),
|
|
34
|
-
description: 'Get an eval run by ID',
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
|
-
requires: { auth: true, apiClient: true },
|
|
38
|
-
idempotent: true,
|
|
39
|
-
schema: {
|
|
40
|
-
args: z.object({
|
|
41
|
-
eval_run_id: z.string().describe('Eval run ID'),
|
|
42
|
-
}),
|
|
43
|
-
response: EvalRunGetResponseSchema,
|
|
44
|
-
},
|
|
45
|
-
async handler(ctx) {
|
|
46
|
-
const { apiClient, args, options } = ctx;
|
|
47
|
-
|
|
48
|
-
try {
|
|
49
|
-
const evalRunData = await evalRunGet(apiClient, args.eval_run_id);
|
|
50
|
-
|
|
51
|
-
const result = {
|
|
52
|
-
id: evalRunData.id,
|
|
53
|
-
eval_id: evalRunData.evalId,
|
|
54
|
-
eval_name: evalRunData.evalName,
|
|
55
|
-
agent_identifier: evalRunData.agentIdentifier,
|
|
56
|
-
session_id: evalRunData.sessionId,
|
|
57
|
-
created_at: evalRunData.createdAt,
|
|
58
|
-
updated_at: evalRunData.updatedAt,
|
|
59
|
-
project_id: evalRunData.projectId,
|
|
60
|
-
org_id: evalRunData.orgId,
|
|
61
|
-
deployment_id: evalRunData.deploymentId,
|
|
62
|
-
devmode: evalRunData.devmode,
|
|
63
|
-
pending: evalRunData.pending,
|
|
64
|
-
success: evalRunData.success,
|
|
65
|
-
error: evalRunData.error,
|
|
66
|
-
result: evalRunData.result,
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
if (options.json) {
|
|
70
|
-
return result;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const tableData: Record<string, string> = {
|
|
74
|
-
ID: evalRunData.id,
|
|
75
|
-
'Eval ID': evalRunData.evalId,
|
|
76
|
-
};
|
|
77
|
-
if (evalRunData.evalName) {
|
|
78
|
-
tableData['Eval Name'] = evalRunData.evalName;
|
|
79
|
-
}
|
|
80
|
-
if (evalRunData.agentIdentifier) {
|
|
81
|
-
tableData['Agent'] = evalRunData.agentIdentifier;
|
|
82
|
-
}
|
|
83
|
-
tableData['Session ID'] = evalRunData.sessionId;
|
|
84
|
-
tableData['Project'] = evalRunData.projectId;
|
|
85
|
-
tableData['Organization'] = evalRunData.orgId;
|
|
86
|
-
tableData['Devmode'] = evalRunData.devmode ? '✓ Yes' : '✗ No';
|
|
87
|
-
tableData['Success'] = evalRunData.success ? tui.colorSuccess('✓') : tui.colorError('✗');
|
|
88
|
-
tableData['Pending'] = evalRunData.pending ? '⏳ Yes' : '✓ No';
|
|
89
|
-
if (evalRunData.result?.reason) {
|
|
90
|
-
tableData['Reason'] = evalRunData.result.reason;
|
|
91
|
-
}
|
|
92
|
-
if (evalRunData.error) {
|
|
93
|
-
tableData['Error'] = tui.colorError(evalRunData.error);
|
|
94
|
-
}
|
|
95
|
-
tableData['Created'] = new Date(evalRunData.createdAt).toLocaleString();
|
|
96
|
-
tableData['Updated'] = new Date(evalRunData.updatedAt).toLocaleString();
|
|
97
|
-
|
|
98
|
-
tui.table([tableData], Object.keys(tableData), { layout: 'vertical', padStart: ' ' });
|
|
99
|
-
|
|
100
|
-
if (evalRunData.result && Object.keys(evalRunData.result).length > 0) {
|
|
101
|
-
console.log('');
|
|
102
|
-
console.log(tui.bold('Result:'));
|
|
103
|
-
console.log(JSON.stringify(evalRunData.result, null, 2));
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return result;
|
|
107
|
-
} catch (ex) {
|
|
108
|
-
if (ex instanceof APIError && ex.status === 404) {
|
|
109
|
-
tui.fatal(`Eval run ${args.eval_run_id} not found`, ErrorCode.RESOURCE_NOT_FOUND);
|
|
110
|
-
}
|
|
111
|
-
tui.fatal(`Failed to get eval run: ${ex}`, ErrorCode.API_ERROR);
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { createCommand } from '../../../types';
|
|
2
|
-
import { getSubcommand } from './get';
|
|
3
|
-
import { listSubcommand } from './list';
|
|
4
|
-
import { getCommand } from '../../../command-prefix';
|
|
5
|
-
|
|
6
|
-
export const evalRunCommand = createCommand({
|
|
7
|
-
name: 'eval-run',
|
|
8
|
-
aliases: ['eval-runs'],
|
|
9
|
-
description: 'Manage eval runs',
|
|
10
|
-
tags: ['requires-auth'],
|
|
11
|
-
examples: [
|
|
12
|
-
{ command: getCommand('cloud eval-run list'), description: 'List all eval runs' },
|
|
13
|
-
{ command: getCommand('cloud eval-run get <id>'), description: 'Get eval run details' },
|
|
14
|
-
],
|
|
15
|
-
subcommands: [getSubcommand, listSubcommand],
|
|
16
|
-
});
|