@agentuity/cli 0.0.54 → 0.0.56
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/cmd/ai/schema/generate.d.ts +3 -0
- package/dist/cmd/ai/schema/generate.d.ts.map +1 -0
- package/dist/cmd/ai/schema/generate.js +50 -0
- package/dist/cmd/ai/schema/generate.js.map +1 -0
- package/dist/cmd/ai/schema/index.d.ts.map +1 -1
- package/dist/cmd/ai/schema/index.js +2 -1
- package/dist/cmd/ai/schema/index.js.map +1 -1
- package/dist/cmd/build/ast.d.ts.map +1 -1
- package/dist/cmd/build/ast.js +107 -86
- package/dist/cmd/build/ast.js.map +1 -1
- package/dist/cmd/build/ast.test.js +135 -370
- package/dist/cmd/build/ast.test.js.map +1 -1
- package/dist/cmd/build/bundler.d.ts.map +1 -1
- package/dist/cmd/build/bundler.js +9 -6
- package/dist/cmd/build/bundler.js.map +1 -1
- package/dist/cmd/build/index.d.ts.map +1 -1
- package/dist/cmd/build/index.js +2 -0
- package/dist/cmd/build/index.js.map +1 -1
- package/dist/cmd/build/plugin.d.ts.map +1 -1
- package/dist/cmd/build/plugin.js +10 -4
- package/dist/cmd/build/plugin.js.map +1 -1
- package/dist/cmd/cloud/session/get.d.ts.map +1 -1
- package/dist/cmd/cloud/session/get.js +77 -17
- package/dist/cmd/cloud/session/get.js.map +1 -1
- package/dist/cmd/dev/index.d.ts.map +1 -1
- package/dist/cmd/dev/index.js +32 -14
- package/dist/cmd/dev/index.js.map +1 -1
- package/dist/cmd/project/template-flow.d.ts.map +1 -1
- package/dist/cmd/project/template-flow.js +1 -0
- package/dist/cmd/project/template-flow.js.map +1 -1
- package/dist/config.d.ts +27 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +31 -3
- package/dist/config.js.map +1 -1
- package/dist/types.d.ts +24 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -75
- package/dist/types.js.map +1 -1
- package/package.json +3 -3
- package/src/cmd/ai/schema/generate.ts +64 -0
- package/src/cmd/ai/schema/index.ts +2 -1
- package/src/cmd/build/ast.test.ts +157 -549
- package/src/cmd/build/ast.ts +121 -94
- package/src/cmd/build/bundler.ts +9 -6
- package/src/cmd/build/index.ts +2 -0
- package/src/cmd/build/plugin.ts +11 -4
- package/src/cmd/cloud/session/get.ts +91 -19
- package/src/cmd/dev/index.ts +39 -14
- package/src/cmd/project/template-flow.ts +1 -0
- package/src/config.ts +44 -5
- package/src/types.ts +5 -84
package/src/config.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { existsSync } from 'node:fs';
|
|
2
|
+
import { existsSync, mkdirSync } from 'node:fs';
|
|
3
3
|
import type { Logger } from '@agentuity/core';
|
|
4
4
|
import {
|
|
5
5
|
BuildMetadataSchema,
|
|
@@ -486,6 +486,7 @@ class ProjectConfigNotFoundExpection extends Error {
|
|
|
486
486
|
type ProjectConfig = z.infer<typeof ProjectSchema>;
|
|
487
487
|
|
|
488
488
|
function generateJSON5WithComments(
|
|
489
|
+
jsonSchema: string,
|
|
489
490
|
schema: z.ZodObject<z.ZodRawShape>,
|
|
490
491
|
data: Record<string, unknown>
|
|
491
492
|
): string {
|
|
@@ -493,6 +494,8 @@ function generateJSON5WithComments(
|
|
|
493
494
|
const shape = schema.shape;
|
|
494
495
|
const keys = Object.keys(shape);
|
|
495
496
|
|
|
497
|
+
lines.push(` "$schema": "${jsonSchema}",`);
|
|
498
|
+
|
|
496
499
|
for (let i = 0; i < keys.length; i++) {
|
|
497
500
|
const key = keys[i];
|
|
498
501
|
const fieldSchema = shape[key] as z.ZodTypeAny;
|
|
@@ -551,23 +554,59 @@ export async function loadProjectConfig(
|
|
|
551
554
|
return result.data;
|
|
552
555
|
}
|
|
553
556
|
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
+
export const InitialProjectConfigSchema = z.intersection(
|
|
558
|
+
ProjectSchema,
|
|
559
|
+
z.object({
|
|
560
|
+
sdkKey: z.string().describe('the project specific SDK key'),
|
|
561
|
+
$schema: z.string().optional(),
|
|
562
|
+
})
|
|
563
|
+
);
|
|
564
|
+
|
|
565
|
+
type InitialProjectConfig = z.infer<typeof InitialProjectConfigSchema>;
|
|
557
566
|
|
|
558
567
|
export async function createProjectConfig(dir: string, config: InitialProjectConfig) {
|
|
559
568
|
const { sdkKey, ...sanitizedConfig } = config;
|
|
560
569
|
|
|
570
|
+
// generate the project config
|
|
561
571
|
const configPath = join(dir, 'agentuity.json');
|
|
562
|
-
const json5Content = generateJSON5WithComments(
|
|
572
|
+
const json5Content = generateJSON5WithComments(
|
|
573
|
+
'https://agentuity.dev/schema/cli/v1/agentuity.json',
|
|
574
|
+
ProjectSchema,
|
|
575
|
+
sanitizedConfig
|
|
576
|
+
);
|
|
563
577
|
await Bun.write(configPath, json5Content + '\n');
|
|
564
578
|
|
|
579
|
+
// generate the .env file with initial secret
|
|
565
580
|
const envPath = join(dir, '.env');
|
|
566
581
|
const comment =
|
|
567
582
|
'# AGENTUITY_SDK_KEY is a sensitive value and should not be committed to version control.';
|
|
568
583
|
const content = `${comment}\nAGENTUITY_SDK_KEY=${sdkKey}\n`;
|
|
569
584
|
await Bun.write(envPath, content);
|
|
570
585
|
await chmod(envPath, 0o600);
|
|
586
|
+
|
|
587
|
+
// generate the vscode settings
|
|
588
|
+
const vscodeDir = join(dir, '.vscode');
|
|
589
|
+
mkdirSync(vscodeDir);
|
|
590
|
+
|
|
591
|
+
const settings = {
|
|
592
|
+
'files.associations': {
|
|
593
|
+
'agentuity.json': 'jsonc',
|
|
594
|
+
},
|
|
595
|
+
'search.exclude': {
|
|
596
|
+
'**/.git/**': true,
|
|
597
|
+
'**/node_modules/**': true,
|
|
598
|
+
'**/bun.lock': true,
|
|
599
|
+
'**/.agentuity/**': true,
|
|
600
|
+
},
|
|
601
|
+
'json.schemas': [
|
|
602
|
+
{
|
|
603
|
+
fileMatch: ['agentuity.json'],
|
|
604
|
+
url: 'https://agentuity.dev/schema/cli/v1/agentuity.json',
|
|
605
|
+
},
|
|
606
|
+
],
|
|
607
|
+
};
|
|
608
|
+
|
|
609
|
+
await Bun.write(join(vscodeDir, 'settings.json'), JSON.stringify(settings, null, 2));
|
|
571
610
|
}
|
|
572
611
|
|
|
573
612
|
export async function loadBuildMetadata(dir: string): Promise<BuildMetadata> {
|
package/src/types.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { Logger } from '@agentuity/core';
|
|
2
|
-
import { Deployment } from '@agentuity/server';
|
|
2
|
+
import { Deployment, BuildMetadataSchema as ServerBuildMetadataSchema } from '@agentuity/server';
|
|
3
3
|
import type * as z from 'zod';
|
|
4
4
|
import { z as zod } from 'zod';
|
|
5
5
|
import type { APIClient } from './api';
|
|
6
6
|
|
|
7
|
+
export { Deployment };
|
|
8
|
+
|
|
7
9
|
export type { Logger };
|
|
8
10
|
|
|
9
11
|
export const ConfigSchema = zod.object({
|
|
@@ -426,91 +428,10 @@ export type SubcommandDefinition =
|
|
|
426
428
|
export const ProjectSchema = zod.object({
|
|
427
429
|
projectId: zod.string().describe('the project id'),
|
|
428
430
|
orgId: zod.string().describe('the organization id'),
|
|
431
|
+
region: zod.string().describe('the region identifier that the project is deployed into'),
|
|
429
432
|
deployment: Deployment.optional().describe('the deployment configuration'),
|
|
430
433
|
});
|
|
431
434
|
|
|
432
|
-
const
|
|
433
|
-
filename: zod.string().describe('the relative path for the file'),
|
|
434
|
-
version: zod.string().describe('the SHA256 content of the file'),
|
|
435
|
-
identifier: zod.string().describe('the folder for the file'),
|
|
436
|
-
};
|
|
437
|
-
|
|
438
|
-
const EvalSchema = zod.object({
|
|
439
|
-
...FileFields,
|
|
440
|
-
id: zod.string().describe('the unique calculated id for the eval'),
|
|
441
|
-
evalId: zod.string().describe('the unique id for eval for the project across deployments'),
|
|
442
|
-
name: zod.string().describe('the name of the eval'),
|
|
443
|
-
description: zod.string().optional().describe('the eval description'),
|
|
444
|
-
agentIdentifier: zod.string().describe('the identifier of the agent'),
|
|
445
|
-
projectId: zod.string().describe('the project id'),
|
|
446
|
-
});
|
|
447
|
-
|
|
448
|
-
const BaseAgentFields = {
|
|
449
|
-
...FileFields,
|
|
450
|
-
id: zod.string().describe('the unique calculated id for the agent'),
|
|
451
|
-
agentId: zod.string().describe('the unique id for agent for the project across deployments'),
|
|
452
|
-
projectId: zod.string().describe('the project id'),
|
|
453
|
-
name: zod.string().describe('the name of the agent'),
|
|
454
|
-
description: zod.string().optional().describe('the agent description'),
|
|
455
|
-
evals: zod.array(EvalSchema).optional().describe('the evals for the agent'),
|
|
456
|
-
};
|
|
457
|
-
|
|
458
|
-
const AgentSchema = zod.object({
|
|
459
|
-
...BaseAgentFields,
|
|
460
|
-
subagents: zod.array(zod.object(BaseAgentFields)).optional().describe('subagents of this agent'),
|
|
461
|
-
});
|
|
462
|
-
|
|
463
|
-
export const BuildMetadataSchema = zod.object({
|
|
464
|
-
routes: zod.array(
|
|
465
|
-
zod.object({
|
|
466
|
-
id: zod.string().describe('the unique calculated id for the route'),
|
|
467
|
-
filename: zod.string().describe('the relative path for the file'),
|
|
468
|
-
path: zod.string().describe('the route path'),
|
|
469
|
-
method: zod.enum(['get', 'post', 'put', 'delete', 'patch']).describe('the HTTP method'),
|
|
470
|
-
version: zod.string().describe('the SHA256 content of the file'),
|
|
471
|
-
type: zod.enum(['api', 'sms', 'email', 'cron', 'websocket', 'sse', 'stream']),
|
|
472
|
-
config: zod
|
|
473
|
-
.record(zod.string(), zod.unknown())
|
|
474
|
-
.optional()
|
|
475
|
-
.describe('type specific configuration'),
|
|
476
|
-
})
|
|
477
|
-
),
|
|
478
|
-
agents: zod.array(AgentSchema),
|
|
479
|
-
assets: zod.array(
|
|
480
|
-
zod.object({
|
|
481
|
-
filename: zod.string().describe('the relative path for the file'),
|
|
482
|
-
kind: zod.string().describe('the type of asset'),
|
|
483
|
-
contentType: zod.string().describe('the content-type for the file'),
|
|
484
|
-
size: zod.number().describe('the size in bytes for the file'),
|
|
485
|
-
})
|
|
486
|
-
),
|
|
487
|
-
project: zod.object({
|
|
488
|
-
id: zod.string().describe('the project id'),
|
|
489
|
-
name: zod.string().describe('the name of the project (from package.json)'),
|
|
490
|
-
version: zod.string().optional().describe('the version of the project (from package.json)'),
|
|
491
|
-
}),
|
|
492
|
-
deployment: zod.object({
|
|
493
|
-
id: zod.string().describe('the deployment id'),
|
|
494
|
-
date: zod.string().describe('the date the deployment was created in UTC format'),
|
|
495
|
-
git: zod
|
|
496
|
-
.object({
|
|
497
|
-
repo: zod.string().optional().describe('the repository name'),
|
|
498
|
-
commit: zod.string().optional().describe('the git commit sha'),
|
|
499
|
-
message: zod.string().optional().describe('the git commit message'),
|
|
500
|
-
branch: zod.string().optional().describe('the git branch'),
|
|
501
|
-
tags: zod.array(zod.string()).optional().describe('the tags for the current branch'),
|
|
502
|
-
pr: zod.string().optional().describe('the pull request number'),
|
|
503
|
-
})
|
|
504
|
-
.optional()
|
|
505
|
-
.describe('git commit information'),
|
|
506
|
-
build: zod.object({
|
|
507
|
-
bun: zod.string().describe('the version of bun that was used to build the deployment'),
|
|
508
|
-
agentuity: zod.string().describe('the version of the agentuity runtime'),
|
|
509
|
-
arch: zod.string().describe('the machine architecture'),
|
|
510
|
-
platform: zod.string().describe('the machine os platform'),
|
|
511
|
-
}),
|
|
512
|
-
}),
|
|
513
|
-
});
|
|
514
|
-
|
|
435
|
+
export const BuildMetadataSchema = ServerBuildMetadataSchema;
|
|
515
436
|
export type BuildMetadata = zod.infer<typeof BuildMetadataSchema>;
|
|
516
437
|
export type Project = zod.infer<typeof ProjectSchema>;
|