@nylorun/runtime 0.6.0-beta → 0.8.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.
Files changed (85) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +9 -5
  3. package/dist/adapters/sandbox/microsandbox.d.ts +2 -0
  4. package/dist/adapters/sandbox/microsandbox.js +238 -0
  5. package/dist/adapters/sandbox/virtual.d.ts +4 -0
  6. package/dist/adapters/sandbox/virtual.js +125 -0
  7. package/dist/configuration.d.ts +1 -1
  8. package/dist/configuration.js +1 -1
  9. package/dist/core/executors.d.ts +32 -0
  10. package/dist/core/executors.js +60 -0
  11. package/dist/core/main.js +7 -12
  12. package/dist/core/runtime.d.ts +41 -1
  13. package/dist/core/runtime.js +594 -53
  14. package/dist/core/store.d.ts +13 -0
  15. package/dist/core/store.js +95 -1
  16. package/dist/index.d.ts +0 -1
  17. package/dist/index.js +0 -1
  18. package/dist/mcp/connect.d.ts +31 -0
  19. package/dist/mcp/connect.js +190 -0
  20. package/dist/mcp/pool.d.ts +45 -0
  21. package/dist/mcp/pool.js +143 -0
  22. package/dist/mcp/snapshot.d.ts +25 -0
  23. package/dist/mcp/snapshot.js +10 -0
  24. package/dist/mcp/stdio.d.ts +15 -0
  25. package/dist/mcp/stdio.js +80 -0
  26. package/dist/model/catalog.d.ts +12 -0
  27. package/dist/model/catalog.js +29 -0
  28. package/dist/model/models.d.ts +3 -1
  29. package/dist/model/models.js +4 -2
  30. package/dist/model/pi-model.d.ts +9 -3
  31. package/dist/model/pi-model.js +47 -11
  32. package/dist/model/settings.d.ts +0 -2
  33. package/dist/model/settings.js +0 -47
  34. package/dist/node/index.d.ts +1 -1
  35. package/dist/node/index.js +1 -1
  36. package/dist/sandbox/manager.d.ts +61 -0
  37. package/dist/sandbox/manager.js +239 -0
  38. package/dist/sandbox/policy.d.ts +13 -0
  39. package/dist/sandbox/policy.js +67 -0
  40. package/dist/sandbox/select.d.ts +35 -0
  41. package/dist/sandbox/select.js +76 -0
  42. package/dist/sandbox/tools.d.ts +25 -0
  43. package/dist/sandbox/tools.js +165 -0
  44. package/dist/sandbox/types.d.ts +66 -0
  45. package/dist/vault/crypto.d.ts +12 -0
  46. package/dist/vault/crypto.js +80 -0
  47. package/dist/vault/error.d.ts +4 -0
  48. package/dist/vault/error.js +7 -0
  49. package/dist/vault/kek.d.ts +6 -0
  50. package/dist/vault/kek.js +26 -0
  51. package/dist/vault/service.d.ts +99 -0
  52. package/dist/vault/service.js +825 -0
  53. package/dist/vault/url.d.ts +3 -0
  54. package/dist/vault/url.js +27 -0
  55. package/dist/version.d.ts +1 -0
  56. package/dist/version.js +3 -0
  57. package/package.json +12 -6
  58. package/dist/config.d.ts +0 -20
  59. package/dist/model/defaults.d.ts +0 -17
  60. package/dist/model/defaults.js +0 -21
  61. package/dist/model/http-model.d.ts +0 -12
  62. package/dist/model/http-model.js +0 -299
  63. package/dist/node/local-sessions.d.ts +0 -5
  64. package/dist/node/local-sessions.js +0 -174
  65. package/dist/server/ag-ui.d.ts +0 -8
  66. package/dist/server/ag-ui.js +0 -76
  67. package/dist/server/delivery.d.ts +0 -24
  68. package/dist/server/delivery.js +0 -107
  69. package/dist/server/digests.d.ts +0 -13
  70. package/dist/server/digests.js +0 -39
  71. package/dist/server/host.d.ts +0 -70
  72. package/dist/server/host.js +0 -647
  73. package/dist/session/api.d.ts +0 -10
  74. package/dist/session/api.js +0 -15
  75. package/dist/session/default.d.ts +0 -5
  76. package/dist/session/default.js +0 -30
  77. package/dist/session/handle.d.ts +0 -27
  78. package/dist/session/handle.js +0 -199
  79. package/dist/session/index.d.ts +0 -2
  80. package/dist/session/index.js +0 -2
  81. package/dist/sessions/host.d.ts +0 -39
  82. package/dist/sessions/host.js +0 -359
  83. package/dist/sessions/store.d.ts +0 -41
  84. package/dist/sessions/store.js +0 -33
  85. /package/dist/{config.js → sandbox/types.js} +0 -0
@@ -0,0 +1,99 @@
1
+ import type { DatabaseSync } from "node:sqlite";
2
+ import type { CreateCredentialRequest, CreateVaultRequest, CredentialInfo, CredentialSelection, HostModelProviderInfo, HostModelView, PutHostModelRequest, RotateCredentialRequest, SelectHostModelRequest, VaultInfo } from "@nylorun/core/contracts";
3
+ export type HostModelSecret = {
4
+ provider: string;
5
+ model: string;
6
+ baseUrl?: string;
7
+ authType: "api_key" | "oauth";
8
+ credential: {
9
+ type: "api_key" | "oauth";
10
+ key?: string;
11
+ env?: Record<string, string>;
12
+ refresh?: string;
13
+ access?: string;
14
+ expires?: number;
15
+ [key: string]: unknown;
16
+ };
17
+ };
18
+ export type AuthorizeResult = {
19
+ status: "unauthenticated";
20
+ url: string;
21
+ headers: Record<string, string>;
22
+ } | {
23
+ status: "authorized";
24
+ url: string;
25
+ headers: {
26
+ authorization: string;
27
+ };
28
+ } | {
29
+ status: "refused";
30
+ url: string;
31
+ credentialIds: string[];
32
+ reason: string;
33
+ };
34
+ export declare class VaultService {
35
+ private readonly db;
36
+ private readonly tx;
37
+ private readonly kek;
38
+ private readonly fetchImpl;
39
+ constructor(db: DatabaseSync, tx: <T>(fn: () => T) => T, kek: () => Buffer, fetchImpl: typeof fetch);
40
+ createVault(body: CreateVaultRequest): VaultInfo;
41
+ listVaults(ownerUserId: string): VaultInfo[];
42
+ getVault(id: string): VaultInfo;
43
+ deleteVault(id: string): {
44
+ id: string;
45
+ };
46
+ createCredential(vaultId: string, body: CreateCredentialRequest): CredentialInfo;
47
+ listCredentials(vaultId: string): CredentialInfo[];
48
+ getCredential(vaultId: string, id: string): CredentialInfo;
49
+ rotateCredential(vaultId: string, id: string, body: RotateCredentialRequest): CredentialInfo;
50
+ deleteCredential(vaultId: string, id: string): {
51
+ id: string;
52
+ };
53
+ assertAttachment(ownerUserId: string, vaultIds: readonly string[], selections: readonly CredentialSelection[]): void;
54
+ recordAttachment(sessionId: string, vaultIds: readonly string[]): void;
55
+ authorize(input: {
56
+ sessionId: string;
57
+ vaultIds: readonly string[];
58
+ credentialSelections: readonly CredentialSelection[];
59
+ url: string;
60
+ serverName?: string;
61
+ }): Promise<AuthorizeResult>;
62
+ getHostModel(): HostModelView;
63
+ listHostProviders(): {
64
+ providers: HostModelProviderInfo[];
65
+ };
66
+ putHostModel(body: PutHostModelRequest): HostModelView;
67
+ selectHostModel(body: SelectHostModelRequest): HostModelView;
68
+ readHostModel(): HostModelSecret | undefined;
69
+ updateHostCredential(credential: {
70
+ type: "api_key" | "oauth";
71
+ key?: string;
72
+ env?: Record<string, string>;
73
+ refresh?: string;
74
+ access?: string;
75
+ expires?: number;
76
+ }): void;
77
+ reject(route: string): void;
78
+ private refresh;
79
+ private replay;
80
+ private insertCredential;
81
+ private writePayload;
82
+ private readPayload;
83
+ private vaultInfo;
84
+ private vaultRow;
85
+ private ensureHostVault;
86
+ private validateHostModel;
87
+ private insertHostCredential;
88
+ private readHostPayload;
89
+ private hostModelRows;
90
+ private hostCredentialRowFor;
91
+ private activeHostCredentialRow;
92
+ private activeProviderId;
93
+ private setActiveProvider;
94
+ private deleteHostProviderRows;
95
+ private credentialInfo;
96
+ private credentialRow;
97
+ private rowsForVault;
98
+ private audit;
99
+ }