@nylorun/runtime 0.11.0-beta → 0.13.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 +71 -0
- package/dist/core/flow-host.js +3 -0
- package/dist/core/sandbox-routes.d.ts +5 -1
- package/dist/core/sandbox-routes.js +4 -2
- package/dist/host/create-host.js +3 -0
- package/dist/store/memory.js +3 -1
- package/dist/store/postgres/migrations/002_session_owner.d.ts +6 -0
- package/dist/store/postgres/migrations/002_session_owner.js +13 -0
- package/dist/store/postgres/migrations/index.js +2 -1
- package/dist/store/postgres/store.js +9 -2
- package/dist/store/postgres/tenants.js +9 -2
- package/dist/store/types.d.ts +2 -0
- package/dist/tenant/auth.d.ts +23 -2
- package/dist/tenant/auth.js +140 -5
- package/dist/tenant/commands.js +30 -23
- package/dist/tenant/context.d.ts +11 -4
- package/dist/tenant/context.js +15 -7
- package/dist/tenant/effects.js +87 -13
- package/dist/tenant/http.d.ts +8 -2
- package/dist/tenant/http.js +5 -3
- package/dist/tenant/module.js +3 -0
- package/dist/tenant/principals.d.ts +4 -1
- package/dist/tenant/principals.js +22 -3
- package/dist/tenant/routes-tenant.js +13 -2
- package/dist/tenant/routes.js +16 -7
- package/dist/tenant/sessions.d.ts +9 -3
- package/dist/tenant/sessions.js +20 -6
- package/dist/tenant/transcript.d.ts +104 -0
- package/dist/tenant/transcript.js +58 -0
- package/dist/tenant/types.d.ts +6 -0
- package/dist/vault/service.d.ts +9 -2
- package/dist/vault/service.js +18 -4
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -4
package/dist/vault/service.d.ts
CHANGED
|
@@ -46,6 +46,8 @@ export declare class VaultService {
|
|
|
46
46
|
createVault(body: CreateVaultRequest): Promise<VaultInfo>;
|
|
47
47
|
listVaults(ownerUserId: string): Promise<VaultInfo[]>;
|
|
48
48
|
getVault(id: string): Promise<VaultInfo>;
|
|
49
|
+
/** Another owner's vault, or the host vault, is the same 404 as a missing one. */
|
|
50
|
+
assertOwner(id: string, ownerUserId: string): Promise<void>;
|
|
49
51
|
deleteVault(id: string): Promise<{
|
|
50
52
|
id: string;
|
|
51
53
|
}>;
|
|
@@ -56,8 +58,13 @@ export declare class VaultService {
|
|
|
56
58
|
deleteCredential(vaultId: string, id: string): Promise<{
|
|
57
59
|
id: string;
|
|
58
60
|
}>;
|
|
59
|
-
/**
|
|
60
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Checks a session's vaults and selections. Run in the session PUT transaction. `opaque`
|
|
63
|
+
* (a request acting for a subject) reports another owner's vault as the 404 of a missing one.
|
|
64
|
+
*/
|
|
65
|
+
assertAttachment(t: Tx, ownerUserId: string, vaultIds: readonly string[], selections: readonly CredentialSelection[], options?: {
|
|
66
|
+
opaque?: boolean;
|
|
67
|
+
}): Promise<void>;
|
|
61
68
|
/** Writes the `attach` audit row. Run in the session PUT transaction. */
|
|
62
69
|
recordAttachment(t: Tx, sessionId: string, vaultIds: readonly string[]): Promise<void>;
|
|
63
70
|
authorize(input: {
|
package/dist/vault/service.js
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* createVault(body: CreateVaultRequest): Promise<VaultInfo>
|
|
15
15
|
* listVaults(ownerUserId: string): Promise<VaultInfo[]>
|
|
16
16
|
* getVault(id: string): Promise<VaultInfo>
|
|
17
|
+
* assertOwner(id: string, ownerUserId: string): Promise<void>
|
|
17
18
|
* deleteVault(id: string): Promise<{ id: string }>
|
|
18
19
|
* createCredential(vaultId: string, body: CreateCredentialRequest): Promise<CredentialInfo>
|
|
19
20
|
* listCredentials(vaultId: string): Promise<CredentialInfo[]>
|
|
@@ -22,7 +23,7 @@
|
|
|
22
23
|
* deleteCredential(vaultId: string, id: string): Promise<{ id: string }>
|
|
23
24
|
*
|
|
24
25
|
* // Attachment: run inside the caller's session PUT transaction.
|
|
25
|
-
* assertAttachment(t: Tx, ownerUserId: string, vaultIds: readonly string[], selections: readonly CredentialSelection[]): Promise<void>
|
|
26
|
+
* assertAttachment(t: Tx, ownerUserId: string, vaultIds: readonly string[], selections: readonly CredentialSelection[], options?: { opaque?: boolean }): Promise<void>
|
|
26
27
|
* recordAttachment(t: Tx, sessionId: string, vaultIds: readonly string[]): Promise<void>
|
|
27
28
|
*
|
|
28
29
|
* // Use: opens its own transactions; never call it inside one.
|
|
@@ -104,6 +105,14 @@ export class VaultService {
|
|
|
104
105
|
async getVault(id) {
|
|
105
106
|
return this.store.tx((t) => this.vaultInfo(t, id));
|
|
106
107
|
}
|
|
108
|
+
/** Another owner's vault, or the host vault, is the same 404 as a missing one. */
|
|
109
|
+
async assertOwner(id, ownerUserId) {
|
|
110
|
+
await this.store.tx(async (t) => {
|
|
111
|
+
const row = await t.getVault(id);
|
|
112
|
+
if (!row || row.scope !== "user" || row.ownerUserId !== ownerUserId)
|
|
113
|
+
throw new VaultError(404, "Vault not found");
|
|
114
|
+
});
|
|
115
|
+
}
|
|
107
116
|
async deleteVault(id) {
|
|
108
117
|
return this.store.tx(async (t) => {
|
|
109
118
|
await this.vaultInfo(t, id);
|
|
@@ -210,8 +219,11 @@ export class VaultService {
|
|
|
210
219
|
});
|
|
211
220
|
}
|
|
212
221
|
// --- attachment (caller's transaction) --------------------------------------
|
|
213
|
-
/**
|
|
214
|
-
|
|
222
|
+
/**
|
|
223
|
+
* Checks a session's vaults and selections. Run in the session PUT transaction. `opaque`
|
|
224
|
+
* (a request acting for a subject) reports another owner's vault as the 404 of a missing one.
|
|
225
|
+
*/
|
|
226
|
+
async assertAttachment(t, ownerUserId, vaultIds, selections, options = {}) {
|
|
215
227
|
if (new Set(vaultIds).size !== vaultIds.length)
|
|
216
228
|
throw new VaultError(400, "Duplicate vault id");
|
|
217
229
|
if (new Set(selections.map((item) => item.serverName)).size !== selections.length)
|
|
@@ -223,7 +235,9 @@ export class VaultService {
|
|
|
223
235
|
if (vault.scope === "host")
|
|
224
236
|
throw new VaultError(400, "Host vault cannot be attached to a session");
|
|
225
237
|
if (vault.ownerUserId !== ownerUserId)
|
|
226
|
-
throw
|
|
238
|
+
throw options.opaque
|
|
239
|
+
? new VaultError(404, "Vault not found")
|
|
240
|
+
: new VaultError(403, "Vault belongs to another user");
|
|
227
241
|
}
|
|
228
242
|
for (const selection of selections) {
|
|
229
243
|
const row = await t.getCredential(selection.credentialId);
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const RUNTIME_VERSION = "0.
|
|
1
|
+
export declare const RUNTIME_VERSION = "0.13.0-beta";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nylorun/runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.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",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/nylorun/
|
|
9
|
+
"url": "git+https://github.com/nylorun/agents.git",
|
|
10
10
|
"directory": "runtime"
|
|
11
11
|
},
|
|
12
12
|
"engines": {
|
|
@@ -58,14 +58,15 @@
|
|
|
58
58
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
59
59
|
"@earendil-works/pi-ai": "0.87.0",
|
|
60
60
|
"@hono/node-server": "^2.1.1",
|
|
61
|
-
"@nylorun/harness": "0.
|
|
62
|
-
"@nylorun/core": "0.
|
|
61
|
+
"@nylorun/harness": "0.20.0-beta",
|
|
62
|
+
"@nylorun/core": "0.8.0-beta",
|
|
63
63
|
"@restatedev/restate-sdk": "1.16.9",
|
|
64
64
|
"@s2-dev/streamstore": "0.27.0",
|
|
65
65
|
"just-bash": "3.4.2",
|
|
66
66
|
"postgres": "^3.4.9"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
+
"@ag-ui/client": "1.0.0",
|
|
69
70
|
"@types/node": "^26.5.0",
|
|
70
71
|
"@typescript/native": "npm:typescript@^7.0.2",
|
|
71
72
|
"hono": "^4.13.8",
|