@nylorun/create-agent 0.3.1-beta → 0.4.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 +10 -0
- package/README.md +5 -1
- package/compatibility.json +1 -1
- package/dist/compatibility.json +1 -1
- package/dist/scaffold.js +1 -3
- package/dist/starter/.env/README.md +1 -1
- package/dist/starter/README.md +2 -0
- package/dist/starter/_gitignore +2 -0
- package/dist/starter/package.json +2 -3
- package/dist/starter/src/index.ts +1 -1
- package/dist/starter/tsconfig.json +9 -3
- package/dist/sync.js +10 -0
- package/package.json +1 -1
- package/dist/starter/scripts/dev.mjs +0 -82
- package/dist/starter/tsconfig.build.json +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.0-beta
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 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.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Update the tested Harness, Runtime, and Studio compatibility combination.
|
|
12
|
+
|
|
3
13
|
## 0.3.1-beta
|
|
4
14
|
|
|
5
15
|
### 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
|
|
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 lives in `.env/model.json`, so configuration creates no top-level `config/` directory.
|
|
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.
|
package/compatibility.json
CHANGED
package/dist/compatibility.json
CHANGED
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 =
|
|
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
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
# Project credentials
|
|
2
2
|
|
|
3
|
-
Run `npm run configure`. Provider credentials are stored in `auth.json`.
|
|
3
|
+
Run `npm run configure`. Provider credentials are stored in `auth.json`, and provider/model selection in `model.json`.
|
|
4
4
|
Do not commit credentials. Optional integration environment variables belong in `integrations.env`.
|
package/dist/starter/README.md
CHANGED
|
@@ -4,3 +4,5 @@ The creator configures a provider before starting development. For later session
|
|
|
4
4
|
Edit agents under `agents/` and compose your Hono app in `src/index.ts`.
|
|
5
5
|
|
|
6
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`.
|
|
7
|
+
|
|
8
|
+
Development orchestration is provided by the installed `nylorun` CLI. Use `npm run dev -- --no-studio` for the application alone. Local provider/model selection is stored in `.env/model.json`. The single `tsconfig.json` builds your sources; `npm run check` checks types without emitting files.
|
package/dist/starter/_gitignore
CHANGED
|
@@ -8,10 +8,9 @@
|
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"configure": "nylorun configure",
|
|
11
|
-
"dev": "
|
|
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.
|
|
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",
|
|
15
14
|
"start": "node dist/src/index.js",
|
|
16
15
|
"check": "tsc --noEmit"
|
|
17
16
|
},
|
|
@@ -6,8 +6,14 @@
|
|
|
6
6
|
"strict": true,
|
|
7
7
|
"verbatimModuleSyntax": true,
|
|
8
8
|
"skipLibCheck": true,
|
|
9
|
-
"
|
|
10
|
-
|
|
9
|
+
"types": [
|
|
10
|
+
"node"
|
|
11
|
+
],
|
|
12
|
+
"outDir": "dist",
|
|
13
|
+
"rootDir": "."
|
|
11
14
|
},
|
|
12
|
-
"include": [
|
|
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;
|
package/package.json
CHANGED
|
@@ -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
|
-
}
|