@nylorun/create-agent 0.3.1-beta → 0.5.0-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,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.0-beta
4
+
5
+ ### Minor Changes
6
+
7
+ - fa1860a: Use standard MODEL_PROVIDER, MODEL, MODEL_PROVIDER_API_KEY, and MODEL_PROVIDER_BASE_URL environment configuration. Export starter Hono apps and provide CLI development and production Node launchers. Existing starters require manual migration. Release preparation must update the creator Runtime compatibility pin with this release.
8
+
9
+ ### Patch Changes
10
+
11
+ - Update the tested Harness, Runtime, and Studio compatibility combination.
12
+
13
+ ## 0.4.0-beta
14
+
15
+ ### Minor Changes
16
+
17
+ - 9c350be: Provide `nylorun dev` with optional Studio and browser opening, automatic development loopback CORS, and inferred Hono mount paths. Move local model selection to `.env/model.json` with legacy fallback and migration. Generate starters without copied launcher scripts, a top-level config directory, or a separate TypeScript build config. Release preparation must update the creator's Runtime compatibility pin together with these changes.
18
+
19
+ ### Patch Changes
20
+
21
+ - Update the tested Harness, Runtime, and Studio compatibility combination.
22
+
3
23
  ## 0.3.1-beta
4
24
 
5
25
  ### Patch Changes
package/README.md CHANGED
@@ -48,8 +48,12 @@ 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`, 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.
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 `src/index.ts`, `package.json`, and TypeScript configuration; 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
 
55
55
  Repository development: [contributing](../CONTRIBUTING.md). Package publication: [releasing](../RELEASING.md).
56
+
57
+ Generated projects use `nylorun dev`, with `--no-studio` and `--no-open` options, rather than a copied supervisor script. They contain one `tsconfig.json`; `npm run check` checks without emitting and `npm run build` emits to `dist/`. Repository examples add their own build configuration to exclude tests. Provider/model selection and API keys use a conventional `.env` file (`MODEL_PROVIDER`, `MODEL`, `MODEL_PROVIDER_API_KEY`, and optional `MODEL_PROVIDER_BASE_URL`). The starter exports its Hono app; `nylorun start` supplies the production Node launcher. OAuth state is optional in `.nylorun/auth.json`. See [Runtime migration instructions](../runtime/README.md#upgrading-an-existing-starter).
58
+
59
+ To verify the packed starter after building all packages, run `node create-agent/scripts/smoke-starter.mjs` from the repository root. It installs candidate tarballs into a disposable project and checks type checking, production output, agent assets, development CORS, streaming, watch reload, and shutdown. Add `--serve` to keep the fixture Studio running for browser verification; stop it with Ctrl-C. It uses a deterministic model adapter and makes no provider calls.
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "harness": "0.12.0-beta",
3
3
  "studio": "0.4.2-beta",
4
- "runtime": "0.2.1-beta"
4
+ "runtime": "0.4.0-beta"
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "harness": "0.12.0-beta",
3
3
  "studio": "0.4.2-beta",
4
- "runtime": "0.2.1-beta"
4
+ "runtime": "0.4.0-beta"
5
5
  }
package/dist/scaffold.js CHANGED
@@ -33,10 +33,8 @@ 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 = manifest.scripts["dev:app"];
37
- delete manifest.scripts["dev:app"];
36
+ manifest.scripts.dev = "nylorun dev --no-studio";
38
37
  delete manifest.scripts.studio;
39
- delete files["scripts/dev.mjs"];
40
38
  files["package.json"] = JSON.stringify(manifest, null, 2) + "\n";
41
39
  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.");
42
40
  }
@@ -0,0 +1,6 @@
1
+ # Copy to .env and fill in a provider and model, or run npm run configure.
2
+ MODEL_PROVIDER=
3
+ MODEL=
4
+ MODEL_PROVIDER_API_KEY=
5
+ # For MODEL_PROVIDER=custom only:
6
+ # MODEL_PROVIDER_BASE_URL=https://your-provider.example/v1
@@ -3,4 +3,8 @@
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
4
  Edit agents under `agents/` and compose your Hono app in `src/index.ts`.
5
5
 
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`.
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 environment variables, then run `npm start`.
7
+
8
+ Development orchestration is provided by the installed `nylorun` CLI. Use `npm run dev -- --no-studio` for the application alone. Copy `.env.example` to `.env` and fill in `MODEL_PROVIDER`, `MODEL`, and `MODEL_PROVIDER_API_KEY`, or run `npm run configure`. Custom OpenAI-compatible providers also use `MODEL_PROVIDER_BASE_URL`. Hosting providers can supply these variables directly; no credential files are required for API keys. The single `tsconfig.json` builds your sources; `npm run check` checks types without emitting files.
9
+
10
+ `src/index.ts` exports the Hono app. `nylorun dev` and `nylorun start` supply the Node server and load `.env` without overriding process variables. OAuth state, when used, lives in ignored `.nylorun/auth.json`. Serverless session behavior and Workers compatibility require separate validation.
@@ -1,7 +1,9 @@
1
1
  node_modules/
2
2
  dist/
3
3
  .data/
4
- .env/*
5
- !.env/.gitignore
6
- !.env/README.md
4
+ .env
5
+ .env.local
6
+ .nylorun/
7
+
8
+ # Legacy local settings remain private until migrated.
7
9
  config/model.json
@@ -8,17 +8,15 @@
8
8
  },
9
9
  "scripts": {
10
10
  "configure": "nylorun configure",
11
- "dev": "node scripts/dev.mjs",
12
- "dev:app": "tsx watch src/index.ts",
11
+ "dev": "nylorun dev",
13
12
  "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",
13
+ "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.json",
14
+ "start": "nylorun start",
16
15
  "check": "tsc --noEmit"
17
16
  },
18
17
  "dependencies": {
19
18
  "@nylorun/harness": "{{HARNESS_VERSION}}",
20
19
  "@nylorun/runtime": "{{RUNTIME_VERSION}}",
21
- "@hono/node-server": "^2.1.1",
22
20
  "hono": "^4.13.7",
23
21
  "zod": "^4.1.12"
24
22
  },
@@ -1,4 +1,3 @@
1
- import { serve } from "@hono/node-server";
2
1
  import { Hono } from "hono";
3
2
  import { Runtime, serveAgents } from "@nylorun/runtime";
4
3
  import { agents } from "../agents/index.js";
@@ -18,15 +17,7 @@ app.get("/", (c) =>
18
17
  const runtime = new Runtime();
19
18
  app.route(
20
19
  "/agents",
21
- serveAgents({ agents, runtime, basePath: "/agents" })
20
+ serveAgents({ agents, runtime })
22
21
  );
23
22
 
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
- );
23
+ export default app;
@@ -6,8 +6,14 @@
6
6
  "strict": true,
7
7
  "verbatimModuleSyntax": true,
8
8
  "skipLibCheck": true,
9
- "noEmit": true,
10
- "types": ["node"]
9
+ "types": [
10
+ "node"
11
+ ],
12
+ "outDir": "dist",
13
+ "rootDir": "."
11
14
  },
12
- "include": ["agents/**/*.ts", "src/**/*.ts"]
15
+ "include": [
16
+ "agents/**/*.ts",
17
+ "src/**/*.ts"
18
+ ]
13
19
  }
package/dist/sync.js CHANGED
@@ -25,9 +25,19 @@ export async function examplesFiles(compatibility, recipe) {
25
25
  return index < 0 ? scriptOrder.length : index;
26
26
  };
27
27
  manifest.scripts = Object.fromEntries(Object.entries(manifest.scripts).sort(([left], [right]) => rank(left) - rank(right) || left.localeCompare(right)));
28
+ manifest.scripts.build = manifest.scripts.build.replace("tsc -p tsconfig.json", "tsc -p tsconfig.build.json");
29
+ files["tsconfig.build.json"] =
30
+ JSON.stringify({
31
+ extends: "./tsconfig.json",
32
+ compilerOptions: { noEmit: false, rootDir: ".", outDir: "dist" },
33
+ include: ["agents/**/*.ts", "src/**/*.ts"],
34
+ }, null, 2) + "\n";
28
35
  files["package.json"] = JSON.stringify(manifest, null, 2) + "\n";
29
36
  files["src/index.ts"] = recipe.index;
30
37
  const tsconfig = JSON.parse(files["tsconfig.json"]);
38
+ tsconfig.compilerOptions.noEmit = true;
39
+ delete tsconfig.compilerOptions.rootDir;
40
+ delete tsconfig.compilerOptions.outDir;
31
41
  tsconfig.include.push("test/**/*.ts");
32
42
  files["tsconfig.json"] = JSON.stringify(tsconfig, null, 2) + "\n";
33
43
  return files;
@@ -49,6 +59,10 @@ export async function synchronize(root, files, compatibility, options) {
49
59
  !managed(path) ||
50
60
  path.startsWith("test/") ||
51
61
  (path.startsWith("scripts/") && path !== "scripts/dev.mjs") ||
62
+ path === ".env" ||
63
+ path === ".env.local" ||
64
+ path === ".nylorun" ||
65
+ path.startsWith(".nylorun/") ||
52
66
  path.startsWith(".data/") ||
53
67
  path.startsWith("node_modules/") ||
54
68
  (path.startsWith(".env/") &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nylorun/create-agent",
3
- "version": "0.3.1-beta",
3
+ "version": "0.5.0-beta",
4
4
  "description": "Create a local Nylorun Harness agent project.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -1,4 +0,0 @@
1
- # Project credentials
2
-
3
- Run `npm run configure`. Provider credentials are stored in `auth.json`.
4
- Do not commit credentials. Optional integration environment variables belong in `integrations.env`.
@@ -1,3 +0,0 @@
1
- *
2
- !.gitignore
3
- !README.md
@@ -1,82 +0,0 @@
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
- }
@@ -1,5 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": { "noEmit": false, "outDir": "dist", "rootDir": "." },
4
- "include": ["agents/**/*.ts", "src/**/*.ts"]
5
- }