@nylorun/create-agent 0.10.4-beta → 0.12.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,63 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.12.0-beta
4
+
5
+ ### Minor Changes
6
+
7
+ - 5ca1923: **Clients for one Tenant per installation: a stack per project, nothing selects a Tenant.** Upgrade these with the Runtime; they speak protocol 5. Existing stacks are left as they are: see MIGRATION.md.
8
+
9
+ - **Breaking (`nylorun`): one stack per project.** `nylorun start` in a project creates the project's stack (named after the project directory, or `--name`; Host root `~/.nylorun/stacks/<name>/`, Compose project `nylorun-<name>`, its own free ports and volumes), waits for its Runtime to create the stack's Tenant, writes the Project link (`.nylorun/link.json` format 2: `stack`, `hostUrl`, `hostId`, `tenantId`) and `.nylorun/credentials.json` (the key of the derived principal `project`, derived from the stack's admin key), and seeds the model provider from the project's `.env`. `nylorun ls` lists the machine's stacks and `nylorun delete <name>` removes one with its volumes and Host root. `nylorun status` shows the stack's Tenant; `nylorun studio` opens it. The old single stack under `~/.nylorun` is never touched: `start` notes it, and `nylorun legacy stop|delete` handles it. Every stack command takes `--name <stack>` (or `NYLORUN_STACK`, or the Project link's stack); `start --no-link` starts a stack without linking the directory; `nylorun reset` resets the selected stack only. The runtime container's healthcheck is now `/health`, so a Tenant that cannot open is reported by `start` from the Admin status at once instead of after a 300 s wait. `NYLORUN_HOME` still overrides the Host root. Stacks start and stop only when you say so.
10
+ - **Breaking (`@nylorun/cli`): no Tenant commands.** `nylo tenant create|use|list|current|delete` are removed; `nylo status`, `nylo reset` and `nylo endpoints` replace `nylo tenant status|reset|endpoints` on the linked installation. `nylo env` prints `NYLORUN_RUNTIME_URL` and `NYLORUN_SERVER_KEY` only. `nylo` no longer writes Project links.
11
+ - **Breaking (`@nylorun/agents`): no Tenant to name.** The `tenant` option (`createClient`, `Transport`, `resolveConnection`, `createActionHandler({ runtime })`, `JwksCache`) and `NYLORUN_TENANT` are gone, and no request sends `Nylorun-Tenant`; a connection is a URL and a key. A Project link of format 0 or 1 is refused with `connection_missing`, naming `npx nylorun start`. `verifyDeliveryToken`'s `tenantId` is optional: without it any Tenant issuer is accepted, since the installation's keys bind it. `TENANT_HEADER` is no longer re-exported.
12
+ - **Breaking (`@nylorun/admin`): status only.** `createTenant`, `listTenants`, `getTenant` and `deleteTenant` are removed; `status().tenant` names the Host's Tenant, and `deriveTenantKey` / `deriveStudioToken` derive its keys. Local Host resolution reads the stack's Host root (`stack` option, `NYLORUN_STACK`, or the Project link's `stack`); `NYLORUN_HOME` and `home` still override it. `stackHostRoot(name)` is exported.
13
+ - **Breaking (`@nylorun/studio`): Studio serves its installation's Tenant.** The Tenant picker, list and create are gone, with `/_studio/tenants`; `/` opens `/tenants/<id>`. The `/tenants/:tenant` routes and the login token's `tenant` claim stay for embedders and must name that Tenant. The proxy sends no `Nylorun-Tenant`.
14
+ - **`@nylorun/create-agent`:** the next steps are `npx nylorun start`, then `npm run dev`.
15
+ - `@nylorun/core`: `ProjectLinkFileSchema` accepts format 2 with `stack`, and `tenantId` is optional; `ERROR_CODES` loses `tenant_conflict` and `active_work`.
16
+
17
+ ### Patch Changes
18
+
19
+ - Update the tested Harness, SDK, Runtime, and CLI compatibility combination.
20
+
21
+ ## 0.11.0-beta
22
+
23
+ ### Minor Changes
24
+
25
+ - e28b8a9: **New projects serve their tools as an Action endpoint.** Everything Nylorun ships now uses Action endpoints instead of executors. `connectAgents` still works, but it is deprecated.
26
+
27
+ - **Starter (`create-agent`).** `src/main.ts` serves the agents with `createActionHandler` on `http://localhost:3001/nylorun/actions` (`PORT`, `NYLORUN_ACTIONS_URL`) and registers it. `npm run dev` and `npm start` work as before. The README explains which URL the Runtime must reach.
28
+ - **Local stack (`nylorun`).** The Runtime container sets `NYLORUN_ENDPOINT_LOOPBACK=docker-host` and maps `host.docker.internal` to the Docker host, so a `localhost` endpoint on the developer's machine is reachable, on Linux Docker Engine too.
29
+ - **Examples.** The AG-UI and browser-direct apps serve their Action endpoint at `/nylorun/actions` beside their other routes, and `register(origin)` replaces `connection.ready`.
30
+ - **Docs.** The README, `DEPLOYMENT.md` and the `@nylorun/agents` README describe Action endpoints.
31
+
32
+ ### Patch Changes
33
+
34
+ - 4282d5f: **Breaking: executors are removed; protocol 3.** The Runtime delivers every Action (tool, hook, `fn`, `verify`) to the Action endpoint an agent registers. It no longer offers Actions for executors to claim. See `MIGRATION.md`, "Action endpoints replace executors".
35
+
36
+ - **Core.** `PROTOCOL_VERSION` is 3 and a Host serves only protocol 3. `action-endpoints` is a protocol feature instead of an optional Host feature. Removed:
37
+
38
+ - the executor, claim and Action-list schemas;
39
+ - `action_result` from `SessionCommandSchema`;
40
+ - the `claimed` Action status, `claimId` and `leaseExpiresAt`.
41
+
42
+ New: `ActionResultReceiptSchema`, the receipt of `POST /v1/actions/:id/result`, which is `AcceptedResponse` without `requestId`.
43
+
44
+ - **Runtime.** Removed:
45
+
46
+ - `PUT`/`GET /v1/executors`, `DELETE /v1/executors/:agentId`, `GET /v1/executors/connect`;
47
+ - `GET /v1/actions`, `POST /v1/actions/:id/claim`, and the executor form of `POST /v1/actions/:id/heartbeat`;
48
+ - the `tenant/work` stream;
49
+ - claim expiry;
50
+ - executor credentials.
51
+
52
+ `POST /v1/actions/:id/sandbox/:tool` takes the delivery token only. Tenant summaries report `inFlightDeliveries` instead of `connectedExecutors`. Tenant status lists each agent's endpoint and has an `endpoints` check instead of `executors`.
53
+
54
+ Postgres migration 6 drops the `executors` table. Actions an executor had claimed are handled like lost deliveries: a tool becomes `uncertain`, and a hook, `fn` or `verify` is delivered again.
55
+
56
+ - **Agents.** Removed: `connectAgents`, the `@nylorun/agents/executor` subpath, derived executor keys and `NYLORUN_EXECUTOR_KEY`. Serve agents with `createActionHandler` and call `register({ url })`.
57
+ - **CLI.** Executor keys are gone from Project credentials. `nylo tenant endpoints` shows each endpoint and its health.
58
+
59
+ - Update the tested Harness, SDK, Runtime, and CLI compatibility combination.
60
+
3
61
  ## 0.10.4-beta
4
62
 
5
63
  ### Patch Changes
package/README.md CHANGED
@@ -17,7 +17,8 @@ npm create @nylorun/agent@beta my-agent
17
17
 
18
18
  Creates a Node 24 project whose only Nylorun dependency is `@nylorun/agents`
19
19
  (plus Zod). The registry in `agents/index.ts` exports agent definitions.
20
- `src/main.ts` calls `connectAgents` for both `npm run dev` and `npm start`. The
20
+ `src/main.ts` serves the agents' tools with `createActionHandler` and registers
21
+ its URL, for both `npm run dev` and `npm start`. The
21
22
  starter includes one ordinary `lookup_order` tool; ask “Look up order
22
23
  demo-123”.
23
24
 
@@ -29,20 +30,22 @@ ignored: the creator starts nothing and opens no browser.
29
30
 
30
31
  ```sh
31
32
  cd my-agent
32
- npx nylorun@beta up # the local Runtime and Studio (Docker)
33
- npx @nylorun/cli@beta tenant create # this project's Tenant, linked in .nylorun/
34
- npm run dev # tsx watch src/main.ts
35
- npx nylorun studio # a fresh Studio login on this project's Tenant
33
+ npx nylorun@beta start # this project's stack (Docker), its Tenant, linked in .nylorun/
34
+ npm run dev # tsx watch src/main.ts
35
+ npx nylorun studio # a fresh Studio login on this project's Tenant
36
36
  npm run build
37
37
  npm start
38
38
  ```
39
39
 
40
- `nylorun` sets up and runs the local stack; it never creates Tenants.
41
- `@nylorun/cli` (command `nylo`) is the Runtime client: `tenant create` creates
42
- the project's Tenant, writes the Project link and application credentials to
40
+ `nylorun start` in the project creates and starts the project's own local
41
+ stack (Runtime, Studio and their infrastructure, named after the directory;
42
+ `--name` picks or shares another), whose Runtime creates the stack's one
43
+ Tenant. It writes the Project link and the derived application credentials to
43
44
  gitignored `.nylorun/`, and seeds the model provider from `.env`
44
45
  (`MODEL_PROVIDER`, `MODEL`, `MODEL_PROVIDER_API_KEY`) into the Tenant vault.
45
- Studio or `npx @nylorun/cli configure` sets or replaces the provider.
46
+ `@nylorun/cli` (command `nylo`) is the Runtime client: `nylo status`,
47
+ `nylo reset` and `nylo endpoints` work on the linked Tenant. Studio or
48
+ `npx @nylorun/cli configure` sets or replaces the provider.
46
49
  `npm start` runs `node dist/src/main.js` with the same entry as development.
47
50
  Export the Project environment (`eval "$(npx @nylorun/cli env)"`) before a
48
51
  production start when there is no Project link. Tenant data, including the
@@ -61,10 +64,10 @@ remain outside that registry for later migration.
61
64
 
62
65
  `npm run test:starter` (`create-agent/scripts/smoke-starter.mjs`) packs the
63
66
  workspace, scaffolds the starter from the packed creator, installs `nylorun`
64
- and `@nylorun/cli` beside it (never into it), runs `nylorun up`, then
65
- `nylo tenant create` and `npm run dev` against a temporary local Docker stack,
66
- then runs one turn on a temporary fixture-model Tenant and checks that it is
67
- deleted.
67
+ and `@nylorun/cli` beside it (never into it), runs `nylorun start` in it and
68
+ `npm run dev` against a temporary local Docker stack, then resets the stack's
69
+ Tenant, seeds the fixture model and runs one turn that calls the starter's
70
+ tool.
68
71
 
69
72
  See [RELEASING](../RELEASING.md) for the Changesets beta workflow. Nothing is
70
73
  published by the smoke check.
@@ -1,8 +1,8 @@
1
1
  {
2
- "harness": "0.20.0-beta",
3
- "runtime": "0.13.0-beta",
4
- "agents": "0.9.0-beta",
5
- "admin": "0.5.0-beta",
6
- "core": "0.8.0-beta",
7
- "cli": "0.5.0-beta"
2
+ "harness": "0.21.1-beta",
3
+ "runtime": "0.15.0-beta",
4
+ "agents": "0.11.0-beta",
5
+ "admin": "0.7.0-beta",
6
+ "core": "0.10.0-beta",
7
+ "cli": "0.7.0-beta"
8
8
  }
@@ -1,8 +1,8 @@
1
1
  {
2
- "harness": "0.20.0-beta",
3
- "runtime": "0.13.0-beta",
4
- "agents": "0.9.0-beta",
5
- "admin": "0.5.0-beta",
6
- "core": "0.8.0-beta",
7
- "cli": "0.5.0-beta"
2
+ "harness": "0.21.1-beta",
3
+ "runtime": "0.15.0-beta",
4
+ "agents": "0.11.0-beta",
5
+ "admin": "0.7.0-beta",
6
+ "core": "0.10.0-beta",
7
+ "cli": "0.7.0-beta"
8
8
  }
package/dist/project.js CHANGED
@@ -74,14 +74,13 @@ export async function createProject(options, compatibility, dependencies) {
74
74
  }
75
75
  }
76
76
  /**
77
- * After creation: start the local stack (nylorun), create and link the
78
- * Project's Tenant (the Runtime client, @nylorun/cli), then develop. The
79
- * creator runs none of them; the project itself depends only on
80
- * @nylorun/agents.
77
+ * After creation: `nylorun start` in the project creates and starts its
78
+ * local stack, whose Runtime creates the stack's one Tenant, and links the
79
+ * project to it; then develop. The creator runs neither; the project itself
80
+ * depends only on @nylorun/agents.
81
81
  */
82
82
  const NEXT = [
83
- "npx nylorun@beta up # the local Runtime and Studio (Docker)",
84
- "npx @nylorun/cli@beta tenant create # this project's Tenant, linked in .nylorun/",
83
+ "npx nylorun@beta start # this project's stack, its Tenant and the link in .nylorun/ (Docker)",
85
84
  "npm run dev",
86
85
  ];
87
86
  function nextSteps(destination) {
@@ -1,6 +1,6 @@
1
1
  # Read by `npm run dev` (tsx --env-file-if-exists=.env) and, once, by
2
- # `npx @nylorun/cli tenant create`, which seeds the Tenant's model provider
3
- # from these into the Runtime vault (never back into this file):
2
+ # `npx nylorun start` when it links the project, which seeds the Tenant's model
3
+ # provider from these into the Runtime vault (never back into this file):
4
4
  # MODEL_PROVIDER=...
5
5
  # MODEL=...
6
6
  # MODEL_PROVIDER_API_KEY=...
@@ -15,29 +15,32 @@ keep the project in the Linux filesystem (`~/…`, not `/mnt/c/…`), where file
15
15
  watching works.
16
16
 
17
17
  Agent and tool definitions live in `agents/`. The **Runtime** holds your
18
- sessions in isolated **Tenants**; this project attaches through a **Project
19
- link** and connects your tools through the SDK's authenticated SSE executor.
20
- Production entry is `src/main.ts`, which calls `connectAgents`. The project
21
- depends only on `@nylorun/agents`; the two Nylorun tools run with `npx`:
18
+ sessions in its **Tenant**, one per installation; this project attaches to
19
+ its own local stack through a **Project link**. Your tools run in this app: `src/main.ts` serves them as an **Action
20
+ endpoint** (`createActionHandler`) on `http://localhost:3001/nylorun/actions`
21
+ and registers that URL, and the Runtime delivers each tool call there, signed.
22
+ The project depends only on `@nylorun/agents`; the two Nylorun tools run with
23
+ `npx`:
22
24
 
23
- - `nylorun` sets up and runs the local stack (Runtime and Studio).
24
- - `@nylorun/cli` (command `nylo`) talks to a Runtime: Tenants, the Project
25
- link and the model provider.
25
+ - `nylorun` sets up and runs this project's local stack (Runtime and Studio)
26
+ and links the project to it.
27
+ - `@nylorun/cli` (command `nylo`) talks to a Runtime: its Tenant's status,
28
+ reset, Action endpoints and model provider.
26
29
 
27
30
  ```sh
28
- npx nylorun@beta up # the local stack; the first run pulls the images
29
- npx @nylorun/cli@beta tenant create # this project's Tenant, linked in .nylorun/
31
+ npx nylorun@beta start # this project's stack, its Tenant and the link; the first run pulls the images
30
32
  npm run dev
31
33
  ```
32
34
 
33
- `nylorun up` sets up the stack under `~/.nylorun` on the first run and just
34
- starts it after that. It prints the Runtime and Studio URLs and opens Studio,
35
- signed in, in your browser. The
35
+ `nylorun start` in this directory sets up the project's stack on the first
36
+ run (named after the directory, under `~/.nylorun/stacks/<name>/`) and just
37
+ starts it after that; its Runtime creates the stack's one Tenant. It prints
38
+ the Runtime and Studio URLs and opens Studio, signed in, in your browser. The
36
39
  stack keeps running after you stop `npm run dev`, so sessions survive a source
37
- change; `npx nylorun down` stops it (volumes are kept), `npx nylorun status`
40
+ change; `npx nylorun stop` stops it (volumes are kept), `npx nylorun status`
38
41
  shows its health, and `npx nylorun logs runtime -f` its logs.
39
42
 
40
- `tenant create` creates this project's Tenant, writes `.nylorun/link.json` and
43
+ The first `nylorun start` writes `.nylorun/link.json` and
41
44
  `.nylorun/credentials.json`, and seeds the Tenant's model provider from
42
45
  `MODEL_PROVIDER`, `MODEL` and `MODEL_PROVIDER_API_KEY` in `.env` (see
43
46
  `.env.example`). The key is stored in the Tenant vault, never back in `.env`.
@@ -45,8 +48,11 @@ Without them, set the provider in Studio's Model provider screen, or with
45
48
  `npx @nylorun/cli configure`. Model calls use the Tenant's provider and may
46
49
  incur its usual charges.
47
50
 
48
- `npm run dev` runs `src/main.ts` with `tsx watch`; `connectAgents` finds the
49
- Runtime through the Project link. `npx nylorun studio` opens Studio on this
51
+ `npm run dev` runs `src/main.ts` with `tsx watch`: it serves the Action
52
+ endpoint on port 3001 (`PORT` changes it) and registers it with the Runtime,
53
+ which it finds through the Project link. The local stack's Runtime runs in
54
+ Docker and reaches `localhost` on this machine. `npx @nylorun/cli endpoints`
55
+ shows the endpoint and how its deliveries are doing. `npx nylorun studio` opens Studio on this
50
56
  project's Tenant, and signs in a browser that is not signed in yet. In
51
57
  Studio, ask **Look up order demo-123**. The local tool returns `shipped`;
52
58
  Studio shows the tool call and assistant response. The Runtime listens on
@@ -58,11 +64,13 @@ npm run build
58
64
  npm start
59
65
  ```
60
66
 
61
- `npm start` runs `node dist/src/main.js`, the same `connectAgents` entry as
62
- development. Set `NYLORUN_RUNTIME_URL`, `NYLORUN_TENANT`, and
63
- `NYLORUN_SERVER_KEY` before starting, or keep the Project link beside this
64
- directory. `agents/index.ts` exports the registry. A source edit re-registers
65
- agents and reconnects executors; the Runtime is untouched. Start a new session
67
+ `npm start` runs `node dist/src/main.js`, the same entry as development. Set
68
+ `NYLORUN_RUNTIME_URL` and `NYLORUN_SERVER_KEY` before
69
+ starting, or keep the Project link beside this directory, and set
70
+ `NYLORUN_ACTIONS_URL` to the URL the Runtime reaches this app at (a public URL,
71
+ or a tunnel such as ngrok for a remote Runtime). `agents/index.ts` exports the
72
+ registry. A source edit restarts the app, which re-registers the agents and
73
+ the endpoint; the Runtime is untouched. Start a new session
66
74
  after changing definitions or implementations; active-session upgrades are not
67
75
  supported.
68
76
 
@@ -70,18 +78,20 @@ Export the linked Project environment:
70
78
 
71
79
  ```sh
72
80
  eval "$(npx @nylorun/cli@beta env)"
73
- # → NYLORUN_RUNTIME_URL, NYLORUN_SERVER_KEY, NYLORUN_TENANT
81
+ # → NYLORUN_RUNTIME_URL, NYLORUN_SERVER_KEY
74
82
  ```
75
83
 
76
84
  Project link and credentials live in gitignored `.nylorun/` beside this project.
77
- The Host root (`NYLORUN_HOME` or `~/.nylorun`) holds the stack's files and the
78
- admin key; Tenant data lives in the stack's Docker volumes. A fresh clone or
79
- second worktree does not reuse this link: run `tenant create` there, or
80
- `npx @nylorun/cli tenant use <name>` with that Tenant's credentials.
81
- Keep `.nylorun/` private. Application credentials are generated when the
82
- Tenant is created; executor tokens are derived at start. Ordinary
83
- shutdown/restart preserves completed session history; `npx nylorun reset`
84
- deletes every Tenant.
85
+ The stack's Host root (`~/.nylorun/stacks/<name>/`, or `NYLORUN_HOME`) holds
86
+ its files and the admin key; Tenant data lives in the stack's Docker volumes.
87
+ A fresh clone or second worktree does not reuse this link: `npx nylorun start`
88
+ there gives it a stack of its own, and `npx nylorun start --name <stack>`
89
+ links it to this project's stack instead.
90
+ Keep `.nylorun/` private. The application key is derived from the stack's
91
+ admin key when the project is linked. Each delivery carries a short-lived
92
+ token the endpoint verifies with the Tenant's public keys. Ordinary
93
+ shutdown/restart preserves completed session history; `npx @nylorun/cli reset
94
+ --all` empties the Tenant, and `npx nylorun reset` deletes the stack's data.
85
95
  `NYLORUN_IMPLEMENTATION_VERSION` defaults to `dev`; assign an explicit version
86
96
  when changing a versioned implementation.
87
97
 
@@ -1,4 +1,24 @@
1
- import { connectAgents } from "@nylorun/agents";
1
+ import { createServer } from "node:http";
2
+ import { createActionHandler } from "@nylorun/agents";
2
3
  import { agents } from "../agents/index.js";
3
4
 
4
- await connectAgents({ agents }).ready;
5
+ // The Runtime delivers each tool call to this URL. On the local stack `localhost` means this
6
+ // machine; in production set NYLORUN_ACTIONS_URL to the URL the Runtime reaches this app at.
7
+ const port = Number(process.env.PORT ?? 3001);
8
+ const url = process.env.NYLORUN_ACTIONS_URL ?? `http://localhost:${port}/nylorun/actions`;
9
+
10
+ const actions = createActionHandler({ agents, url });
11
+ const server = createServer(actions.node);
12
+ await new Promise<void>((resolve) => server.listen(port, resolve));
13
+ // `tsx watch` often emits a delayed change after the first listen; keep the
14
+ // server up and retry so a raced ping does not exit the process.
15
+ for (let attempt = 0; ; attempt++) {
16
+ try {
17
+ await actions.register({ url });
18
+ break;
19
+ } catch (error) {
20
+ if (attempt >= 8) throw error;
21
+ await new Promise((resolve) => setTimeout(resolve, 250 * 2 ** Math.min(attempt, 3)));
22
+ }
23
+ }
24
+ console.log(`Serving Actions at ${url}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nylorun/create-agent",
3
- "version": "0.10.4-beta",
3
+ "version": "0.12.0-beta",
4
4
  "description": "Create a local Nylorun Harness agent project.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",