@nylorun/runtime 0.2.0-beta → 0.2.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 +6 -0
- package/README.md +5 -2
- package/dist/server/host.js +11 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.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
|
+
|
|
3
9
|
## 0.2.0-beta
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -6,14 +6,17 @@ Portable agent lifecycle, a mountable Hono protocol router, pi-ai model provider
|
|
|
6
6
|
import { Runtime, serveAgents } from "@nylorun/runtime";
|
|
7
7
|
|
|
8
8
|
const runtime = new Runtime();
|
|
9
|
-
app.route(
|
|
9
|
+
app.route(
|
|
10
|
+
"/agents",
|
|
11
|
+
serveAgents({ agents, runtime, basePath: "/agents" })
|
|
12
|
+
);
|
|
10
13
|
```
|
|
11
14
|
|
|
12
15
|
`Runtime` is the primitive stack: model adapter (`piModel` by default), observer (`jsonlObserver` per session by default), and durability (`localJsonl` by default). Session files live together under `.data/sessions/<agent>/<session>/` as `events.jsonl` and `observe.jsonl`. Agents bind only when served.
|
|
13
16
|
|
|
14
17
|
The application owns Hono composition, authentication, CORS, logging, process lifecycle, and deployment. Runtime owns agent sessions, durability, media, and AG-UI/session protocol routes. Graceful shutdown is optional: if the application installs signal handlers and wants to drain live sessions, flush pending journal writes, and run optional agent cleanup, it should await `runtime.close()`. An application that does not install handlers exits normally on its host's shutdown policy; `runtime.close()` does not run on crash, OOM, or SIGKILL.
|
|
15
18
|
|
|
16
|
-
Runtime publishes root-relative discovery and endpoint URLs.
|
|
19
|
+
Runtime publishes root-relative discovery and endpoint URLs. `basePath` must match the Hono mount path so advertised manifests and AG-UI endpoints resolve. Agent-scoped routes are `/:id/...` inside the router, so mounting at `/agents` with `basePath: "/agents"` yields `/agents/:id/...`. Pass the same prefix for other mounts:
|
|
17
20
|
|
|
18
21
|
```ts
|
|
19
22
|
app.route(
|
package/dist/server/host.js
CHANGED
|
@@ -57,16 +57,16 @@ export class Runtime {
|
|
|
57
57
|
protocolVersion: 2,
|
|
58
58
|
agents: agents.map((agent) => ({
|
|
59
59
|
id: agent.id,
|
|
60
|
-
manifestUrl: publicPath(
|
|
60
|
+
manifestUrl: publicPath(`/${agent.id}/manifest.json`),
|
|
61
61
|
})),
|
|
62
62
|
}));
|
|
63
|
-
app.get("
|
|
63
|
+
app.get("/:agentId/manifest.json", (context) => {
|
|
64
64
|
const agent = byId.get(context.req.param("agentId"));
|
|
65
65
|
return agent === undefined
|
|
66
66
|
? context.json({ error: "unknown agent" }, 404)
|
|
67
67
|
: context.json(manifest(agent, media !== undefined, publicPath));
|
|
68
68
|
});
|
|
69
|
-
app.get("
|
|
69
|
+
app.get("/:agentId/v1/media/:session/:assetId", async (context) => {
|
|
70
70
|
const agent = requireAgent(context.req.param("agentId"));
|
|
71
71
|
if (!agent)
|
|
72
72
|
return context.json({ error: "unknown agent" }, 404);
|
|
@@ -78,7 +78,7 @@ export class Runtime {
|
|
|
78
78
|
"content-type": asset.asset.mediaType,
|
|
79
79
|
});
|
|
80
80
|
});
|
|
81
|
-
app.get("
|
|
81
|
+
app.get("/:agentId/v1/sessions", async (context) => {
|
|
82
82
|
const agent = requireAgent(context.req.param("agentId"));
|
|
83
83
|
if (agent === undefined)
|
|
84
84
|
return context.json({ error: "unknown agent" }, 404);
|
|
@@ -94,7 +94,7 @@ export class Runtime {
|
|
|
94
94
|
}),
|
|
95
95
|
});
|
|
96
96
|
});
|
|
97
|
-
app.get("
|
|
97
|
+
app.get("/:agentId/v1/sessions/:session", async (context) => {
|
|
98
98
|
const agent = requireAgent(context.req.param("agentId"));
|
|
99
99
|
if (!agent)
|
|
100
100
|
return context.json({ error: "unknown agent" }, 404);
|
|
@@ -110,7 +110,7 @@ export class Runtime {
|
|
|
110
110
|
pending_interaction: pending(events),
|
|
111
111
|
});
|
|
112
112
|
});
|
|
113
|
-
app.post("
|
|
113
|
+
app.post("/:agentId/v1/sessions/:session", async (context) => {
|
|
114
114
|
const agent = requireAgent(context.req.param("agentId"));
|
|
115
115
|
if (!agent)
|
|
116
116
|
return context.json({ error: "unknown agent" }, 404);
|
|
@@ -152,7 +152,7 @@ export class Runtime {
|
|
|
152
152
|
}
|
|
153
153
|
return context.json({ error: "expected approval or respond interaction" }, 400);
|
|
154
154
|
});
|
|
155
|
-
app.get("
|
|
155
|
+
app.get("/:agentId/v1/sessions/:session/events", async (context) => {
|
|
156
156
|
const agent = requireAgent(context.req.param("agentId"));
|
|
157
157
|
if (!agent)
|
|
158
158
|
return context.json({ error: "unknown agent" }, 404);
|
|
@@ -165,7 +165,7 @@ export class Runtime {
|
|
|
165
165
|
next_cursor: events.at(-1)?.seq ?? after,
|
|
166
166
|
});
|
|
167
167
|
});
|
|
168
|
-
app.get("
|
|
168
|
+
app.get("/:agentId/v1/ag-ui/sessions/:session", async (context) => {
|
|
169
169
|
const agent = requireAgent(context.req.param("agentId"));
|
|
170
170
|
if (!agent)
|
|
171
171
|
return context.json({ error: "unknown agent" }, 404);
|
|
@@ -175,7 +175,7 @@ export class Runtime {
|
|
|
175
175
|
messages(agent.id, await journal.events(agent.id, context.req.param("session"))),
|
|
176
176
|
});
|
|
177
177
|
});
|
|
178
|
-
app.post("
|
|
178
|
+
app.post("/:agentId/v1/ag-ui", async (context) => {
|
|
179
179
|
const agent = requireAgent(context.req.param("agentId"));
|
|
180
180
|
if (!agent)
|
|
181
181
|
return context.json({ error: "unknown agent" }, 404);
|
|
@@ -368,8 +368,8 @@ function manifest(agent, media, publicPath) {
|
|
|
368
368
|
name: agent.manifest.name,
|
|
369
369
|
manifest: agent.manifest,
|
|
370
370
|
endpoints: {
|
|
371
|
-
agUi: publicPath(
|
|
372
|
-
sessions: publicPath(
|
|
371
|
+
agUi: publicPath(`/${agent.id}/v1/ag-ui`),
|
|
372
|
+
sessions: publicPath(`/${agent.id}/v1/sessions`),
|
|
373
373
|
},
|
|
374
374
|
...(media
|
|
375
375
|
? {
|