@nylorun/create-agent 0.2.1-beta → 0.3.1-beta

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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.1-beta
4
+
5
+ ### Patch Changes
6
+
7
+ - fd24b00: Flatten Runtime agent routes to `/:id/...` and pass matching `basePath` from the Hono mount so discovery, manifests, and AG-UI resolve at `/agents/:id/...` for Studio.
8
+ - Update the tested Harness, Runtime, and Studio compatibility combination.
9
+
10
+ ## 0.3.0-beta
11
+
12
+ ### Minor Changes
13
+
14
+ - 4badb5b: Move model execution to session startup, provide Runtime as a mountable Hono router, and generate Hono-first projects with supervised application and Studio development. Studio now resolves root-relative Runtime endpoints correctly for custom mount paths.
15
+
16
+ ### Patch Changes
17
+
18
+ - Update the tested Harness, Runtime, and Studio compatibility combination.
19
+
3
20
  ## 0.2.1-beta
4
21
 
5
22
  ### Patch Changes
package/README.md CHANGED
@@ -4,9 +4,9 @@
4
4
  npm create @nylorun/agent@beta my-agent
5
5
  ```
6
6
 
7
- Creates a project that directly installs Harness and Runtime, with Studio as a development dependency. The project owns its ordinary `agent/` code and composes the packages in `nylorun.config.ts`. No server or provider implementation is copied into the project.
7
+ Creates a project that directly installs Harness and Runtime, with Studio as a development dependency. The project owns its Hono application in `src/index.ts`; Runtime supplies the agent router and lifecycle only.
8
8
 
9
- Creation installs dependencies, runs Runtime’s provider/model configuration wizard in the same terminal, then starts development. Pass `-- --no-studio` for a headless project or `-- --no-open` to suppress the browser. `nylorun configure` connects a provider without importing the agent graph.
9
+ Creation installs dependencies, runs Runtime’s provider/model configuration wizard in the same terminal, then starts the application and Studio. Pass `-- --no-studio` for a headless project or `-- --no-open` to start Studio without opening a browser. `nylorun configure` connects a provider without importing the agent graph.
10
10
 
11
11
  ## Configuration and recovery
12
12
 
@@ -38,7 +38,7 @@ model request to validate connectivity.
38
38
 
39
39
  ## Maintaining examples
40
40
 
41
- `starter/` is the canonical project template. `compatibility.json` pins tested Harness, Runtime, and Studio versions. `examples.recipe.json` explicitly adds the eleven-agent registry, local package references, persistence/media configuration, and test dependencies.
41
+ `starter/` is the canonical project template. `compatibility.json` pins tested Harness, Runtime, and Studio versions. `examples.recipe.json` explicitly adds local package references and test dependencies. Persistence and media stay in the authored examples catalog.
42
42
 
43
43
  From the repository root:
44
44
 
@@ -48,7 +48,7 @@ npm install --prefix examples
48
48
  npm run examples:check
49
49
  ```
50
50
 
51
- The renderer is shared by project creation, the isolated starter development runner, and examples synchronization. Sync owns shell files listed in `examples/.scaffold-manifest.json`; it never edits `agent/`, tests, local model selection, credentials, or `.data/`. Edit generated configuration in the recipe or template. Conflicts with manual generated-file edits fail before any writes. CI checks the rendered shell and runs examples against the current stack. Package changes can require explicit adaptations in authored code; sync does not rewrite TypeScript imports.
51
+ The renderer is shared by project creation, the isolated starter development runner, and examples synchronization. Sync owns shell files listed in `examples/.scaffold-manifest.json`, including the generated `scripts/dev.mjs` supervisor; it never edits `agents/`, tests, other scripts, local model selection, credentials, or `.data/`. Edit generated configuration in the recipe or template. Conflicts with manual generated-file edits fail before any writes. CI checks the rendered shell and runs examples against the current stack. Package changes can require explicit adaptations in authored code; sync does not rewrite TypeScript imports.
52
52
 
53
53
  `npm run dev:starter` from the repository root previews a fresh project using local packages, including unpublished changes. Each preview has its own retained directory and provider configuration.
54
54
 
@@ -1,5 +1,5 @@
1
1
  {
2
- "harness": "0.11.1-beta",
3
- "studio": "0.4.1-beta",
4
- "runtime": "0.1.2-beta"
2
+ "harness": "0.12.0-beta",
3
+ "studio": "0.4.2-beta",
4
+ "runtime": "0.2.1-beta"
5
5
  }
package/dist/arguments.js CHANGED
@@ -3,13 +3,7 @@ export function parse(argv) {
3
3
  const [directory, ...flags] = argv;
4
4
  if (!directory || directory.startsWith("-"))
5
5
  throw new Error(usage);
6
- if (flags.some((flag) => ![
7
- "--studio",
8
- "--no-studio",
9
- "--no-open",
10
- "--skip-config",
11
- "--yes",
12
- ].includes(flag)))
6
+ if (flags.some((flag) => !["--no-studio", "--no-open", "--skip-config", "--yes"].includes(flag)))
13
7
  throw new Error(usage);
14
8
  return Object.freeze({
15
9
  directory,
@@ -1,5 +1,5 @@
1
1
  {
2
- "harness": "0.11.1-beta",
3
- "studio": "0.4.1-beta",
4
- "runtime": "0.1.2-beta"
2
+ "harness": "0.12.0-beta",
3
+ "studio": "0.4.2-beta",
4
+ "runtime": "0.2.1-beta"
5
5
  }
package/dist/project.js CHANGED
@@ -27,7 +27,15 @@ export async function createProject(options, compatibility, dependencies) {
27
27
  const temporary = join(dirname(destination), `.${basename(destination)}-${randomUUID()}`);
28
28
  await dependencies.makeDirectory(temporary);
29
29
  try {
30
- for (const [relative, content] of Object.entries(await starterFiles(compatibility, options.studio))) {
30
+ const files = {
31
+ ...(await starterFiles(compatibility, options.studio)),
32
+ };
33
+ const name = packageName(basename(destination));
34
+ const manifest = JSON.parse(files["package.json"]);
35
+ manifest.name = name;
36
+ files["package.json"] = JSON.stringify(manifest, null, 2) + "\n";
37
+ files["README.md"] = files["README.md"].replace(/^# .+\n/u, `# ${name}\n`);
38
+ for (const [relative, content] of Object.entries(files)) {
31
39
  const file = join(temporary, relative);
32
40
  await dependencies.makeDirectory(dirname(file));
33
41
  await dependencies.write(file, content);
@@ -79,6 +87,14 @@ export async function createProject(options, compatibility, dependencies) {
79
87
  }
80
88
  }
81
89
  }
90
+ function packageName(directory) {
91
+ const name = directory
92
+ .toLowerCase()
93
+ .replace(/[^a-z0-9._-]+/gu, "-")
94
+ .replace(/^[-.]+|[-.]+$/gu, "")
95
+ .replace(/-+/gu, "-");
96
+ return name || "my-nylorun-agent";
97
+ }
82
98
  function quote(value) {
83
99
  if (/^[a-zA-Z0-9_./-]+$/.test(value))
84
100
  return value;
package/dist/scaffold.js CHANGED
@@ -33,8 +33,12 @@ export async function starterFiles(compatibility, studio) {
33
33
  if (!studio) {
34
34
  const manifest = JSON.parse(files["package.json"]);
35
35
  delete manifest.devDependencies["@nylorun/studio"];
36
- manifest.scripts.dev = "nylorun dev --no-studio";
36
+ manifest.scripts.dev = manifest.scripts["dev:app"];
37
+ delete manifest.scripts["dev:app"];
38
+ delete manifest.scripts.studio;
39
+ delete files["scripts/dev.mjs"];
37
40
  files["package.json"] = JSON.stringify(manifest, null, 2) + "\n";
41
+ files["README.md"] = files["README.md"].replace("`npm run dev` starts your app on port 3000, waits until its agent endpoint is ready, then starts Studio and opens it in your browser. Use `npm run dev -- --no-open` to start Studio without opening a browser. Run `npm run studio` in another terminal to attach Studio separately.", "`npm run dev` starts your app on port 3000.");
38
42
  }
39
43
  return Object.freeze(files);
40
44
  }
@@ -1,6 +1,6 @@
1
1
  # My agent
2
2
 
3
3
  The creator configures a provider before starting development. For later sessions, run `npm run dev`. If setup was skipped with `--skip-config` or interrupted, run `npm run configure` first, then `npm run dev`.
4
- Edit agents under `agent/` and compose Runtime in `nylorun.config.ts`.
4
+ Edit agents under `agents/` and compose your Hono app in `src/index.ts`.
5
5
 
6
- `npm run dev -- --no-studio` starts without Studio. `npm run build` creates `dist/`; deploy it alongside `package.json`, installed production dependencies, and private project configuration, then run `npm start`.
6
+ `npm run dev` starts your app on port 3000, waits until its agent endpoint is ready, then starts Studio and opens it in your browser. Use `npm run dev -- --no-open` to start Studio without opening a browser. Run `npm run studio` in another terminal to attach Studio separately. `npm run build` creates `dist/`; deploy it alongside `package.json`, installed production dependencies, and private project configuration, then run `npm start`.
@@ -1,10 +1,7 @@
1
1
  import { Agent } from "@nylorun/harness";
2
- import { piModel } from "@nylorun/runtime";
3
2
 
4
3
  export const assistant = Agent({
5
4
  id: "assistant",
6
5
  name: "Assistant",
7
6
  instructions: ["You are helpful."],
8
- })
9
- .with(piModel())
10
- .build();
7
+ }).build();
@@ -8,20 +8,24 @@
8
8
  },
9
9
  "scripts": {
10
10
  "configure": "nylorun configure",
11
- "dev": "nylorun dev",
12
- "inspect": "nylorun inspect",
13
- "build": "nylorun build",
14
- "start": "nylorun start",
11
+ "dev": "node scripts/dev.mjs",
12
+ "dev:app": "tsx watch src/index.ts",
13
+ "studio": "nylorun studio --agent-url http://localhost:3000/agents",
14
+ "build": "node -e \"import('node:fs/promises').then(async ({rm,cp}) => { await rm('dist', { recursive: true, force: true }); await cp('agents', 'dist/agents', { recursive: true, filter: (source) => !source.endsWith('.ts') }); })\" && tsc -p tsconfig.build.json",
15
+ "start": "node dist/src/index.js",
15
16
  "check": "tsc --noEmit"
16
17
  },
17
18
  "dependencies": {
18
19
  "@nylorun/harness": "{{HARNESS_VERSION}}",
19
20
  "@nylorun/runtime": "{{RUNTIME_VERSION}}",
21
+ "@hono/node-server": "^2.1.1",
22
+ "hono": "^4.13.7",
20
23
  "zod": "^4.1.12"
21
24
  },
22
25
  "devDependencies": {
23
26
  "@nylorun/studio": "{{STUDIO_VERSION}}",
24
27
  "@types/node": "^22.18.0",
25
- "typescript": "^5.9.3"
28
+ "tsx": "^4.20.6",
29
+ "typescript": "^7.0.2"
26
30
  }
27
31
  }
@@ -0,0 +1,82 @@
1
+ import { spawn } from "node:child_process";
2
+ import { join } from "node:path";
3
+
4
+ const args = process.argv.slice(2);
5
+ if (
6
+ args.some((arg) => arg !== "--no-open") ||
7
+ args.filter((arg) => arg === "--no-open").length > 1
8
+ )
9
+ throw new Error("Usage: npm run dev [-- --no-open]");
10
+
11
+ const port = Number(process.env.PORT ?? "3000");
12
+ if (!Number.isInteger(port) || port < 1 || port > 65535)
13
+ throw new Error("PORT must be an integer between 1 and 65535.");
14
+
15
+ const bin = (name) =>
16
+ join(
17
+ process.cwd(),
18
+ "node_modules",
19
+ ".bin",
20
+ process.platform === "win32" ? `${name}.cmd` : name
21
+ );
22
+ const spawnOptions = { stdio: "inherit", shell: process.platform === "win32" };
23
+ const app = spawn(bin("tsx"), ["watch", "src/index.ts"], spawnOptions);
24
+ let studio;
25
+ let stopping = false;
26
+
27
+ const exitCode = (code, signal) =>
28
+ code ?? (signal === "SIGINT" ? 130 : signal === "SIGTERM" ? 143 : 1);
29
+ const stop = (signal) => {
30
+ if (stopping) return;
31
+ stopping = true;
32
+ for (const child of [app, studio]) child?.kill(signal);
33
+ };
34
+
35
+ process.once("SIGINT", () => stop("SIGINT"));
36
+ process.once("SIGTERM", () => stop("SIGTERM"));
37
+
38
+ app.once("exit", (code, signal) => {
39
+ if (!stopping) {
40
+ process.exitCode = exitCode(code, signal);
41
+ stop("SIGTERM");
42
+ }
43
+ });
44
+
45
+ try {
46
+ await waitForReady(`http://127.0.0.1:${port}/agents/v1/agents`);
47
+ if (stopping) process.exitCode ??= 0;
48
+ else {
49
+ studio = spawn(
50
+ bin("nylorun"),
51
+ [
52
+ "studio",
53
+ "--agent-url",
54
+ `http://localhost:${port}/agents`,
55
+ ...(args.includes("--no-open") ? ["--no-open"] : []),
56
+ ],
57
+ spawnOptions
58
+ );
59
+ studio.once("exit", (code, signal) => {
60
+ if (!stopping) {
61
+ process.exitCode = exitCode(code, signal);
62
+ stop("SIGTERM");
63
+ }
64
+ });
65
+ }
66
+ } catch (error) {
67
+ process.exitCode = 1;
68
+ console.error(error instanceof Error ? error.message : String(error));
69
+ stop("SIGTERM");
70
+ }
71
+
72
+ async function waitForReady(url) {
73
+ const deadline = Date.now() + 20_000;
74
+ while (!stopping && Date.now() < deadline) {
75
+ try {
76
+ const response = await fetch(url);
77
+ if (response.ok) return;
78
+ } catch {}
79
+ await new Promise((resolve) => setTimeout(resolve, 50));
80
+ }
81
+ if (!stopping) throw new Error(`Application did not become ready at ${url}.`);
82
+ }
@@ -0,0 +1,32 @@
1
+ import { serve } from "@hono/node-server";
2
+ import { Hono } from "hono";
3
+ import { Runtime, serveAgents } from "@nylorun/runtime";
4
+ import { agents } from "../agents/index.js";
5
+
6
+ const app = new Hono();
7
+
8
+ app.get("/", (c) =>
9
+ c.json({
10
+ agents: agents.map((agent) => ({
11
+ id: agent.id,
12
+ name: agent.name,
13
+ manifest: agent.manifest,
14
+ })),
15
+ }),
16
+ );
17
+
18
+ const runtime = new Runtime();
19
+ app.route(
20
+ "/agents",
21
+ serveAgents({ agents, runtime, basePath: "/agents" })
22
+ );
23
+
24
+ serve(
25
+ {
26
+ fetch: app.fetch,
27
+ port: Number(process.env.PORT ?? "3000"),
28
+ },
29
+ (info) => {
30
+ console.log(`Server is running on http://localhost:${info.port}`);
31
+ },
32
+ );
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": { "noEmit": false, "outDir": "dist", "rootDir": "." },
4
+ "include": ["agents/**/*.ts", "src/**/*.ts"]
5
+ }
@@ -9,5 +9,5 @@
9
9
  "noEmit": true,
10
10
  "types": ["node"]
11
11
  },
12
- "include": ["agent/**/*.ts", "nylorun.config.ts"]
12
+ "include": ["agents/**/*.ts", "src/**/*.ts"]
13
13
  }
package/dist/sync.d.ts CHANGED
@@ -4,7 +4,7 @@ export interface ExamplesRecipe {
4
4
  dependencies: Record<string, string>;
5
5
  devDependencies: Record<string, string>;
6
6
  scripts: Record<string, string>;
7
- configuration: string;
7
+ index: string;
8
8
  }
9
9
  export declare function examplesFiles(compatibility: Compatibility, recipe: ExamplesRecipe): Promise<{
10
10
  [k: string]: string;
package/dist/sync.js CHANGED
@@ -26,14 +26,14 @@ export async function examplesFiles(compatibility, recipe) {
26
26
  };
27
27
  manifest.scripts = Object.fromEntries(Object.entries(manifest.scripts).sort(([left], [right]) => rank(left) - rank(right) || left.localeCompare(right)));
28
28
  files["package.json"] = JSON.stringify(manifest, null, 2) + "\n";
29
- files["nylorun.config.ts"] = recipe.configuration;
29
+ files["src/index.ts"] = recipe.index;
30
30
  const tsconfig = JSON.parse(files["tsconfig.json"]);
31
31
  tsconfig.include.push("test/**/*.ts");
32
32
  files["tsconfig.json"] = JSON.stringify(tsconfig, null, 2) + "\n";
33
33
  return files;
34
34
  }
35
35
  function managed(path) {
36
- return (!path.startsWith("agent/") &&
36
+ return (!path.startsWith("agents/") &&
37
37
  !path.startsWith("config/") &&
38
38
  path !== "README.md");
39
39
  }
@@ -48,7 +48,7 @@ export async function synchronize(root, files, compatibility, options) {
48
48
  path.split("/").some((part) => !part || part === "." || part === "..") ||
49
49
  !managed(path) ||
50
50
  path.startsWith("test/") ||
51
- path.startsWith("scripts/") ||
51
+ (path.startsWith("scripts/") && path !== "scripts/dev.mjs") ||
52
52
  path.startsWith(".data/") ||
53
53
  path.startsWith("node_modules/") ||
54
54
  (path.startsWith(".env/") &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nylorun/create-agent",
3
- "version": "0.2.1-beta",
3
+ "version": "0.3.1-beta",
4
4
  "description": "Create a local Nylorun Harness agent project.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -41,10 +41,10 @@
41
41
  "devDependencies": {
42
42
  "@nylorun/harness": "file:../harness",
43
43
  "@nylorun/runtime": "file:../runtime",
44
- "@types/node": "^22.18.0",
44
+ "@types/node": "^26.5.0",
45
45
  "@typescript/native": "npm:typescript@^7.0.2",
46
46
  "typescript": "npm:@typescript/typescript6@^6.0.2",
47
- "vitest": "^4.1.11",
47
+ "vitest": "^5.0.0",
48
48
  "zod": "^4.1.12"
49
49
  }
50
50
  }
@@ -1,4 +0,0 @@
1
- import { defineRuntime } from "@nylorun/runtime";
2
- import { agents } from "./agent/registry.js";
3
-
4
- export default defineRuntime({ agents });