@jini-ai/platform 0.7.2 → 0.7.3-next.1
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 +2 -8
- package/README.md +16 -4
- package/dist/asset-cache.d.ts +13 -3
- package/dist/asset-cache.js +163 -154
- package/dist/blob-storage.d.ts +3 -32
- package/dist/blob-storage.js +1 -9
- package/dist/child-environment.d.ts +0 -16
- package/dist/child-environment.js +0 -25
- package/dist/command.d.ts +6 -11
- package/dist/command.js +8 -54
- package/dist/download-lock.d.ts +4 -0
- package/dist/download-lock.js +82 -0
- package/dist/download-maintenance.d.ts +5 -0
- package/dist/download-maintenance.js +82 -0
- package/dist/download-state.d.ts +8 -0
- package/dist/download-state.js +126 -0
- package/dist/download-store.d.ts +22 -0
- package/dist/download-store.js +174 -0
- package/dist/download-target.d.ts +10 -0
- package/dist/download-target.js +102 -0
- package/dist/download-transfer.d.ts +12 -0
- package/dist/download-transfer.js +174 -0
- package/dist/download-types.d.ts +162 -0
- package/dist/download-types.js +31 -0
- package/dist/download.d.ts +1 -89
- package/dist/download.js +8 -738
- package/dist/fetch-with-timeout.d.ts +7 -32
- package/dist/fetch-with-timeout.js +1 -77
- package/dist/fs/app-data-root.d.ts +28 -0
- package/dist/fs/app-data-root.js +35 -0
- package/dist/fs/atomic-write.js +1 -1
- package/dist/fs/boot-identity.d.ts +1 -4
- package/dist/fs/directory-delete-guard.d.ts +93 -0
- package/dist/fs/directory-delete-guard.js +148 -0
- package/dist/fs/directory-registry.js +45 -35
- package/dist/fs/directory-relocation.d.ts +82 -0
- package/dist/fs/directory-relocation.js +99 -0
- package/dist/fs/directory-running-lock.d.ts +1 -1
- package/dist/fs/directory-running-lock.js +24 -21
- package/dist/fs/directory-sync.js +1 -1
- package/dist/fs/directory-user-config.js +30 -3
- package/dist/fs/directory-workspace.d.ts +34 -30
- package/dist/fs/directory-workspace.js +70 -29
- package/dist/fs/durable-json.d.ts +6 -15
- package/dist/fs/durable-json.js +38 -35
- package/dist/fs/errno.d.ts +12 -3
- package/dist/fs/errno.js +5 -3
- package/dist/fs/file-lock.d.ts +3 -87
- package/dist/fs/file-lock.js +16 -30
- package/dist/fs/guarded-reader.js +335 -315
- package/dist/fs/index.d.ts +5 -0
- package/dist/fs/index.js +5 -0
- package/dist/fs/recent-directories.d.ts +46 -0
- package/dist/fs/recent-directories.js +68 -0
- package/dist/fs/remove-directory-tree.d.ts +20 -0
- package/dist/fs/remove-directory-tree.js +28 -0
- package/dist/fs/user-data-directories.js +2 -2
- package/dist/fs/workspace-directory.js +2 -1
- package/dist/fs.d.ts +16 -4
- package/dist/fs.js +4 -4
- package/dist/home-expansion.d.ts +7 -2
- package/dist/home-expansion.js +3 -3
- package/dist/http/guarded/client.d.ts +1 -2
- package/dist/http/guarded/client.js +2 -1
- package/dist/http/guarded/index.d.ts +0 -3
- package/dist/http/guarded/node-ports.d.ts +1 -1
- package/dist/http/guarded/transport.fetch.d.ts +2 -3
- package/dist/http/guarded/transport.fetch.js +64 -58
- package/dist/http.d.ts +3 -1
- package/dist/http.js +2 -2
- package/dist/index.d.ts +10 -11
- package/dist/index.js +7 -6
- package/dist/mail/activity/activity.d.ts +136 -0
- package/dist/mail/activity/activity.js +172 -0
- package/dist/mail/activity/ports.d.ts +113 -0
- package/dist/mail/activity/suppressions.d.ts +82 -0
- package/dist/mail/activity/suppressions.js +119 -0
- package/dist/mail/activity/vocabulary.d.ts +10 -0
- package/dist/mail/activity/vocabulary.js +8 -0
- package/dist/mail/builtin-providers.d.ts +12 -6
- package/dist/mail/builtin-providers.js +14 -11
- package/dist/mail/delivery-wrapper.js +2 -1
- package/dist/mail/email-sender-registry.d.ts +1 -1
- package/dist/mail/email-sender-registry.js +1 -1
- package/dist/mail/email-template-operations.d.ts +186 -0
- package/dist/mail/email-template-operations.js +226 -0
- package/dist/mail/email-template.d.ts +120 -0
- package/dist/mail/email-template.js +243 -0
- package/dist/mail/index.d.ts +4 -0
- package/dist/mail/index.js +3 -0
- package/dist/mail/prepare-sender-email.d.ts +1 -10
- package/dist/mail/prepare-sender-email.js +1 -11
- package/dist/mail/resolve-mailer.d.ts +2 -1
- package/dist/mail/resolve-mailer.js +5 -2
- package/dist/mail/senders.d.ts +0 -1
- package/dist/mail/senders.js +0 -1
- package/dist/mail/smtp.d.ts +1 -31
- package/dist/net/address.d.ts +1 -8
- package/dist/net/address.js +1 -18
- package/dist/net/index.d.ts +1 -1
- package/dist/net/index.js +1 -1
- package/dist/net/local-http-probe.js +1 -1
- package/dist/net/local-http-request.js +1 -1
- package/dist/process-probes.d.ts +36 -0
- package/dist/process-probes.js +151 -0
- package/dist/process-top-footprint.d.ts +7 -0
- package/dist/process-top-footprint.js +30 -0
- package/dist/process.d.ts +29 -31
- package/dist/process.js +18 -196
- package/dist/proxy-env.d.ts +12 -3
- package/dist/proxy-env.js +9 -8
- package/dist/resource-paths.d.ts +15 -3
- package/dist/resource-paths.js +7 -5
- package/dist/sandbox-env.d.ts +26 -5
- package/dist/sandbox-env.js +7 -7
- package/dist/secrets/credential-sets/contracts.d.ts +0 -1
- package/dist/secrets/credential-sets/contracts.js +0 -1
- package/dist/secrets/credential-sets/index.d.ts +2 -3
- package/dist/secrets/credential-sets/index.js +1 -1
- package/dist/secrets/credential-sets/provider-matches.d.ts +1 -1
- package/dist/secrets/credential-sets/provider-matches.js +1 -1
- package/dist/secrets/credential-sets/vault-archive.d.ts +1 -1
- package/dist/secrets/credential-sets/vault-archive.js +14 -8
- package/dist/secrets/credential-sets/vault.aad.d.ts +1 -1
- package/dist/secrets/credential-sets/vault.meta.d.ts +1 -1
- package/dist/secrets/credential-sets/vault.meta.js +1 -1
- package/dist/secrets/credential-sets/vault.repo.memory.d.ts +1 -1
- package/dist/secrets/credential-sets/vault.repo.memory.js +1 -1
- package/dist/secrets/credential-sets/vault.reseal-refused.d.ts +23 -0
- package/dist/secrets/credential-sets/vault.reseal-refused.js +36 -0
- package/dist/secrets/credential-sets/vault.service.d.ts +25 -5
- package/dist/secrets/credential-sets/vault.service.js +42 -8
- package/dist/secrets/index.d.ts +0 -3
- package/dist/secrets/index.js +5 -0
- package/dist/secrets/keyring.env.d.ts +1 -1
- package/dist/secrets/legacy-owner.d.ts +61 -0
- package/dist/secrets/legacy-owner.js +196 -0
- package/dist/secrets/root-key/decide.d.ts +89 -0
- package/dist/secrets/root-key/decide.js +60 -0
- package/dist/secrets/sealer-contract.d.ts +19 -0
- package/dist/secrets/sealer-contract.js +37 -0
- package/dist/secrets/secret-sealer.aesgcm.d.ts +1 -1
- package/dist/secrets/testing.d.ts +1 -0
- package/dist/secrets/testing.js +1 -0
- package/dist/shell.d.ts +4 -1
- package/dist/shell.js +1 -1
- package/dist/system.d.ts +6 -0
- package/dist/system.js +9 -0
- package/dist/terminal.d.ts +11 -96
- package/dist/terminal.js +80 -56
- package/dist/web/agent-tools.d.ts +107 -0
- package/dist/web/agent-tools.js +49 -0
- package/dist/web/index.d.ts +1 -0
- package/dist/web/index.js +1 -0
- package/package.json +38 -12
- package/dist/http/guarded/ports.d.ts +0 -56
- package/dist/http/guarded/types.d.ts +0 -8
- package/dist/http/guarded/types.js +0 -2
- package/dist/mail/email-sender.d.ts +0 -109
- package/dist/mail/email-sender.js +0 -10
- package/dist/net/endpoint-policy.d.ts +0 -39
- package/dist/net/endpoint-policy.js +0 -218
- package/dist/secrets/credential-sets/aad.d.ts +0 -7
- package/dist/secrets/credential-sets/aad.js +0 -7
- package/dist/secrets/credential-sets/repo.memory.d.ts +0 -44
- package/dist/secrets/credential-sets/repo.memory.js +0 -80
- package/dist/secrets/credential-sets/vault.types.d.ts +0 -27
- package/dist/secrets/credential-sets/vault.types.js +0 -49
- /package/dist/{http/guarded → mail/activity}/ports.js +0 -0
package/dist/proxy-env.d.ts
CHANGED
|
@@ -13,7 +13,10 @@ export type ResolveSystemProxyEnvOptions = {
|
|
|
13
13
|
* @param sources - Env sources merged left-to-right (later sources win).
|
|
14
14
|
* @returns A new merged environment with normalized proxy variables.
|
|
15
15
|
*/
|
|
16
|
-
export declare function mergeProxyAwareEnv(platform
|
|
16
|
+
export declare function mergeProxyAwareEnv({ platform, sources }: {
|
|
17
|
+
platform: NodeJS.Platform;
|
|
18
|
+
sources: Array<NodeJS.ProcessEnv | Record<string, string | undefined>>;
|
|
19
|
+
}, _optional?: Record<string, never>): NodeJS.ProcessEnv;
|
|
17
20
|
/**
|
|
18
21
|
* Parse macOS `scutil --proxy` output into a normalized proxy environment.
|
|
19
22
|
* Honors the HTTP/HTTPS/SOCKS enable flags, exception list, and the
|
|
@@ -23,7 +26,11 @@ export declare function mergeProxyAwareEnv(platform: NodeJS.Platform, ...sources
|
|
|
23
26
|
* @param platform - Target platform for env normalization (defaults to `"darwin"`).
|
|
24
27
|
* @returns A normalized proxy environment (empty when no proxy is enabled).
|
|
25
28
|
*/
|
|
26
|
-
export declare function parseMacosScutilProxyOutput(stdout
|
|
29
|
+
export declare function parseMacosScutilProxyOutput({ stdout }: {
|
|
30
|
+
stdout: string;
|
|
31
|
+
}, { platform }?: {
|
|
32
|
+
platform?: NodeJS.Platform | undefined;
|
|
33
|
+
}): NodeJS.ProcessEnv;
|
|
27
34
|
/**
|
|
28
35
|
* Parse Windows Internet Settings proxy registry output into a normalized proxy
|
|
29
36
|
* environment. Handles both the per-protocol (`http=…;https=…`) and shared
|
|
@@ -37,7 +44,9 @@ export declare function parseWindowsInternetSettingsProxyOutput(input: {
|
|
|
37
44
|
proxyEnable: string;
|
|
38
45
|
proxyOverride?: string;
|
|
39
46
|
proxyServer?: string;
|
|
40
|
-
}, platform?:
|
|
47
|
+
}, { platform }?: {
|
|
48
|
+
platform?: NodeJS.Platform | undefined;
|
|
49
|
+
}): NodeJS.ProcessEnv;
|
|
41
50
|
/**
|
|
42
51
|
* Resolve the OS-level proxy configuration into a normalized proxy environment.
|
|
43
52
|
* Shells out to `scutil` on macOS and `reg query` on Windows (swallowing per-
|
package/dist/proxy-env.js
CHANGED
|
@@ -58,7 +58,7 @@ function setCanonicalProxyEnvValue(env, canonicalKey, value, platform) {
|
|
|
58
58
|
* @param sources - Env sources merged left-to-right (later sources win).
|
|
59
59
|
* @returns A new merged environment with normalized proxy variables.
|
|
60
60
|
*/
|
|
61
|
-
export function mergeProxyAwareEnv(platform,
|
|
61
|
+
export function mergeProxyAwareEnv({ platform, sources }, _optional = {}) {
|
|
62
62
|
const merged = {};
|
|
63
63
|
for (const source of sources) {
|
|
64
64
|
const proxyEntries = collectSourceProxyEntries({ merged, source });
|
|
@@ -222,7 +222,7 @@ function finalizeSystemProxyEnv(values, platform) {
|
|
|
222
222
|
* @param platform - Target platform for env normalization (defaults to `"darwin"`).
|
|
223
223
|
* @returns A normalized proxy environment (empty when no proxy is enabled).
|
|
224
224
|
*/
|
|
225
|
-
export function parseMacosScutilProxyOutput(stdout, platform = "darwin") {
|
|
225
|
+
export function parseMacosScutilProxyOutput({ stdout }, { platform = "darwin" } = {}) {
|
|
226
226
|
const { exceptions, scalars } = parseScutilLines(stdout);
|
|
227
227
|
return finalizeSystemProxyEnv({
|
|
228
228
|
allProxy: scutilEnabledProxy({ prefix: "SOCKS", scalars, scheme: "socks5" }),
|
|
@@ -305,6 +305,9 @@ function sharedProxyServer(proxyServer) {
|
|
|
305
305
|
const shared = normalizeAuthorityProxyUrl(proxyServer, "http");
|
|
306
306
|
return { httpProxy: shared, httpsProxy: shared };
|
|
307
307
|
}
|
|
308
|
+
function parseProxyServer(proxyServer) {
|
|
309
|
+
return proxyServer.includes("=") ? parsePerProtocolProxyServer(proxyServer) : sharedProxyServer(proxyServer);
|
|
310
|
+
}
|
|
308
311
|
/**
|
|
309
312
|
* Parse Windows Internet Settings proxy registry output into a normalized proxy
|
|
310
313
|
* environment. Handles both the per-protocol (`http=…;https=…`) and shared
|
|
@@ -314,7 +317,7 @@ function sharedProxyServer(proxyServer) {
|
|
|
314
317
|
* @param platform - Target platform for env normalization (defaults to `"win32"`).
|
|
315
318
|
* @returns A normalized proxy environment (empty when proxying is disabled or unset).
|
|
316
319
|
*/
|
|
317
|
-
export function parseWindowsInternetSettingsProxyOutput(input, platform = "win32") {
|
|
320
|
+
export function parseWindowsInternetSettingsProxyOutput(input, { platform = "win32" } = {}) {
|
|
318
321
|
const enabled = parseRegistryValue(input.proxyEnable, "ProxyEnable");
|
|
319
322
|
if (enabled == null || !/^(1|0x1)$/i.test(enabled))
|
|
320
323
|
return {};
|
|
@@ -322,9 +325,7 @@ export function parseWindowsInternetSettingsProxyOutput(input, platform = "win32
|
|
|
322
325
|
const proxyOverride = parseRegistryValue(input.proxyOverride ?? "", "ProxyOverride") ?? "";
|
|
323
326
|
if (!proxyServer.trim())
|
|
324
327
|
return {};
|
|
325
|
-
const proxies = proxyServer
|
|
326
|
-
? parsePerProtocolProxyServer(proxyServer)
|
|
327
|
-
: sharedProxyServer(proxyServer);
|
|
328
|
+
const proxies = parseProxyServer(proxyServer);
|
|
328
329
|
return finalizeSystemProxyEnv({
|
|
329
330
|
...proxies,
|
|
330
331
|
noProxy: buildNoProxyValue(proxyOverride.split(/[;,]/)),
|
|
@@ -363,14 +364,14 @@ export function resolveSystemProxyEnv(options = {}) {
|
|
|
363
364
|
};
|
|
364
365
|
const regQuery = (valueName) => tryRun("reg", ["query", WINDOWS_INTERNET_SETTINGS_KEY, "/v", valueName]);
|
|
365
366
|
if (platform === "darwin") {
|
|
366
|
-
return parseMacosScutilProxyOutput(tryRun("scutil", ["--proxy"]), platform);
|
|
367
|
+
return parseMacosScutilProxyOutput({ stdout: tryRun("scutil", ["--proxy"]) }, { platform });
|
|
367
368
|
}
|
|
368
369
|
if (platform === "win32") {
|
|
369
370
|
return parseWindowsInternetSettingsProxyOutput({
|
|
370
371
|
proxyEnable: regQuery("ProxyEnable"),
|
|
371
372
|
proxyOverride: regQuery("ProxyOverride"),
|
|
372
373
|
proxyServer: regQuery("ProxyServer"),
|
|
373
|
-
}, platform);
|
|
374
|
+
}, { platform });
|
|
374
375
|
}
|
|
375
376
|
return {};
|
|
376
377
|
}
|
package/dist/resource-paths.d.ts
CHANGED
|
@@ -21,7 +21,11 @@ export interface ResourcePathsConfig {
|
|
|
21
21
|
* Resolves the daemon CLI's own entry-point path: an explicit env override
|
|
22
22
|
* first, then the CLI's own package location.
|
|
23
23
|
*/
|
|
24
|
-
export declare function resolveDaemonCliPath(config
|
|
24
|
+
export declare function resolveDaemonCliPath({ config }: {
|
|
25
|
+
config: ResourcePathsConfig;
|
|
26
|
+
}, { env }?: {
|
|
27
|
+
env?: NodeJS.ProcessEnv | undefined;
|
|
28
|
+
}): string;
|
|
25
29
|
/**
|
|
26
30
|
* Resolves a packaged-app "resources" directory: Electron's own
|
|
27
31
|
* `process.resourcesPath` when present, else a macOS `.app/Contents/Resources`
|
|
@@ -43,7 +47,11 @@ export interface ResolveDaemonResourceRootOptions {
|
|
|
43
47
|
*/
|
|
44
48
|
export declare function resolveDaemonResourceRoot(config: ResourcePathsConfig, { configured, safeBases }?: ResolveDaemonResourceRootOptions): string | null;
|
|
45
49
|
/** Joins `segment` under `resourceRoot` when present, else returns `fallback`. */
|
|
46
|
-
export declare function resolveDaemonResourceDir(resourceRoot
|
|
50
|
+
export declare function resolveDaemonResourceDir({ resourceRoot, segment, fallback }: {
|
|
51
|
+
resourceRoot: string | null;
|
|
52
|
+
segment: string;
|
|
53
|
+
fallback: string;
|
|
54
|
+
}, _optional?: Record<string, never>): string;
|
|
47
55
|
export interface ResolveDaemonPluginPreviewsDirOptions {
|
|
48
56
|
env?: NodeJS.ProcessEnv;
|
|
49
57
|
resourceRoot: string | null | undefined;
|
|
@@ -64,5 +72,9 @@ export interface ResolveDataDirOptions {
|
|
|
64
72
|
* the resolved directory and verifies it's writable, throwing a
|
|
65
73
|
* diagnostic-rich error otherwise.
|
|
66
74
|
*/
|
|
67
|
-
export declare function resolveDataDir(config
|
|
75
|
+
export declare function resolveDataDir({ config, raw, projectRoot }: {
|
|
76
|
+
config: ResourcePathsConfig;
|
|
77
|
+
raw: string | undefined;
|
|
78
|
+
projectRoot: string;
|
|
79
|
+
}, options?: ResolveDataDirOptions): string;
|
|
68
80
|
//# sourceMappingURL=resource-paths.d.ts.map
|
package/dist/resource-paths.js
CHANGED
|
@@ -25,7 +25,7 @@ function cleanOptionalPath(value) {
|
|
|
25
25
|
* Resolves the daemon CLI's own entry-point path: an explicit env override
|
|
26
26
|
* first, then the CLI's own package location.
|
|
27
27
|
*/
|
|
28
|
-
export function resolveDaemonCliPath(config, env = process.env) {
|
|
28
|
+
export function resolveDaemonCliPath({ config }, { env = process.env } = {}) {
|
|
29
29
|
const configured = cleanOptionalPath(env[config.cliPathEnvVar]) ?? cleanOptionalPath(env[config.cliPathFallbackEnvVar]);
|
|
30
30
|
if (configured)
|
|
31
31
|
return configured;
|
|
@@ -79,7 +79,7 @@ export function resolveDaemonResourceRoot(config, { configured = process.env[con
|
|
|
79
79
|
return resolved;
|
|
80
80
|
}
|
|
81
81
|
/** Joins `segment` under `resourceRoot` when present, else returns `fallback`. */
|
|
82
|
-
export function resolveDaemonResourceDir(resourceRoot, segment, fallback) {
|
|
82
|
+
export function resolveDaemonResourceDir({ resourceRoot, segment, fallback }, _optional = {}) {
|
|
83
83
|
return resourceRoot ? path.join(resourceRoot, segment) : fallback;
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
@@ -92,7 +92,9 @@ export function resolveDaemonPluginPreviewsDir(config, { env = process.env, reso
|
|
|
92
92
|
if (override) {
|
|
93
93
|
return path.isAbsolute(override) ? override : path.resolve(projectRoot, override);
|
|
94
94
|
}
|
|
95
|
-
return resolveDaemonResourceDir(resourceRoot ?? null,
|
|
95
|
+
return resolveDaemonResourceDir({ resourceRoot: resourceRoot ?? null,
|
|
96
|
+
segment: path.join('data', 'plugin-previews'),
|
|
97
|
+
fallback: path.join(projectRoot, 'data', 'plugin-previews') });
|
|
96
98
|
}
|
|
97
99
|
/**
|
|
98
100
|
* Resolves the daemon's data directory: an explicit env value (expanded and
|
|
@@ -100,7 +102,7 @@ export function resolveDaemonPluginPreviewsDir(config, { env = process.env, reso
|
|
|
100
102
|
* the resolved directory and verifies it's writable, throwing a
|
|
101
103
|
* diagnostic-rich error otherwise.
|
|
102
104
|
*/
|
|
103
|
-
export function resolveDataDir(config, raw, projectRoot, options = {}) {
|
|
105
|
+
export function resolveDataDir({ config, raw, projectRoot }, options = {}) {
|
|
104
106
|
const value = raw?.trim();
|
|
105
107
|
if (!value) {
|
|
106
108
|
if (options.requireExplicit) {
|
|
@@ -108,7 +110,7 @@ export function resolveDataDir(config, raw, projectRoot, options = {}) {
|
|
|
108
110
|
}
|
|
109
111
|
return path.join(projectRoot, config.defaultDataDirName);
|
|
110
112
|
}
|
|
111
|
-
const resolved = resolveProjectRelativePath(value, projectRoot);
|
|
113
|
+
const resolved = resolveProjectRelativePath({ raw: value, projectRoot });
|
|
112
114
|
try {
|
|
113
115
|
fs.mkdirSync(resolved, { recursive: true });
|
|
114
116
|
fs.accessSync(resolved, fs.constants.W_OK);
|
package/dist/sandbox-env.d.ts
CHANGED
|
@@ -50,23 +50,40 @@ export declare function sandboxImportAllowedRoots(config: SandboxEnvConfig, env?
|
|
|
50
50
|
* Whether `projectRoot` may be used as an imported-folder project while
|
|
51
51
|
* sandboxing is enabled. Always `true` when sandboxing is off.
|
|
52
52
|
*/
|
|
53
|
-
export declare function isSandboxImportedProjectRootAllowed(config
|
|
53
|
+
export declare function isSandboxImportedProjectRootAllowed({ config, projectRoot }: {
|
|
54
|
+
config: SandboxEnvConfig;
|
|
55
|
+
projectRoot: string;
|
|
56
|
+
}, { env }?: {
|
|
57
|
+
env?: Record<string, string | undefined> | undefined;
|
|
58
|
+
}): boolean;
|
|
54
59
|
/**
|
|
55
60
|
* A human-readable reason `projectRoot` is unavailable under sandboxing, or
|
|
56
61
|
* `null` when it's allowed (including when sandboxing is off).
|
|
57
62
|
*/
|
|
58
|
-
export declare function sandboxImportedProjectRootUnavailableReason(config
|
|
63
|
+
export declare function sandboxImportedProjectRootUnavailableReason({ config, projectRoot }: {
|
|
64
|
+
config: SandboxEnvConfig;
|
|
65
|
+
projectRoot: string;
|
|
66
|
+
}, { env }?: {
|
|
67
|
+
env?: Record<string, string | undefined> | undefined;
|
|
68
|
+
}): string | null;
|
|
59
69
|
/**
|
|
60
70
|
* Derives the full sandbox directory tree from a data directory. Pure —
|
|
61
71
|
* does not touch the filesystem (see {@link ensureSandboxRuntimeDirs}).
|
|
62
72
|
*/
|
|
63
|
-
export declare function resolveSandboxRuntimeConfig(enabled
|
|
73
|
+
export declare function resolveSandboxRuntimeConfig({ enabled, dataDir }: {
|
|
74
|
+
enabled: boolean;
|
|
75
|
+
dataDir: string;
|
|
76
|
+
}, _optional?: Record<string, never>): SandboxRuntimeConfig;
|
|
64
77
|
/**
|
|
65
78
|
* Resolves the sandbox runtime config from environment variables, or `null`
|
|
66
79
|
* when sandboxing is off. Throws when sandboxing is on but the data-dir env
|
|
67
80
|
* var is unset.
|
|
68
81
|
*/
|
|
69
|
-
export declare function resolveSandboxRuntimeConfigFromEnv(config
|
|
82
|
+
export declare function resolveSandboxRuntimeConfigFromEnv({ config, env, projectRoot }: {
|
|
83
|
+
config: SandboxEnvConfig;
|
|
84
|
+
env: Record<string, string | undefined>;
|
|
85
|
+
projectRoot: string;
|
|
86
|
+
}, _optional?: Record<string, never>): SandboxRuntimeConfig | null;
|
|
70
87
|
/**
|
|
71
88
|
* The path a spawned agent process's local agent-profiles config lives at,
|
|
72
89
|
* under its sandboxed agent-home directory.
|
|
@@ -82,5 +99,9 @@ export declare function ensureSandboxRuntimeDirs(runtime: SandboxRuntimeConfig):
|
|
|
82
99
|
* a spawned agent process. Returns `baseEnv` unchanged when sandboxing is
|
|
83
100
|
* disabled.
|
|
84
101
|
*/
|
|
85
|
-
export declare function applySandboxRuntimeEnv(config
|
|
102
|
+
export declare function applySandboxRuntimeEnv({ config, baseEnv, runtime }: {
|
|
103
|
+
config: SandboxEnvConfig;
|
|
104
|
+
baseEnv: NodeJS.ProcessEnv;
|
|
105
|
+
runtime: SandboxRuntimeConfig;
|
|
106
|
+
}, _optional?: Record<string, never>): NodeJS.ProcessEnv;
|
|
86
107
|
//# sourceMappingURL=sandbox-env.d.ts.map
|
package/dist/sandbox-env.js
CHANGED
|
@@ -104,7 +104,7 @@ export function sandboxImportAllowedRoots(config, env = process.env) {
|
|
|
104
104
|
* Whether `projectRoot` may be used as an imported-folder project while
|
|
105
105
|
* sandboxing is enabled. Always `true` when sandboxing is off.
|
|
106
106
|
*/
|
|
107
|
-
export function isSandboxImportedProjectRootAllowed(config, projectRoot, env = process.env) {
|
|
107
|
+
export function isSandboxImportedProjectRootAllowed({ config, projectRoot }, { env = process.env } = {}) {
|
|
108
108
|
if (!isSandboxModeEnabled(config, env))
|
|
109
109
|
return true;
|
|
110
110
|
const candidate = canonicalizeContainmentCandidate(projectRoot);
|
|
@@ -114,10 +114,10 @@ export function isSandboxImportedProjectRootAllowed(config, projectRoot, env = p
|
|
|
114
114
|
* A human-readable reason `projectRoot` is unavailable under sandboxing, or
|
|
115
115
|
* `null` when it's allowed (including when sandboxing is off).
|
|
116
116
|
*/
|
|
117
|
-
export function sandboxImportedProjectRootUnavailableReason(config, projectRoot, env = process.env) {
|
|
117
|
+
export function sandboxImportedProjectRootUnavailableReason({ config, projectRoot }, { env = process.env } = {}) {
|
|
118
118
|
if (!isSandboxModeEnabled(config, env))
|
|
119
119
|
return null;
|
|
120
|
-
return isSandboxImportedProjectRootAllowed(config, projectRoot, env)
|
|
120
|
+
return isSandboxImportedProjectRootAllowed({ config, projectRoot }, { env })
|
|
121
121
|
? null
|
|
122
122
|
: `Imported-folder projects are not available in ${config.modeEnvVar} unless their root is ` +
|
|
123
123
|
`under ${config.importAllowedRootsEnvVar}.`;
|
|
@@ -126,7 +126,7 @@ export function sandboxImportedProjectRootUnavailableReason(config, projectRoot,
|
|
|
126
126
|
* Derives the full sandbox directory tree from a data directory. Pure —
|
|
127
127
|
* does not touch the filesystem (see {@link ensureSandboxRuntimeDirs}).
|
|
128
128
|
*/
|
|
129
|
-
export function resolveSandboxRuntimeConfig(enabled, dataDir) {
|
|
129
|
+
export function resolveSandboxRuntimeConfig({ enabled, dataDir }, _optional = {}) {
|
|
130
130
|
const sandboxRoot = path.join(dataDir, 'sandbox');
|
|
131
131
|
return {
|
|
132
132
|
enabled,
|
|
@@ -151,14 +151,14 @@ export function resolveSandboxRuntimeConfig(enabled, dataDir) {
|
|
|
151
151
|
* when sandboxing is off. Throws when sandboxing is on but the data-dir env
|
|
152
152
|
* var is unset.
|
|
153
153
|
*/
|
|
154
|
-
export function resolveSandboxRuntimeConfigFromEnv(config, env, projectRoot) {
|
|
154
|
+
export function resolveSandboxRuntimeConfigFromEnv({ config, env, projectRoot }, _optional = {}) {
|
|
155
155
|
if (!isSandboxModeEnabled(config, env))
|
|
156
156
|
return null;
|
|
157
157
|
const rawDataDir = env[config.dataDirEnvVar]?.trim();
|
|
158
158
|
if (!rawDataDir) {
|
|
159
159
|
throw new Error(`${config.dataDirEnvVar} is required when ${config.modeEnvVar} is enabled`);
|
|
160
160
|
}
|
|
161
|
-
return resolveSandboxRuntimeConfig(true, resolveProjectRelativePath(rawDataDir, projectRoot));
|
|
161
|
+
return resolveSandboxRuntimeConfig({ enabled: true, dataDir: resolveProjectRelativePath({ raw: rawDataDir, projectRoot }) });
|
|
162
162
|
}
|
|
163
163
|
/**
|
|
164
164
|
* The path a spawned agent process's local agent-profiles config lives at,
|
|
@@ -183,7 +183,7 @@ export function ensureSandboxRuntimeDirs(runtime) {
|
|
|
183
183
|
* a spawned agent process. Returns `baseEnv` unchanged when sandboxing is
|
|
184
184
|
* disabled.
|
|
185
185
|
*/
|
|
186
|
-
export function applySandboxRuntimeEnv(config, baseEnv, runtime) {
|
|
186
|
+
export function applySandboxRuntimeEnv({ config, baseEnv, runtime }, _optional = {}) {
|
|
187
187
|
if (!runtime.enabled)
|
|
188
188
|
return baseEnv;
|
|
189
189
|
const env = { ...baseEnv };
|
|
@@ -2,6 +2,5 @@
|
|
|
2
2
|
* Re-export the owner so aggregate callers and persistence adapters share VaultError identity.
|
|
3
3
|
* @example import { VaultError, type VaultRepoPort } from "@jini-ai/platform/secrets/credential-sets/contracts";
|
|
4
4
|
*/
|
|
5
|
-
export * from "./vault.types.js";
|
|
6
5
|
export { suggestCredentialWorksFor } from "./provider-matches.js";
|
|
7
6
|
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -2,6 +2,5 @@
|
|
|
2
2
|
* Re-export the owner so aggregate callers and persistence adapters share VaultError identity.
|
|
3
3
|
* @example import { VaultError, type VaultRepoPort } from "@jini-ai/platform/secrets/credential-sets/contracts";
|
|
4
4
|
*/
|
|
5
|
-
export * from "./vault.types.js";
|
|
6
5
|
export { suggestCredentialWorksFor } from "./provider-matches.js";
|
|
7
6
|
//# sourceMappingURL=contracts.js.map
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export type { VendorCredentialSetRecord, VendorCredentialSetSummary, VendorCredentialSetRepoPort } from "./types.js";
|
|
2
|
-
export * from "./vault.types.js";
|
|
3
1
|
export { buildVaultAad } from "./vault.aad.js";
|
|
4
2
|
export { createVaultMetaParsers, isCopyableKind } from "./vault.meta.js";
|
|
5
|
-
export { SecretsVaultService, type VaultServiceDeps, type VaultPutInput, type VaultCopyInput } from "./vault.service.js";
|
|
3
|
+
export { SecretsVaultService, type VaultServiceDeps, type VaultPutInput, type VaultCopyInput, type VaultRotateOptions } from "./vault.service.js";
|
|
4
|
+
export { VaultResealRefusedError, type VaultResealRefusalStep } from "./vault.reseal-refused.js";
|
|
6
5
|
export { InMemoryVaultRepo } from "./vault.repo.memory.js";
|
|
7
6
|
export { captureVaultArchive, prepareVaultArchiveRestore, type VaultArchiveEntry } from "./vault-archive.js";
|
|
8
7
|
export { matchingCredentialProviderIds, selectCredentialForProvider, suggestCredentialWorksFor, normalizeCredentialWorksFor, type CredentialProviderDescriptor, type MatchableCredential } from "./provider-matches.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from "./vault.types.js";
|
|
2
1
|
export { buildVaultAad } from "./vault.aad.js";
|
|
3
2
|
export { createVaultMetaParsers, isCopyableKind } from "./vault.meta.js";
|
|
4
3
|
export { SecretsVaultService } from "./vault.service.js";
|
|
4
|
+
export { VaultResealRefusedError } from "./vault.reseal-refused.js";
|
|
5
5
|
export { InMemoryVaultRepo } from "./vault.repo.memory.js";
|
|
6
6
|
export { captureVaultArchive, prepareVaultArchiveRestore } from "./vault-archive.js";
|
|
7
7
|
export { matchingCredentialProviderIds, selectCredentialForProvider, suggestCredentialWorksFor, normalizeCredentialWorksFor } from "./provider-matches.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type VaultOptions } from "
|
|
1
|
+
import { type VaultOptions } from "@jini-ai/core/contracts/vault";
|
|
2
2
|
/** Host-supplied catalog identity and accepted payload shape; catalogs never live in the vault. */
|
|
3
3
|
export interface CredentialProviderDescriptor {
|
|
4
4
|
id: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { VaultError } from "
|
|
1
|
+
import { VaultError } from "@jini-ai/core/contracts/vault";
|
|
2
2
|
/** Validate and canonicalize explicit compatibility IDs without consulting a catalog.
|
|
3
3
|
* @throws VaultError for non-array, non-string, empty or whitespace-bearing IDs.
|
|
4
4
|
* @complexity O(total ID characters) time and space; does not mutate the supplied array.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SecretsVaultService } from "./vault.service.js";
|
|
2
|
-
import { type VaultKind, type VaultMeta, type VaultOptions, type VaultPutRecord, type VaultQuery, type VaultRepoPort } from "
|
|
2
|
+
import { type VaultKind, type VaultMeta, type VaultOptions, type VaultPutRecord, type VaultQuery, type VaultRepoPort } from "@jini-ai/core/contracts/vault";
|
|
3
3
|
/** Logical transport only: source workspace, root keys, envelopes and revision history never travel. */
|
|
4
4
|
export interface VaultArchiveEntry {
|
|
5
5
|
id: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { VaultError, isInVaultQueryScope } from "
|
|
1
|
+
import { VaultError, isInVaultQueryScope, } from "@jini-ai/core/contracts/vault";
|
|
2
2
|
function assertPortable(kind, principalId) {
|
|
3
3
|
// Personal and MCP credentials require their own identity/configuration transport, outside v1.
|
|
4
4
|
if (principalId !== null || ["personal-execution", "mcp-env", "mcp-auth"].includes(kind))
|
|
@@ -21,14 +21,9 @@ export async function captureVaultArchive({ vault, queries, repo }, _options = {
|
|
|
21
21
|
if (++count > 2000)
|
|
22
22
|
throw new VaultError({ code: "invalid-record" });
|
|
23
23
|
try {
|
|
24
|
-
|
|
25
|
-
throw new VaultError({ code: "context" });
|
|
24
|
+
assertArchiveQueryScope({ record: row, query });
|
|
26
25
|
const found = await vault.get(row);
|
|
27
|
-
|
|
28
|
-
throw new VaultError({ code: "conflict" });
|
|
29
|
-
const s = found.summary;
|
|
30
|
-
entries.push({ id: s.id, kind: s.kind, ownerKey: s.ownerKey, binding: s.binding, provider: s.provider,
|
|
31
|
-
label: s.label, isDefault: s.isDefault, meta: s.meta, payload: found.payload });
|
|
26
|
+
appendVaultArchiveEntry(entries, found);
|
|
32
27
|
}
|
|
33
28
|
catch {
|
|
34
29
|
omitted++;
|
|
@@ -37,6 +32,17 @@ export async function captureVaultArchive({ vault, queries, repo }, _options = {
|
|
|
37
32
|
}
|
|
38
33
|
return { entries, notices: omitted ? [`${omitted} saved credential(s) could not be opened and were left out.`] : [] };
|
|
39
34
|
}
|
|
35
|
+
function assertArchiveQueryScope(scope) {
|
|
36
|
+
if (!isInVaultQueryScope(scope))
|
|
37
|
+
throw new VaultError({ code: "context" });
|
|
38
|
+
}
|
|
39
|
+
function appendVaultArchiveEntry(entries, found) {
|
|
40
|
+
if (!found)
|
|
41
|
+
throw new VaultError({ code: "conflict" });
|
|
42
|
+
const s = found.summary;
|
|
43
|
+
entries.push({ id: s.id, kind: s.kind, ownerKey: s.ownerKey, binding: s.binding, provider: s.provider,
|
|
44
|
+
label: s.label, isDefault: s.isDefault, meta: s.meta, payload: found.payload });
|
|
45
|
+
}
|
|
40
46
|
/** Validate and re-seal every entry before the host atomically commits any of them. Keeping the
|
|
41
47
|
* transaction in the host lets settings and vault rows join the same commit. Never call put in a
|
|
42
48
|
* loop: a bad later entry must leave the recipient completely unchanged.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VaultIdentity, VaultOptions } from "
|
|
1
|
+
import type { VaultIdentity, VaultOptions } from "@jini-ai/core/contracts/vault";
|
|
2
2
|
/** JSON tuple encoding prevents colons or separators in host identifiers aliasing another row. */
|
|
3
3
|
export declare function buildVaultAad(input: VaultIdentity, _options?: VaultOptions): string;
|
|
4
4
|
//# sourceMappingURL=vault.aad.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type VaultKind, type VaultMetaParsers, type VaultOptions } from "
|
|
1
|
+
import { type VaultKind, type VaultMetaParsers, type VaultOptions } from "@jini-ai/core/contracts/vault";
|
|
2
2
|
/** Copy eligibility lives with the kind contracts; MCP rows require their server configuration. */
|
|
3
3
|
export declare const isCopyableKind: Readonly<Record<VaultKind, boolean>>;
|
|
4
4
|
/** Minimal structural parsers. Hosts inject catalog, URL/origin and safe-metadata policy here;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { VAULT_KINDS, VaultError } from "
|
|
1
|
+
import { VAULT_KINDS, VaultError, } from "@jini-ai/core/contracts/vault";
|
|
2
2
|
import { normalizeCredentialWorksFor } from "./provider-matches.js";
|
|
3
3
|
/** Copy eligibility lives with the kind contracts; MCP rows require their server configuration. */
|
|
4
4
|
export const isCopyableKind = Object.freeze({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type VaultBatchOp, type VaultBatchResult, type VaultDefaultQuery, type VaultSingletonQuery, type VaultMeta, type VaultOptions, type VaultQuery, type VaultRecord, type VaultRepoPort } from "
|
|
1
|
+
import { type VaultBatchOp, type VaultBatchResult, type VaultDefaultQuery, type VaultSingletonQuery, type VaultMeta, type VaultOptions, type VaultQuery, type VaultRecord, type VaultRepoPort } from "@jini-ai/core/contracts/vault";
|
|
2
2
|
/** Single-turn mutations are atomic in JS; clones prevent callers bypassing CAS through aliases. */
|
|
3
3
|
export declare class InMemoryVaultRepo implements VaultRepoPort {
|
|
4
4
|
private rows;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { assertVaultReplacement, isInVaultQueryScope, vaultGroupKey, VaultError } from "
|
|
1
|
+
import { assertVaultReplacement, isInVaultQueryScope, vaultGroupKey, VaultError, } from "@jini-ai/core/contracts/vault";
|
|
2
2
|
/** Single-turn mutations are atomic in JS; clones prevent callers bypassing CAS through aliases. */
|
|
3
3
|
export class InMemoryVaultRepo {
|
|
4
4
|
rows = new Map();
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { VaultError } from "@jini-ai/core/contracts/vault";
|
|
2
|
+
/** Which half of the open-back check refused the fresh seal. */
|
|
3
|
+
export type VaultResealRefusalStep = "open-new-envelope" | "plaintext-mismatch";
|
|
4
|
+
/** A freshly sealed secret failed its open-back check, so nothing was written and the stored secret is
|
|
5
|
+
* exactly as it was. Keeps the fixed public `invalid-record` code and the `VaultError` name, and adds
|
|
6
|
+
* only redacted facts: the failing step, the key generation the seal used, and the name and code of the
|
|
7
|
+
* sealer's own error. It never carries an envelope, a binding string, a plaintext or an error message,
|
|
8
|
+
* and the original error is deliberately NOT kept as `cause` (its message is free text).
|
|
9
|
+
* @example catch (error) { if (error instanceof VaultResealRefusedError) log({ step: error.step, keyId: error.keyId }); }
|
|
10
|
+
*/
|
|
11
|
+
export declare class VaultResealRefusedError extends VaultError {
|
|
12
|
+
readonly step: VaultResealRefusalStep;
|
|
13
|
+
readonly keyId: string;
|
|
14
|
+
readonly causeName: string | undefined;
|
|
15
|
+
readonly causeCode: string | undefined;
|
|
16
|
+
constructor({ step, keyId }: {
|
|
17
|
+
step: VaultResealRefusalStep;
|
|
18
|
+
keyId: string;
|
|
19
|
+
}, { cause }?: {
|
|
20
|
+
cause?: unknown;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=vault.reseal-refused.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { VaultError } from "@jini-ai/core/contracts/vault";
|
|
2
|
+
/** Error names and codes are quoted only when they are plain identifiers; anything else could carry data. */
|
|
3
|
+
const PLAIN_IDENTIFIER = /^[A-Za-z][A-Za-z0-9_.:-]{0,63}$/;
|
|
4
|
+
function plainIdentifier({ value }, _options = {}) {
|
|
5
|
+
return typeof value === "string" && PLAIN_IDENTIFIER.test(value) ? value : undefined;
|
|
6
|
+
}
|
|
7
|
+
function property({ source, key }, _options = {}) {
|
|
8
|
+
return source !== null && typeof source === "object" ? source[key] : undefined;
|
|
9
|
+
}
|
|
10
|
+
const STEP_WORDS = {
|
|
11
|
+
"open-new-envelope": "the newly sealed secret could not be opened again",
|
|
12
|
+
"plaintext-mismatch": "the newly sealed secret opened to a different value",
|
|
13
|
+
};
|
|
14
|
+
/** A freshly sealed secret failed its open-back check, so nothing was written and the stored secret is
|
|
15
|
+
* exactly as it was. Keeps the fixed public `invalid-record` code and the `VaultError` name, and adds
|
|
16
|
+
* only redacted facts: the failing step, the key generation the seal used, and the name and code of the
|
|
17
|
+
* sealer's own error. It never carries an envelope, a binding string, a plaintext or an error message,
|
|
18
|
+
* and the original error is deliberately NOT kept as `cause` (its message is free text).
|
|
19
|
+
* @example catch (error) { if (error instanceof VaultResealRefusedError) log({ step: error.step, keyId: error.keyId }); }
|
|
20
|
+
*/
|
|
21
|
+
export class VaultResealRefusedError extends VaultError {
|
|
22
|
+
step;
|
|
23
|
+
keyId;
|
|
24
|
+
causeName;
|
|
25
|
+
causeCode;
|
|
26
|
+
constructor({ step, keyId }, { cause } = {}) {
|
|
27
|
+
super({ code: "invalid-record" });
|
|
28
|
+
this.step = step;
|
|
29
|
+
this.keyId = keyId;
|
|
30
|
+
this.causeName = plainIdentifier({ value: property({ source: cause, key: "name" }) });
|
|
31
|
+
this.causeCode = plainIdentifier({ value: property({ source: cause, key: "code" }) });
|
|
32
|
+
const facts = [`key ${keyId}`, ...[this.causeName, this.causeCode].filter(part => part !== undefined).map(part => `sealer reported ${part}`)];
|
|
33
|
+
this.message = `Secrets vault: invalid-record: ${STEP_WORDS[step]} (${facts.join("; ")}). Nothing was written: the stored secret was not changed.`;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=vault.reseal-refused.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { KeyringPort, SecretSealerPort } from "
|
|
2
|
-
import { type VaultContext, type VaultIdentity, type VaultMeta, type VaultMetaParsers, type VaultCopyResult, type VaultDefaultQuery, type VaultOptions, type VaultQuery, type VaultPutRecord, type VaultRepoPort, type VaultSummary } from "
|
|
1
|
+
import type { KeyringPort, SecretSealerPort } from "@jini-ai/core/contracts/vault";
|
|
2
|
+
import { type VaultContext, type VaultIdentity, type VaultMeta, type VaultMetaParsers, type VaultCopyResult, type VaultDefaultQuery, type VaultOptions, type VaultQuery, type VaultPutRecord, type VaultRepoPort, type VaultSummary } from "@jini-ai/core/contracts/vault";
|
|
3
3
|
export interface VaultServiceDeps {
|
|
4
4
|
repo: VaultRepoPort;
|
|
5
5
|
keyring: KeyringPort;
|
|
@@ -41,6 +41,12 @@ export interface VaultCopyInput {
|
|
|
41
41
|
/** Optional selection-time guard; otherwise the revisions read by this operation are used. */
|
|
42
42
|
sourceRevisions?: Readonly<Record<string, number>>;
|
|
43
43
|
}
|
|
44
|
+
export interface VaultRotateOptions {
|
|
45
|
+
/** Opens the STORED row when it was sealed under a key the service's own `sealer` cannot open any
|
|
46
|
+
* more (a key switch). It is used for that one read only: the service's `sealer` still seals the new
|
|
47
|
+
* envelope and verifies it, so `deps.sealer.open` always means "open with the current keyring". */
|
|
48
|
+
sourceOpener?: Pick<SecretSealerPort, "open">;
|
|
49
|
+
}
|
|
44
50
|
/** Shared vault lifecycle. Policy/catalogs are injected; persistence and encryption are ports.
|
|
45
51
|
* Expected context is checked before opening. Normal reads have no legacy-AAD fallback.
|
|
46
52
|
* Metadata reads never need keys, and every merged patch is parsed before CAS persistence.
|
|
@@ -53,6 +59,11 @@ export declare class SecretsVaultService {
|
|
|
53
59
|
/** Resolve a matching identity; deletion can retain legacy metadata without interpreting it. */
|
|
54
60
|
private find;
|
|
55
61
|
private seal;
|
|
62
|
+
/** Opens a fresh envelope with this service's own sealer, under the stored row's own binding, and
|
|
63
|
+
* requires the exact sealed plaintext back. A seal that cannot be read back would replace the only
|
|
64
|
+
* copy of a secret with something nobody can open.
|
|
65
|
+
* @throws VaultResealRefusedError naming the failing step, the key and the sealer error's name/code only. */
|
|
66
|
+
private assertOpensTo;
|
|
56
67
|
private open;
|
|
57
68
|
/** Create/replace configuration and a sealed JSON payload. Throws on policy, validation or CAS failure. */
|
|
58
69
|
put(input: VaultPutInput, _options?: VaultOptions): Promise<VaultSummary>;
|
|
@@ -109,7 +120,9 @@ export declare class SecretsVaultService {
|
|
|
109
120
|
/** Guarded read of the source row, then a CAS write of the resealed target row. */
|
|
110
121
|
private transferRow;
|
|
111
122
|
/** Overwrite keeps the target's default, revision chain and creation time. A new copy leaves
|
|
112
|
-
* placement unspecified, so the repo's first-row rule applies (never the source's default flag).
|
|
123
|
+
* placement unspecified, so the repo's first-row rule applies (never the source's default flag).
|
|
124
|
+
* An overwrite opens its fresh seal again before writing (see `assertOpensTo`), so a seal that cannot
|
|
125
|
+
* be read back leaves the existing target row as it was; a first copy does not. */
|
|
113
126
|
private writeCopy;
|
|
114
127
|
/** Human-managed scoped inventory. No envelope or plaintext is opened or returned. */
|
|
115
128
|
list(input: VaultQuery, _options?: VaultOptions): Promise<VaultSummary[]>;
|
|
@@ -118,10 +131,17 @@ export declare class SecretsVaultService {
|
|
|
118
131
|
expectedRevision: number;
|
|
119
132
|
patch: VaultMeta;
|
|
120
133
|
}, _options?: VaultOptions): Promise<VaultSummary>;
|
|
121
|
-
/** Re-seal using the active key; concurrent replacement wins through CAS. Metadata-only rows persist.
|
|
134
|
+
/** Re-seal using the active key; concurrent replacement wins through CAS. Metadata-only rows persist.
|
|
135
|
+
* A re-seal that cannot be opened again under the row's own binding is refused before anything is
|
|
136
|
+
* written: rotation replaces the only copy of the secret, so a bad seal would destroy it.
|
|
137
|
+
* After a key switch the stored row no longer opens with this service's sealer: pass the previous
|
|
138
|
+
* key's opener as `sourceOpener` rather than binding `sealer.open` to it.
|
|
139
|
+
* @throws VaultResealRefusedError (`invalid-record`) when the new envelope does not open to the stored payload.
|
|
140
|
+
* @example await vault.rotate({ ...identity, expectedRevision }, { sourceOpener: previousKeySealer });
|
|
141
|
+
*/
|
|
122
142
|
rotate(input: VaultIdentity & {
|
|
123
143
|
expectedRevision: number;
|
|
124
|
-
},
|
|
144
|
+
}, { sourceOpener }?: VaultRotateOptions): Promise<VaultSummary>;
|
|
125
145
|
/** Idempotent for missing rows; existing rows require matching context and revision.
|
|
126
146
|
* Deletion needs no metadata interpretation, so unupgraded legacy rows remain removable.
|
|
127
147
|
*/
|