veryfront 0.1.1164 → 0.1.1166
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/esm/cli/commands/init/config-generator.d.ts.map +1 -1
- package/esm/cli/commands/init/config-generator.js +2 -1
- package/esm/cli/commands/init/deno-config-generator.d.ts.map +1 -1
- package/esm/cli/commands/init/deno-config-generator.js +2 -1
- package/esm/cli/commands/serve/handler.d.ts +3 -1
- package/esm/cli/commands/serve/handler.d.ts.map +1 -1
- package/esm/cli/commands/serve/handler.js +27 -2
- package/esm/cli/templates/manifest.d.ts +1 -0
- package/esm/cli/templates/manifest.js +5 -4
- package/esm/deno.js +1 -1
- package/esm/src/server/handlers/request/static.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/static.handler.js +12 -2
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-generator.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/init/config-generator.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,wBAAwB;IACvC,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,sFAAsF;IACtF,oBAAoB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC1C,CAAC,CAAC;CACJ;AAED,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,MAAM,EAClB,WAAW,CAAC,EAAE,MAAM,EACpB,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"config-generator.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/init/config-generator.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,wBAAwB;IACvC,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,sFAAsF;IACtF,oBAAoB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC1C,CAAC,CAAC;CACJ;AAED,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,MAAM,EAClB,WAAW,CAAC,EAAE,MAAM,EACpB,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,IAAI,CAAC,CAuEf"}
|
|
@@ -48,7 +48,8 @@ export async function createPackageJson(projectDir, projectName, options = {}) {
|
|
|
48
48
|
scripts: {
|
|
49
49
|
dev: "veryfront dev",
|
|
50
50
|
build: "veryfront build",
|
|
51
|
-
|
|
51
|
+
start: "veryfront serve",
|
|
52
|
+
eval: "veryfront eval",
|
|
52
53
|
},
|
|
53
54
|
pnpm: {
|
|
54
55
|
onlyBuiltDependencies: ["esbuild", "veryfront"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deno-config-generator.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/init/deno-config-generator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deno-config-generator.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/init/deno-config-generator.ts"],"names":[],"mappings":"AAgBA;;;;;;;GAOG;AACH,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOxE"}
|
|
@@ -7,7 +7,8 @@ const DENO_CONFIG = {
|
|
|
7
7
|
tasks: {
|
|
8
8
|
dev: `deno run -A ${VERYFRONT_DENO_SPEC} dev`,
|
|
9
9
|
build: `deno run -A ${VERYFRONT_DENO_SPEC} build`,
|
|
10
|
-
|
|
10
|
+
start: `deno run -A ${VERYFRONT_DENO_SPEC} serve`,
|
|
11
|
+
eval: `deno run -A ${VERYFRONT_DENO_SPEC} eval`,
|
|
11
12
|
},
|
|
12
13
|
};
|
|
13
14
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ParsedArgs } from "../../shared/types.js";
|
|
2
|
-
|
|
2
|
+
declare const parseServeArgsBase: (args: ParsedArgs) => import("../../shared/args.js").SafeParseResult<import("../../../src/extensions/schema/schema-validator.js").InferShape<{
|
|
3
3
|
mode: import("../../../src/internal-agents/schema.js").Schema<string>;
|
|
4
4
|
port: import("../../../src/internal-agents/schema.js").Schema<number>;
|
|
5
5
|
hostname: import("../../../src/internal-agents/schema.js").Schema<string>;
|
|
@@ -8,5 +8,7 @@ export declare const parseServeArgs: (args: ParsedArgs) => import("../../shared/
|
|
|
8
8
|
binaryPath: import("../../../src/internal-agents/schema.js").Schema<string>;
|
|
9
9
|
debug: import("../../../src/internal-agents/schema.js").Schema<boolean>;
|
|
10
10
|
}>>;
|
|
11
|
+
export declare const parseServeArgs: typeof parseServeArgsBase;
|
|
11
12
|
export declare function handleServeCommand(args: ParsedArgs): Promise<void>;
|
|
13
|
+
export {};
|
|
12
14
|
//# sourceMappingURL=handler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/serve/handler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/serve/handler.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAyBxD,QAAA,MAAM,kBAAkB;;;;;;;;GAQtB,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,OAAO,kBAgBnC,CAAC;AAEF,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAaxE"}
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import { defineSchema, lazySchema } from "../../../src/schemas/index.js";
|
|
2
|
+
import { getEnv, getEnvNumber } from "../../../src/platform/compat/process.js";
|
|
2
3
|
import { DEFAULT_DEV_SERVER_PORT } from "../../utils/index.js";
|
|
3
4
|
import { ServerModeSchema } from "../../shared/types.js";
|
|
4
5
|
import { createArgParser, parseArgsOrThrow } from "../../shared/args.js";
|
|
5
6
|
import { ensureCliBundlerContracts } from "../../shared/default-contracts.js";
|
|
7
|
+
function getDefaultServePort() {
|
|
8
|
+
const veryfrontPort = getEnvNumber("VERYFRONT_PORT", DEFAULT_DEV_SERVER_PORT);
|
|
9
|
+
return getEnvNumber("PORT", veryfrontPort);
|
|
10
|
+
}
|
|
11
|
+
function getDefaultBindAddress() {
|
|
12
|
+
return getEnv("BIND_ADDRESS")?.trim() || "0.0.0.0";
|
|
13
|
+
}
|
|
6
14
|
const getServeArgsSchema = defineSchema((v) => v.object({
|
|
7
15
|
mode: ServerModeSchema.default("production"),
|
|
8
16
|
port: v.number().default(DEFAULT_DEV_SERVER_PORT),
|
|
9
|
-
hostname: v.string().default("
|
|
17
|
+
hostname: v.string().default("0.0.0.0"),
|
|
10
18
|
split: v.boolean().default(false),
|
|
11
19
|
binary: v.boolean().default(false),
|
|
12
20
|
binaryPath: v.string().default("./bin/veryfront"),
|
|
13
21
|
debug: v.boolean().default(false),
|
|
14
22
|
}));
|
|
15
23
|
const ServeArgsSchema = lazySchema(getServeArgsSchema);
|
|
16
|
-
|
|
24
|
+
const parseServeArgsBase = createArgParser(ServeArgsSchema, {
|
|
17
25
|
mode: { keys: ["mode", "m"], type: "string" },
|
|
18
26
|
port: { keys: ["port", "p"], type: "number" },
|
|
19
27
|
hostname: { keys: ["hostname", "host"], type: "string" },
|
|
@@ -22,6 +30,23 @@ export const parseServeArgs = createArgParser(ServeArgsSchema, {
|
|
|
22
30
|
binaryPath: { keys: ["binary-path"], type: "string" },
|
|
23
31
|
debug: { keys: ["debug"], type: "boolean" },
|
|
24
32
|
});
|
|
33
|
+
export const parseServeArgs = (args) => {
|
|
34
|
+
const result = parseServeArgsBase(args);
|
|
35
|
+
if (!result.success)
|
|
36
|
+
return result;
|
|
37
|
+
return {
|
|
38
|
+
success: true,
|
|
39
|
+
data: {
|
|
40
|
+
...result.data,
|
|
41
|
+
port: args.port === undefined && args.p === undefined
|
|
42
|
+
? getDefaultServePort()
|
|
43
|
+
: result.data.port,
|
|
44
|
+
hostname: args.hostname === undefined && args.host === undefined
|
|
45
|
+
? getDefaultBindAddress()
|
|
46
|
+
: result.data.hostname,
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
};
|
|
25
50
|
export async function handleServeCommand(args) {
|
|
26
51
|
const opts = parseArgsOrThrow(parseServeArgs, "serve", args);
|
|
27
52
|
await ensureCliBundlerContracts();
|
|
@@ -22,13 +22,14 @@ export default {
|
|
|
22
22
|
},
|
|
23
23
|
"ai-agent": {
|
|
24
24
|
"files": {
|
|
25
|
-
"agents/assistant.ts": "import { agent } from \"veryfront/agent\";\n\nexport default agent({\n id: \"assistant\",\n name: \"AI Agent\",\n description: \"Ask questions and use tools.\",\n system: \"You are a helpful assistant. Answer questions clearly and concisely.\",\n tools: true,\n maxSteps: 10,\n suggestions: {\n suggestions: [\n {\n type: \"prompt\",\n title: \"
|
|
25
|
+
"agents/assistant.ts": "import { agent } from \"veryfront/agent\";\n\nexport default agent({\n id: \"assistant\",\n name: \"AI Agent\",\n description: \"Ask questions and use tools.\",\n system: \"You are a helpful assistant. Answer questions clearly and concisely.\",\n tools: true,\n maxSteps: 10,\n suggestions: {\n suggestions: [\n {\n type: \"prompt\",\n title: \"Plan a project\",\n prompt: \"Create a concise plan for building and launching a small web application.\",\n },\n {\n type: \"prompt\",\n title: \"Split a bill\",\n prompt:\n \"Calculate an 18% tip on $84.50, then split the total evenly among three people.\",\n },\n ],\n },\n});\n",
|
|
26
26
|
"app/api/ag-ui/route.ts": "import { createAgUiHandler } from \"veryfront/agent\";\n\nexport const POST = createAgUiHandler(\"assistant\");\n",
|
|
27
|
-
"app/layout.tsx": "import \"../globals.css\";\nimport { Head } from \"veryfront/head\";\n\nexport default function RootLayout({\n children,\n}: {\n children: React.ReactNode;\n}): React.ReactNode {\n return (\n <>\n <Head>\n <title>AI Chat</title>\n <link rel=\"icon\" href=\"/favicon.svg\" type=\"image/svg+xml\" />\n </Head>\n
|
|
28
|
-
"app/page.tsx": "
|
|
27
|
+
"app/layout.tsx": "import \"../globals.css\";\nimport { Head } from \"veryfront/head\";\n\nexport default function RootLayout({\n children,\n}: {\n children: React.ReactNode;\n}): React.ReactNode {\n return (\n <>\n <Head>\n <title>AI Chat</title>\n <link rel=\"icon\" href=\"/favicon.svg\" type=\"image/svg+xml\" />\n </Head>\n {children}\n </>\n );\n}\n",
|
|
28
|
+
"app/page.tsx": "\"use client\";\n\nimport { Chat } from \"veryfront/chat\";\n\nexport default function ChatPage(): React.JSX.Element {\n return <Chat agentId=\"assistant\" className=\"h-screen\" />;\n}\n",
|
|
29
|
+
"evals/assistant.eval.ts": "import { datasets, evalAgent, metrics } from \"veryfront/eval\";\n\nexport default evalAgent({\n name: \"Assistant smoke test\",\n target: \"agent:assistant\",\n dataset: datasets.inline([\n {\n id: \"calculator\",\n input: \"Use the calculator tool to multiply 24 by 7.\",\n reference: \"168\",\n },\n ]),\n metrics: [\n metrics.answer.contains({ text: \"168\" }).gate(),\n metrics.agent.calledTool(\"calculator\").gate(),\n metrics.agent.noFailedTools().gate(),\n ],\n});\n",
|
|
29
30
|
"globals.css": "@import \"tailwindcss\";\n",
|
|
30
31
|
"public/favicon.svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 64 64\">\n <rect width=\"64\" height=\"64\" rx=\"14\" fill=\"#111827\"/>\n <path d=\"M18 36 31 14h15L33 36h13L33 58H18l13-22H18Z\" fill=\"#22c55e\"/>\n</svg>\n",
|
|
31
|
-
"README.md": "# AI Agent\n\nA
|
|
32
|
+
"README.md": "# AI Agent\n\nA small, customizable agent with a streaming chat UI and tool support.\n\n## What's included\n\n- Single assistant agent with streaming chat UI\n- Example calculator tool\n- Smoke eval for the agent and calculator\n- App-mode `Chat` component for real-time responses\n\n## Structure\n\n```\nagents/assistant.ts Agent definition\ntools/calculator.ts Example tool\nevals/assistant.eval.ts Agent smoke eval\napp/\n api/ag-ui/route.ts AG-UI endpoint\n page.tsx Chat interface\n```\n\n## Customize\n\n- Edit `agents/assistant.ts` to change the agent's identity, instructions, and suggestions.\n- Add or replace files in `tools/` to give the agent new capabilities.\n- Update `evals/assistant.eval.ts`, then run `npm run eval -- assistant`.\n- Edit `app/page.tsx` when you need to customize the chat UI.\n",
|
|
32
33
|
"tools/calculator.ts": "import { tool } from \"veryfront/tool\";\nimport { defineSchema } from \"veryfront/schemas\";\n\nexport default tool({\n id: \"calculator\",\n description: \"Perform basic arithmetic operations\",\n inputSchema: defineSchema((v) => v.object({\n operation: v.enum([\"add\", \"subtract\", \"multiply\", \"divide\"]),\n a: v.number(),\n b: v.number(),\n }))(),\n execute: ({ operation, a, b }) => {\n if (operation === \"divide\" && b === 0) {\n throw new Error(\"Cannot divide by zero\");\n }\n\n if (operation === \"add\") return { result: a + b };\n if (operation === \"subtract\") return { result: a - b };\n if (operation === \"multiply\") return { result: a * b };\n return { result: a / b };\n },\n});\n",
|
|
33
34
|
"tsconfig.json": "{\n \"compilerOptions\": {\n \"target\": \"ES2022\",\n \"module\": \"ESNext\",\n \"moduleResolution\": \"bundler\",\n \"strict\": true,\n \"jsx\": \"react-jsx\",\n \"skipLibCheck\": true,\n \"esModuleInterop\": true,\n \"paths\": {\n \"@/*\": [\"./*\"]\n }\n },\n \"include\": [\"**/*.ts\", \"**/*.tsx\"],\n \"exclude\": [\"node_modules\"]\n}\n"
|
|
34
35
|
}
|
package/esm/deno.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"static.handler.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/request/static.handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAmB,aAAa,EAAE,MAAM,aAAa,CAAC;AAoCnG,qBAAa,aAAc,SAAQ,WAAW;IAC5C,QAAQ,EAAE,eAAe,CAOvB;IAEF,OAAO,CAAC,aAAa,CAA2B;IAEhD,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAejE,OAAO,CAAC,cAAc;
|
|
1
|
+
{"version":3,"file":"static.handler.d.ts","sourceRoot":"","sources":["../../../../../src/src/server/handlers/request/static.handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAmB,aAAa,EAAE,MAAM,aAAa,CAAC;AAoCnG,qBAAa,aAAc,SAAQ,WAAW;IAC5C,QAAQ,EAAE,eAAe,CAOvB;IAEF,OAAO,CAAC,aAAa,CAA2B;IAEhD,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAejE,OAAO,CAAC,cAAc;CAqFvB"}
|
|
@@ -67,13 +67,23 @@ export class StaticHandler extends BaseHandler {
|
|
|
67
67
|
const isPreviewMode = ctx.requestContext?.mode === "preview" && !isLocal;
|
|
68
68
|
const builder = this.createResponseBuilder(ctx)
|
|
69
69
|
.withCORS(req, ctx.securityConfig?.cors);
|
|
70
|
-
const
|
|
70
|
+
const resolveOptions = {
|
|
71
71
|
projectDir: ctx.projectDir,
|
|
72
72
|
adapter: ctx.adapter,
|
|
73
73
|
isPreviewMode,
|
|
74
74
|
isLocalProject: isLocal,
|
|
75
|
-
}
|
|
75
|
+
};
|
|
76
|
+
const result = await this.staticService.resolveFile(pathname, resolveOptions);
|
|
76
77
|
if (!result) {
|
|
78
|
+
if (pathname === "/favicon.ico" &&
|
|
79
|
+
await this.staticService.resolveFile("/favicon.svg", resolveOptions)) {
|
|
80
|
+
return builder
|
|
81
|
+
.withSecurity(ctx.securityConfig ?? undefined, req)
|
|
82
|
+
.withCache("no-cache")
|
|
83
|
+
.withHeaders({ location: new URL("/favicon.svg", req.url).toString() })
|
|
84
|
+
.withStatus(307)
|
|
85
|
+
.build();
|
|
86
|
+
}
|
|
77
87
|
if (isDynamicBuildFallbackPath(pathname))
|
|
78
88
|
return null;
|
|
79
89
|
if (!this.staticService.isAssetRequest(pathname))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1166",
|
|
4
4
|
"description": "The simplest way to build AI-powered apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -336,10 +336,10 @@
|
|
|
336
336
|
"@types/react": "19.2.14",
|
|
337
337
|
"@types/react-dom": "19.2.3",
|
|
338
338
|
"ws": "8.21.0",
|
|
339
|
-
"@veryfront/ext-bundler-esbuild": "0.1.
|
|
340
|
-
"@veryfront/ext-content-mdx": "0.1.
|
|
341
|
-
"@veryfront/ext-css-tailwind": "0.1.
|
|
342
|
-
"@veryfront/ext-parser-babel": "0.1.
|
|
339
|
+
"@veryfront/ext-bundler-esbuild": "0.1.1166",
|
|
340
|
+
"@veryfront/ext-content-mdx": "0.1.1166",
|
|
341
|
+
"@veryfront/ext-css-tailwind": "0.1.1166",
|
|
342
|
+
"@veryfront/ext-parser-babel": "0.1.1166"
|
|
343
343
|
},
|
|
344
344
|
"devDependencies": {
|
|
345
345
|
"@types/node": "20.9.0"
|