@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.
@@ -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
- /** Checks a session's vaults and selections. Run in the session PUT transaction. */
60
- assertAttachment(t: Tx, ownerUserId: string, vaultIds: readonly string[], selections: readonly CredentialSelection[]): Promise<void>;
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: {
@@ -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
- /** Checks a session's vaults and selections. Run in the session PUT transaction. */
214
- async assertAttachment(t, ownerUserId, vaultIds, selections) {
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 new VaultError(403, "Vault belongs to another user");
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.11.0-beta";
1
+ export declare const RUNTIME_VERSION = "0.13.0-beta";
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // Kept in step with package.json by runtime/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.11.0-beta";
3
+ export const RUNTIME_VERSION = "0.13.0-beta";
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@nylorun/runtime",
3
- "version": "0.11.0-beta",
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/harness.git",
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.19.1-beta",
62
- "@nylorun/core": "0.6.0-beta",
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",