@nimblebrain/mpak-sdk
Advanced tools
+17
-5
@@ -974,3 +974,3 @@ "use strict"; | ||
| } | ||
| const userConfigValues = this.gatherUserConfig(name, manifest); | ||
| const userConfigValues = this.gatherUserConfig(name, manifest, options?.userConfig); | ||
| const { command, args, env } = this.resolveCommand(manifest, cacheDir, userConfigValues); | ||
@@ -1054,6 +1054,15 @@ env["MPAK_WORKSPACE"] = options?.workspaceDir ?? (0, import_node_path4.join)(process.cwd(), ".mpak"); | ||
| /** | ||
| * Gather stored user config values and validate that all required fields are present. | ||
| * @throws If required config values are missing. | ||
| * Gather user config values and validate that all required fields are present. | ||
| * | ||
| * Resolution per field (first match wins): | ||
| * 1. `overrides[fieldName]` — caller-provided value (host runtime) | ||
| * 2. stored `config.json` value — from `MpakConfigManager` | ||
| * 3. `default` from the manifest | ||
| * 4. missing required → collected and thrown as `MpakConfigError` | ||
| * | ||
| * @param overrides Optional pre-resolved values that take precedence over stored config. | ||
| * An empty object is treated the same as omitting the argument. | ||
| * @throws {MpakConfigError} If required config values are missing from every tier. | ||
| */ | ||
| gatherUserConfig(packageName, manifest) { | ||
| gatherUserConfig(packageName, manifest, overrides) { | ||
| if (!manifest.user_config || Object.keys(manifest.user_config).length === 0) { | ||
@@ -1066,4 +1075,7 @@ return {}; | ||
| for (const [fieldName, fieldData] of Object.entries(manifest.user_config)) { | ||
| const overrideValue = overrides?.[fieldName]; | ||
| const storedValue = storedConfig[fieldName]; | ||
| if (storedValue !== void 0) { | ||
| if (overrideValue !== void 0) { | ||
| result[fieldName] = overrideValue; | ||
| } else if (storedValue !== void 0) { | ||
| result[fieldName] = storedValue; | ||
@@ -1070,0 +1082,0 @@ } else if (fieldData.default !== void 0 && fieldData.default !== null) { |
+28
-2
@@ -400,2 +400,19 @@ import { BundleSearchParamsInput, BundleSearchResponse, BundleDetail, VersionsResponse, VersionDetail, PlatformInfo, DownloadInfo, SkillSearchParamsInput, SkillSearchResponse, SkillDetail, SkillDownloadInfo, CacheMetadata, McpbManifest, CachedBundleInfo } from '@nimblebrain/mpak-schemas'; | ||
| workspaceDir?: string; | ||
| /** | ||
| * Pre-resolved `user_config` values supplied by the host. | ||
| * | ||
| * When provided, these values are layered over the stored `config.json` | ||
| * values (caller wins, per field) before `user_config` validation runs. | ||
| * Use this to satisfy required fields without persisting them to disk — | ||
| * for example, when credentials live in a workspace-scoped secret store | ||
| * managed by the host runtime. | ||
| * | ||
| * Values must be strings. Manifest fields typed as `number` or `boolean` | ||
| * must be stringified by the caller (e.g. `String(port)`) — matching how | ||
| * stored `config.json` values and manifest defaults are handled internally. | ||
| * | ||
| * Backward compatible: omitting this option (or passing an empty object) | ||
| * preserves the existing behavior of reading exclusively from stored config. | ||
| */ | ||
| userConfig?: Record<string, string>; | ||
| } | ||
@@ -481,4 +498,13 @@ /** | ||
| /** | ||
| * Gather stored user config values and validate that all required fields are present. | ||
| * @throws If required config values are missing. | ||
| * Gather user config values and validate that all required fields are present. | ||
| * | ||
| * Resolution per field (first match wins): | ||
| * 1. `overrides[fieldName]` — caller-provided value (host runtime) | ||
| * 2. stored `config.json` value — from `MpakConfigManager` | ||
| * 3. `default` from the manifest | ||
| * 4. missing required → collected and thrown as `MpakConfigError` | ||
| * | ||
| * @param overrides Optional pre-resolved values that take precedence over stored config. | ||
| * An empty object is treated the same as omitting the argument. | ||
| * @throws {MpakConfigError} If required config values are missing from every tier. | ||
| */ | ||
@@ -485,0 +511,0 @@ private gatherUserConfig; |
+28
-2
@@ -400,2 +400,19 @@ import { BundleSearchParamsInput, BundleSearchResponse, BundleDetail, VersionsResponse, VersionDetail, PlatformInfo, DownloadInfo, SkillSearchParamsInput, SkillSearchResponse, SkillDetail, SkillDownloadInfo, CacheMetadata, McpbManifest, CachedBundleInfo } from '@nimblebrain/mpak-schemas'; | ||
| workspaceDir?: string; | ||
| /** | ||
| * Pre-resolved `user_config` values supplied by the host. | ||
| * | ||
| * When provided, these values are layered over the stored `config.json` | ||
| * values (caller wins, per field) before `user_config` validation runs. | ||
| * Use this to satisfy required fields without persisting them to disk — | ||
| * for example, when credentials live in a workspace-scoped secret store | ||
| * managed by the host runtime. | ||
| * | ||
| * Values must be strings. Manifest fields typed as `number` or `boolean` | ||
| * must be stringified by the caller (e.g. `String(port)`) — matching how | ||
| * stored `config.json` values and manifest defaults are handled internally. | ||
| * | ||
| * Backward compatible: omitting this option (or passing an empty object) | ||
| * preserves the existing behavior of reading exclusively from stored config. | ||
| */ | ||
| userConfig?: Record<string, string>; | ||
| } | ||
@@ -481,4 +498,13 @@ /** | ||
| /** | ||
| * Gather stored user config values and validate that all required fields are present. | ||
| * @throws If required config values are missing. | ||
| * Gather user config values and validate that all required fields are present. | ||
| * | ||
| * Resolution per field (first match wins): | ||
| * 1. `overrides[fieldName]` — caller-provided value (host runtime) | ||
| * 2. stored `config.json` value — from `MpakConfigManager` | ||
| * 3. `default` from the manifest | ||
| * 4. missing required → collected and thrown as `MpakConfigError` | ||
| * | ||
| * @param overrides Optional pre-resolved values that take precedence over stored config. | ||
| * An empty object is treated the same as omitting the argument. | ||
| * @throws {MpakConfigError} If required config values are missing from every tier. | ||
| */ | ||
@@ -485,0 +511,0 @@ private gatherUserConfig; |
+17
-5
@@ -936,3 +936,3 @@ // src/mpakSDK.ts | ||
| } | ||
| const userConfigValues = this.gatherUserConfig(name, manifest); | ||
| const userConfigValues = this.gatherUserConfig(name, manifest, options?.userConfig); | ||
| const { command, args, env } = this.resolveCommand(manifest, cacheDir, userConfigValues); | ||
@@ -1016,6 +1016,15 @@ env["MPAK_WORKSPACE"] = options?.workspaceDir ?? join4(process.cwd(), ".mpak"); | ||
| /** | ||
| * Gather stored user config values and validate that all required fields are present. | ||
| * @throws If required config values are missing. | ||
| * Gather user config values and validate that all required fields are present. | ||
| * | ||
| * Resolution per field (first match wins): | ||
| * 1. `overrides[fieldName]` — caller-provided value (host runtime) | ||
| * 2. stored `config.json` value — from `MpakConfigManager` | ||
| * 3. `default` from the manifest | ||
| * 4. missing required → collected and thrown as `MpakConfigError` | ||
| * | ||
| * @param overrides Optional pre-resolved values that take precedence over stored config. | ||
| * An empty object is treated the same as omitting the argument. | ||
| * @throws {MpakConfigError} If required config values are missing from every tier. | ||
| */ | ||
| gatherUserConfig(packageName, manifest) { | ||
| gatherUserConfig(packageName, manifest, overrides) { | ||
| if (!manifest.user_config || Object.keys(manifest.user_config).length === 0) { | ||
@@ -1028,4 +1037,7 @@ return {}; | ||
| for (const [fieldName, fieldData] of Object.entries(manifest.user_config)) { | ||
| const overrideValue = overrides?.[fieldName]; | ||
| const storedValue = storedConfig[fieldName]; | ||
| if (storedValue !== void 0) { | ||
| if (overrideValue !== void 0) { | ||
| result[fieldName] = overrideValue; | ||
| } else if (storedValue !== void 0) { | ||
| result[fieldName] = storedValue; | ||
@@ -1032,0 +1044,0 @@ } else if (fieldData.default !== void 0 && fieldData.default !== null) { |
+1
-1
| { | ||
| "name": "@nimblebrain/mpak-sdk", | ||
| "version": "0.2.1", | ||
| "version": "0.3.0", | ||
| "description": "TypeScript SDK for mpak registry - MCPB bundles and Agent Skills", | ||
@@ -5,0 +5,0 @@ "author": "NimbleBrain Inc <engineering@mpak.dev>", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
314240
2.51%3019
1.68%