@nylorun/runtime 0.28.0-beta → 0.30.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 +47 -1
- package/README.md +1 -1
- package/dist/api/components.d.ts +109 -2
- package/dist/api/http/define.d.ts +4 -0
- package/dist/api/http/define.js +20 -9
- package/dist/api/http/routes/agent-manifests.d.ts +1 -1
- package/dist/api/http/routes/agent-manifests.js +1 -1
- package/dist/api/http/routes/agents.js +6 -6
- package/dist/api/http/routes/reads.js +29 -4
- package/dist/api/http/routes/tenant.js +5 -2
- package/dist/api/http/routes/triggers.js +15 -12
- package/dist/api/openapi.js +3 -3
- package/dist/gates/egress-credentials.js +2 -13
- package/dist/gates/handler.js +2 -1
- package/dist/gates/http-tool.js +1 -1
- package/dist/gates/in-process.d.ts +9 -0
- package/dist/gates/in-process.js +21 -0
- package/dist/gates/meter.js +16 -0
- package/dist/gates/tenant-vaults.d.ts +1 -1
- package/dist/host/config-for.d.ts +2 -0
- package/dist/host/config-for.js +1 -0
- package/dist/host/main.js +3 -0
- package/dist/host/stack-config.d.ts +10 -0
- package/dist/host/stack-config.js +36 -0
- package/dist/management-openapi.json +492 -80
- package/dist/mcp/connect.d.ts +36 -7
- package/dist/mcp/connect.js +76 -15
- package/dist/mcp/gateway-outcomes.d.ts +14 -0
- package/dist/mcp/gateway-outcomes.js +46 -0
- package/dist/mcp/pool.js +5 -0
- package/dist/model/call-headers.d.ts +15 -0
- package/dist/model/call-headers.js +9 -0
- package/dist/model/models.d.ts +7 -0
- package/dist/model/models.js +3 -0
- package/dist/model/pi-model.d.ts +6 -0
- package/dist/model/pi-model.js +36 -3
- package/dist/openapi.json +331 -215
- package/dist/store/postgres/drizzle/0037_model_usage_cost_split.sql +4 -0
- package/dist/store/postgres/drizzle/meta/_journal.json +7 -0
- package/dist/store/postgres/reads.js +31 -1
- package/dist/store/postgres/schema.d.ts +78 -5
- package/dist/store/postgres/schema.js +12 -3
- package/dist/tenant/agents.js +7 -3
- package/dist/tenant/transcript.d.ts +8 -0
- package/dist/tenant/transcript.js +2 -0
- package/dist/tenant/types.d.ts +5 -0
- package/dist/vault/headers.d.ts +8 -0
- package/dist/vault/headers.js +25 -0
- package/dist/vault/host-model.js +8 -5
- package/dist/vault/service.d.ts +12 -5
- package/dist/vault/service.js +43 -6
- package/dist/vault/sources.js +22 -1
- package/dist/vault/workload-token.d.ts +16 -0
- package/dist/vault/workload-token.js +58 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface WorkloadTokenSettings {
|
|
2
|
+
/** The token's file (`NYLORUN_WORKLOAD_TOKEN_FILE`). */
|
|
3
|
+
readonly file?: string;
|
|
4
|
+
/** The origins a `workload` credential's `via` may name (`NYLORUN_WORKLOAD_TOKEN_ORIGINS`). */
|
|
5
|
+
readonly origins?: readonly string[];
|
|
6
|
+
}
|
|
7
|
+
/** Why the workload token could not be used: the message names the setting, never the token. */
|
|
8
|
+
export declare class WorkloadTokenUnavailable extends Error {
|
|
9
|
+
constructor(message: string);
|
|
10
|
+
}
|
|
11
|
+
/** Sets where this process reads the workload token and where it may send it (at startup). */
|
|
12
|
+
export declare function useWorkloadToken(next: WorkloadTokenSettings): void;
|
|
13
|
+
/** The workload token, read from its file now. */
|
|
14
|
+
export declare function workloadToken(): Promise<string>;
|
|
15
|
+
/** Why the workload token may not go to `via`, or undefined when its origin is listed. */
|
|
16
|
+
export declare function workloadOriginRefused(via: string): string | undefined;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Runtime's workload token (#496): a short-lived token a platform gives each installation and
|
|
3
|
+
* rotates through a file, so a gateway trusts the workload instead of a stored key. The file
|
|
4
|
+
* (`NYLORUN_WORKLOAD_TOKEN_FILE`) is read on every use and nothing of it is kept, so a rotation
|
|
5
|
+
* applies to the next request with no restart. A missing, unreadable or empty file fails the
|
|
6
|
+
* request, never sends it unauthenticated.
|
|
7
|
+
*
|
|
8
|
+
* Only the gate side reads it: the model call and the MCP and HTTP tool requests a `workload`
|
|
9
|
+
* credential makes. It never reaches a sandbox (`NYLORUN_*` is not passed to one), the model, an
|
|
10
|
+
* event or a log, and requests scrub it like any credential value. An Agent's writer chooses a
|
|
11
|
+
* credential's `via`, so the token goes only to the origins the operator lists
|
|
12
|
+
* (`NYLORUN_WORKLOAD_TOKEN_ORIGINS`), checked on every use; the model's `baseUrl` is the
|
|
13
|
+
* operator's own.
|
|
14
|
+
*/
|
|
15
|
+
import { readFile } from "node:fs/promises";
|
|
16
|
+
/** Why the workload token could not be used: the message names the setting, never the token. */
|
|
17
|
+
export class WorkloadTokenUnavailable extends Error {
|
|
18
|
+
constructor(message) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.name = "WorkloadTokenUnavailable";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
let settings = {};
|
|
24
|
+
/** Sets where this process reads the workload token and where it may send it (at startup). */
|
|
25
|
+
export function useWorkloadToken(next) {
|
|
26
|
+
settings = { ...next };
|
|
27
|
+
}
|
|
28
|
+
/** The workload token, read from its file now. */
|
|
29
|
+
export async function workloadToken() {
|
|
30
|
+
const file = settings.file;
|
|
31
|
+
if (file === undefined)
|
|
32
|
+
throw new WorkloadTokenUnavailable("The Runtime has no workload token: set NYLORUN_WORKLOAD_TOKEN_FILE");
|
|
33
|
+
let text;
|
|
34
|
+
try {
|
|
35
|
+
text = await readFile(file, "utf8");
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
const code = error.code ?? "unreadable";
|
|
39
|
+
throw new WorkloadTokenUnavailable(`The workload token file ${file} (NYLORUN_WORKLOAD_TOKEN_FILE) cannot be read: ${code}`);
|
|
40
|
+
}
|
|
41
|
+
const token = text.trim();
|
|
42
|
+
if (token.length === 0)
|
|
43
|
+
throw new WorkloadTokenUnavailable(`The workload token file ${file} (NYLORUN_WORKLOAD_TOKEN_FILE) is empty`);
|
|
44
|
+
return token;
|
|
45
|
+
}
|
|
46
|
+
/** Why the workload token may not go to `via`, or undefined when its origin is listed. */
|
|
47
|
+
export function workloadOriginRefused(via) {
|
|
48
|
+
let origin;
|
|
49
|
+
try {
|
|
50
|
+
origin = new URL(via).origin;
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return `${via} is not a URL`;
|
|
54
|
+
}
|
|
55
|
+
return (settings.origins ?? []).includes(origin)
|
|
56
|
+
? undefined
|
|
57
|
+
: `The workload token may not go to ${origin}: list it in NYLORUN_WORKLOAD_TOKEN_ORIGINS`;
|
|
58
|
+
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const RUNTIME_VERSION = "0.
|
|
1
|
+
export declare const RUNTIME_VERSION = "0.30.0-beta";
|
package/dist/version.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// Kept in step with package.json by runtime/server/scripts/check-package.mjs, which runs in npm run check.
|
|
2
2
|
// release:prepare also rewrites this when it bumps @nylorun/runtime.
|
|
3
|
-
export const RUNTIME_VERSION = "0.
|
|
3
|
+
export const RUNTIME_VERSION = "0.30.0-beta";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nylorun/runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0-beta",
|
|
4
4
|
"description": "Nylorun Runtime: the agent execution Host on Postgres, Restate and S2, and model providers.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"@hono/node-server": "^2.1.5",
|
|
66
66
|
"@hono/zod-openapi": "^1.6.3",
|
|
67
67
|
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
68
|
-
"@nylorun/core": "0.
|
|
69
|
-
"@nylorun/harness": "0.29.
|
|
68
|
+
"@nylorun/core": "0.26.0-beta",
|
|
69
|
+
"@nylorun/harness": "0.29.2-beta",
|
|
70
70
|
"@restatedev/restate-sdk": "1.17.3",
|
|
71
71
|
"@restatedev/restate-sdk-clients": "1.17.3",
|
|
72
72
|
"@s2-dev/streamstore": "0.28.0",
|