@nimblebrain/mpak-sdk 0.1.1 → 0.1.2
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/README.md +93 -45
- package/dist/index.cjs +35 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +54 -1007
- package/dist/index.d.ts +54 -1007
- package/dist/index.js +35 -12
- package/dist/index.js.map +1 -1
- package/package.json +45 -42
- package/LICENSE +0 -190
package/dist/index.js
CHANGED
|
@@ -22,10 +22,7 @@ var MpakIntegrityError = class extends MpakError {
|
|
|
22
22
|
expected;
|
|
23
23
|
actual;
|
|
24
24
|
constructor(expected, actual) {
|
|
25
|
-
super(
|
|
26
|
-
`Integrity mismatch: expected ${expected}, got ${actual}`,
|
|
27
|
-
"INTEGRITY_MISMATCH"
|
|
28
|
-
);
|
|
25
|
+
super(`Integrity mismatch: expected ${expected}, got ${actual}`, "INTEGRITY_MISMATCH");
|
|
29
26
|
this.name = "MpakIntegrityError";
|
|
30
27
|
this.expected = expected;
|
|
31
28
|
this.actual = actual;
|
|
@@ -39,14 +36,16 @@ var MpakNetworkError = class extends MpakError {
|
|
|
39
36
|
};
|
|
40
37
|
|
|
41
38
|
// src/client.ts
|
|
42
|
-
var DEFAULT_REGISTRY_URL = "https://
|
|
39
|
+
var DEFAULT_REGISTRY_URL = "https://registry.mpak.dev";
|
|
43
40
|
var DEFAULT_TIMEOUT = 3e4;
|
|
44
41
|
var MpakClient = class {
|
|
45
42
|
registryUrl;
|
|
46
43
|
timeout;
|
|
44
|
+
userAgent;
|
|
47
45
|
constructor(config = {}) {
|
|
48
46
|
this.registryUrl = config.registryUrl ?? DEFAULT_REGISTRY_URL;
|
|
49
47
|
this.timeout = config.timeout ?? DEFAULT_TIMEOUT;
|
|
48
|
+
this.userAgent = config.userAgent;
|
|
50
49
|
}
|
|
51
50
|
// ===========================================================================
|
|
52
51
|
// Bundle API
|
|
@@ -64,6 +63,9 @@ var MpakClient = class {
|
|
|
64
63
|
const queryString = searchParams.toString();
|
|
65
64
|
const url = `${this.registryUrl}/v1/bundles/search${queryString ? `?${queryString}` : ""}`;
|
|
66
65
|
const response = await this.fetchWithTimeout(url);
|
|
66
|
+
if (response.status === 404) {
|
|
67
|
+
throw new MpakNotFoundError("bundles/search endpoint");
|
|
68
|
+
}
|
|
67
69
|
if (!response.ok) {
|
|
68
70
|
throw new MpakNetworkError(`Failed to search bundles: HTTP ${response.status}`);
|
|
69
71
|
}
|
|
@@ -155,6 +157,9 @@ var MpakClient = class {
|
|
|
155
157
|
const queryString = searchParams.toString();
|
|
156
158
|
const url = `${this.registryUrl}/v1/skills/search${queryString ? `?${queryString}` : ""}`;
|
|
157
159
|
const response = await this.fetchWithTimeout(url);
|
|
160
|
+
if (response.status === 404) {
|
|
161
|
+
throw new MpakNotFoundError("skills/search endpoint");
|
|
162
|
+
}
|
|
158
163
|
if (!response.ok) {
|
|
159
164
|
throw new MpakNetworkError(`Failed to search skills: HTTP ${response.status}`);
|
|
160
165
|
}
|
|
@@ -314,9 +319,19 @@ var MpakClient = class {
|
|
|
314
319
|
const content = await response.text();
|
|
315
320
|
if (ref.integrity) {
|
|
316
321
|
this.verifyIntegrityOrThrow(content, ref.integrity);
|
|
317
|
-
return {
|
|
318
|
-
|
|
319
|
-
|
|
322
|
+
return {
|
|
323
|
+
content,
|
|
324
|
+
version: ref.version,
|
|
325
|
+
source: "github",
|
|
326
|
+
verified: true
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
return {
|
|
330
|
+
content,
|
|
331
|
+
version: ref.version,
|
|
332
|
+
source: "github",
|
|
333
|
+
verified: false
|
|
334
|
+
};
|
|
320
335
|
}
|
|
321
336
|
/**
|
|
322
337
|
* Resolve a skill from a direct URL
|
|
@@ -431,15 +446,23 @@ var MpakClient = class {
|
|
|
431
446
|
const timeoutId = setTimeout(() => {
|
|
432
447
|
controller.abort();
|
|
433
448
|
}, this.timeout);
|
|
449
|
+
const headers = {
|
|
450
|
+
...init?.headers
|
|
451
|
+
};
|
|
452
|
+
if (this.userAgent) {
|
|
453
|
+
headers["User-Agent"] = this.userAgent;
|
|
454
|
+
}
|
|
434
455
|
try {
|
|
435
|
-
return await fetch(url, {
|
|
456
|
+
return await fetch(url, {
|
|
457
|
+
...init,
|
|
458
|
+
headers,
|
|
459
|
+
signal: controller.signal
|
|
460
|
+
});
|
|
436
461
|
} catch (error) {
|
|
437
462
|
if (error instanceof Error && error.name === "AbortError") {
|
|
438
463
|
throw new MpakNetworkError(`Request timeout after ${this.timeout}ms`);
|
|
439
464
|
}
|
|
440
|
-
throw new MpakNetworkError(
|
|
441
|
-
error instanceof Error ? error.message : "Network error"
|
|
442
|
-
);
|
|
465
|
+
throw new MpakNetworkError(error instanceof Error ? error.message : "Network error");
|
|
443
466
|
} finally {
|
|
444
467
|
clearTimeout(timeoutId);
|
|
445
468
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client.ts","../src/errors.ts"],"sourcesContent":["import { createHash } from 'crypto';\nimport type {\n MpakClientConfig,\n BundleSearchResponse,\n BundleDetailResponse,\n BundleVersionsResponse,\n BundleVersionResponse,\n BundleDownloadResponse,\n BundleSearchParams,\n SkillSearchResponse,\n SkillDetailResponse,\n SkillDownloadResponse,\n SkillSearchParams,\n Platform,\n SkillReference,\n GithubSkillReference,\n UrlSkillReference,\n ResolvedSkill,\n} from './types.js';\nimport {\n MpakNotFoundError,\n MpakIntegrityError,\n MpakNetworkError,\n} from './errors.js';\n\nconst DEFAULT_REGISTRY_URL = 'https://api.mpak.dev';\nconst DEFAULT_TIMEOUT = 30000;\n\n/**\n * Client for interacting with the mpak registry\n *\n * Zero runtime dependencies - uses native fetch and crypto only.\n * Requires Node.js 18+ for native fetch support.\n */\nexport class MpakClient {\n private readonly registryUrl: string;\n private readonly timeout: number;\n\n constructor(config: MpakClientConfig = {}) {\n this.registryUrl = config.registryUrl ?? DEFAULT_REGISTRY_URL;\n this.timeout = config.timeout ?? DEFAULT_TIMEOUT;\n }\n\n // ===========================================================================\n // Bundle API\n // ===========================================================================\n\n /**\n * Search for bundles\n */\n async searchBundles(params: BundleSearchParams = {}): Promise<BundleSearchResponse> {\n const searchParams = new URLSearchParams();\n if (params.q) searchParams.set('q', params.q);\n if (params.type) searchParams.set('type', params.type);\n if (params.sort) searchParams.set('sort', params.sort);\n if (params.limit) searchParams.set('limit', String(params.limit));\n if (params.offset) searchParams.set('offset', String(params.offset));\n\n const queryString = searchParams.toString();\n const url = `${this.registryUrl}/v1/bundles/search${queryString ? `?${queryString}` : ''}`;\n\n const response = await this.fetchWithTimeout(url);\n\n if (!response.ok) {\n throw new MpakNetworkError(`Failed to search bundles: HTTP ${response.status}`);\n }\n\n return response.json() as Promise<BundleSearchResponse>;\n }\n\n /**\n * Get bundle details\n */\n async getBundle(name: string): Promise<BundleDetailResponse> {\n this.validateScopedName(name);\n\n const url = `${this.registryUrl}/v1/bundles/${name}`;\n const response = await this.fetchWithTimeout(url);\n\n if (response.status === 404) {\n throw new MpakNotFoundError(name);\n }\n\n if (!response.ok) {\n throw new MpakNetworkError(`Failed to get bundle: HTTP ${response.status}`);\n }\n\n return response.json() as Promise<BundleDetailResponse>;\n }\n\n /**\n * Get all versions of a bundle\n */\n async getBundleVersions(name: string): Promise<BundleVersionsResponse> {\n this.validateScopedName(name);\n\n const url = `${this.registryUrl}/v1/bundles/${name}/versions`;\n const response = await this.fetchWithTimeout(url);\n\n if (response.status === 404) {\n throw new MpakNotFoundError(name);\n }\n\n if (!response.ok) {\n throw new MpakNetworkError(`Failed to get bundle versions: HTTP ${response.status}`);\n }\n\n return response.json() as Promise<BundleVersionsResponse>;\n }\n\n /**\n * Get a specific version of a bundle\n */\n async getBundleVersion(name: string, version: string): Promise<BundleVersionResponse> {\n this.validateScopedName(name);\n\n const url = `${this.registryUrl}/v1/bundles/${name}/versions/${version}`;\n const response = await this.fetchWithTimeout(url);\n\n if (response.status === 404) {\n throw new MpakNotFoundError(`${name}@${version}`);\n }\n\n if (!response.ok) {\n throw new MpakNetworkError(`Failed to get bundle version: HTTP ${response.status}`);\n }\n\n return response.json() as Promise<BundleVersionResponse>;\n }\n\n /**\n * Get download info for a bundle\n */\n async getBundleDownload(\n name: string,\n version: string,\n platform?: Platform\n ): Promise<BundleDownloadResponse> {\n this.validateScopedName(name);\n\n const params = new URLSearchParams();\n if (platform) {\n params.set('os', platform.os);\n params.set('arch', platform.arch);\n }\n\n const queryString = params.toString();\n const url = `${this.registryUrl}/v1/bundles/${name}/versions/${version}/download${queryString ? `?${queryString}` : ''}`;\n\n const response = await this.fetchWithTimeout(url, {\n headers: { Accept: 'application/json' },\n });\n\n if (response.status === 404) {\n throw new MpakNotFoundError(`${name}@${version}`);\n }\n\n if (!response.ok) {\n throw new MpakNetworkError(`Failed to get bundle download: HTTP ${response.status}`);\n }\n\n return response.json() as Promise<BundleDownloadResponse>;\n }\n\n // ===========================================================================\n // Skill API\n // ===========================================================================\n\n /**\n * Search for skills\n */\n async searchSkills(params: SkillSearchParams = {}): Promise<SkillSearchResponse> {\n const searchParams = new URLSearchParams();\n if (params.q) searchParams.set('q', params.q);\n if (params.tags) searchParams.set('tags', params.tags);\n if (params.category) searchParams.set('category', params.category);\n if (params.surface) searchParams.set('surface', params.surface);\n if (params.sort) searchParams.set('sort', params.sort);\n if (params.limit) searchParams.set('limit', String(params.limit));\n if (params.offset) searchParams.set('offset', String(params.offset));\n\n const queryString = searchParams.toString();\n const url = `${this.registryUrl}/v1/skills/search${queryString ? `?${queryString}` : ''}`;\n\n const response = await this.fetchWithTimeout(url);\n\n if (!response.ok) {\n throw new MpakNetworkError(`Failed to search skills: HTTP ${response.status}`);\n }\n\n return response.json() as Promise<SkillSearchResponse>;\n }\n\n /**\n * Get skill details\n */\n async getSkill(name: string): Promise<SkillDetailResponse> {\n this.validateScopedName(name);\n\n const url = `${this.registryUrl}/v1/skills/${name}`;\n const response = await this.fetchWithTimeout(url);\n\n if (response.status === 404) {\n throw new MpakNotFoundError(name);\n }\n\n if (!response.ok) {\n throw new MpakNetworkError(`Failed to get skill: HTTP ${response.status}`);\n }\n\n return response.json() as Promise<SkillDetailResponse>;\n }\n\n /**\n * Get download info for a skill (latest version)\n */\n async getSkillDownload(name: string): Promise<SkillDownloadResponse> {\n this.validateScopedName(name);\n\n const url = `${this.registryUrl}/v1/skills/${name}/download`;\n\n const response = await this.fetchWithTimeout(url, {\n headers: { Accept: 'application/json' },\n });\n\n if (response.status === 404) {\n throw new MpakNotFoundError(name);\n }\n\n if (!response.ok) {\n throw new MpakNetworkError(`Failed to get skill download: HTTP ${response.status}`);\n }\n\n return response.json() as Promise<SkillDownloadResponse>;\n }\n\n /**\n * Get download info for a specific skill version\n */\n async getSkillVersionDownload(name: string, version: string): Promise<SkillDownloadResponse> {\n this.validateScopedName(name);\n\n const url = `${this.registryUrl}/v1/skills/${name}/versions/${version}/download`;\n\n const response = await this.fetchWithTimeout(url, {\n headers: { Accept: 'application/json' },\n });\n\n if (response.status === 404) {\n throw new MpakNotFoundError(`${name}@${version}`);\n }\n\n if (!response.ok) {\n throw new MpakNetworkError(`Failed to get skill download: HTTP ${response.status}`);\n }\n\n return response.json() as Promise<SkillDownloadResponse>;\n }\n\n /**\n * Download skill content and verify integrity\n *\n * @throws {MpakIntegrityError} If expectedSha256 is provided and doesn't match (fail-closed)\n */\n async downloadSkillContent(\n downloadUrl: string,\n expectedSha256?: string\n ): Promise<{ content: string; verified: boolean }> {\n const response = await this.fetchWithTimeout(downloadUrl);\n\n if (!response.ok) {\n throw new MpakNetworkError(`Failed to download skill: HTTP ${response.status}`);\n }\n\n const content = await response.text();\n\n if (expectedSha256) {\n const actualHash = this.computeSha256(content);\n if (actualHash !== expectedSha256) {\n throw new MpakIntegrityError(expectedSha256, actualHash);\n }\n return { content, verified: true };\n }\n\n return { content, verified: false };\n }\n\n /**\n * Resolve a skill reference to actual content\n *\n * Supports mpak, github, and url sources. This is the main method for\n * fetching skill content from any supported source.\n *\n * @throws {MpakNotFoundError} If skill not found\n * @throws {MpakIntegrityError} If integrity check fails (fail-closed)\n * @throws {MpakNetworkError} For network failures\n *\n * @example\n * ```typescript\n * // Resolve from mpak registry\n * const skill = await client.resolveSkillRef({\n * source: 'mpak',\n * name: '@nimblebraininc/folk-crm',\n * version: '1.3.0',\n * });\n *\n * // Resolve from GitHub\n * const skill = await client.resolveSkillRef({\n * source: 'github',\n * name: '@example/my-skill',\n * version: 'v1.0.0',\n * repo: 'owner/repo',\n * path: 'skills/my-skill/SKILL.md',\n * });\n *\n * // Resolve from URL\n * const skill = await client.resolveSkillRef({\n * source: 'url',\n * name: '@example/custom',\n * version: '1.0.0',\n * url: 'https://example.com/skill.md',\n * });\n * ```\n */\n async resolveSkillRef(ref: SkillReference): Promise<ResolvedSkill> {\n switch (ref.source) {\n case 'mpak':\n return this.resolveMpakSkill(ref);\n case 'github':\n return this.resolveGithubSkill(ref);\n case 'url':\n return this.resolveUrlSkill(ref);\n default: {\n const _exhaustive: never = ref;\n throw new Error(`Unknown skill source: ${(_exhaustive as SkillReference).source}`);\n }\n }\n }\n\n /**\n * Resolve a skill from mpak registry\n *\n * The API returns a ZIP bundle containing SKILL.md and metadata.\n */\n private async resolveMpakSkill(ref: SkillReference & { source: 'mpak' }): Promise<ResolvedSkill> {\n const url = `${this.registryUrl}/v1/skills/${ref.name}/versions/${ref.version}/download`;\n\n const response = await this.fetchWithTimeout(url);\n\n if (response.status === 404) {\n throw new MpakNotFoundError(`${ref.name}@${ref.version}`);\n }\n\n if (!response.ok) {\n throw new MpakNetworkError(`Failed to fetch skill: HTTP ${response.status}`);\n }\n\n // Response is a ZIP file - extract SKILL.md\n const zipBuffer = await response.arrayBuffer();\n const content = await this.extractSkillFromZip(zipBuffer, ref.name);\n\n if (ref.integrity) {\n this.verifyIntegrityOrThrow(content, ref.integrity);\n return { content, version: ref.version, source: 'mpak', verified: true };\n }\n\n return { content, version: ref.version, source: 'mpak', verified: false };\n }\n\n /**\n * Resolve a skill from GitHub releases\n */\n private async resolveGithubSkill(ref: GithubSkillReference): Promise<ResolvedSkill> {\n const url = `https://github.com/${ref.repo}/releases/download/${ref.version}/${ref.path}`;\n const response = await this.fetchWithTimeout(url);\n\n if (!response.ok) {\n throw new MpakNotFoundError(`github:${ref.repo}/${ref.path}@${ref.version}`);\n }\n\n const content = await response.text();\n\n if (ref.integrity) {\n this.verifyIntegrityOrThrow(content, ref.integrity);\n return { content, version: ref.version, source: 'github', verified: true };\n }\n\n return { content, version: ref.version, source: 'github', verified: false };\n }\n\n /**\n * Resolve a skill from a direct URL\n */\n private async resolveUrlSkill(ref: UrlSkillReference): Promise<ResolvedSkill> {\n const response = await this.fetchWithTimeout(ref.url);\n\n if (!response.ok) {\n throw new MpakNotFoundError(`url:${ref.url}`);\n }\n\n const content = await response.text();\n\n if (ref.integrity) {\n this.verifyIntegrityOrThrow(content, ref.integrity);\n return { content, version: ref.version, source: 'url', verified: true };\n }\n\n return { content, version: ref.version, source: 'url', verified: false };\n }\n\n /**\n * Extract SKILL.md content from a skill bundle ZIP\n */\n private async extractSkillFromZip(zipBuffer: ArrayBuffer, skillName: string): Promise<string> {\n const JSZip = (await import('jszip')).default;\n const zip = await JSZip.loadAsync(zipBuffer);\n\n // Skill name format: @scope/name -> folder is just 'name'\n const folderName = skillName.split('/').pop() ?? skillName;\n const skillPath = `${folderName}/SKILL.md`;\n\n const skillFile = zip.file(skillPath);\n if (!skillFile) {\n // Try without folder prefix\n const altFile = zip.file('SKILL.md');\n if (!altFile) {\n throw new MpakNotFoundError(`SKILL.md not found in bundle for ${skillName}`);\n }\n return altFile.async('string');\n }\n\n return skillFile.async('string');\n }\n\n /**\n * Verify content integrity and throw if mismatch (fail-closed)\n */\n private verifyIntegrityOrThrow(content: string, integrity: string): void {\n const expectedHash = this.extractHash(integrity);\n const actualHash = this.computeSha256(content);\n\n if (actualHash !== expectedHash) {\n throw new MpakIntegrityError(expectedHash, actualHash);\n }\n }\n\n /**\n * Extract hash from integrity string (removes prefix)\n */\n private extractHash(integrity: string): string {\n if (integrity.startsWith('sha256:')) {\n return integrity.slice(7);\n }\n if (integrity.startsWith('sha256-')) {\n return integrity.slice(7);\n }\n return integrity;\n }\n\n // ===========================================================================\n // Utility Methods\n // ===========================================================================\n\n /**\n * Detect the current platform\n */\n static detectPlatform(): Platform {\n const nodePlatform = process.platform;\n const nodeArch = process.arch;\n\n let os: string;\n switch (nodePlatform) {\n case 'darwin':\n os = 'darwin';\n break;\n case 'win32':\n os = 'win32';\n break;\n case 'linux':\n os = 'linux';\n break;\n default:\n os = 'any';\n }\n\n let arch: string;\n switch (nodeArch) {\n case 'x64':\n arch = 'x64';\n break;\n case 'arm64':\n arch = 'arm64';\n break;\n default:\n arch = 'any';\n }\n\n return { os, arch };\n }\n\n /**\n * Compute SHA256 hash of content\n */\n private computeSha256(content: string): string {\n return createHash('sha256').update(content, 'utf8').digest('hex');\n }\n\n /**\n * Validate that a name is scoped (@scope/name)\n */\n private validateScopedName(name: string): void {\n if (!name.startsWith('@')) {\n throw new Error('Package name must be scoped (e.g., @scope/package-name)');\n }\n }\n\n /**\n * Fetch with timeout support\n */\n private async fetchWithTimeout(\n url: string,\n init?: RequestInit\n ): Promise<Response> {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => {\n controller.abort();\n }, this.timeout);\n\n try {\n return await fetch(url, { ...init, signal: controller.signal });\n } catch (error) {\n if (error instanceof Error && error.name === 'AbortError') {\n throw new MpakNetworkError(`Request timeout after ${this.timeout}ms`);\n }\n throw new MpakNetworkError(\n error instanceof Error ? error.message : 'Network error'\n );\n } finally {\n clearTimeout(timeoutId);\n }\n }\n}\n","/**\n * Base error class for mpak SDK errors\n */\nexport class MpakError extends Error {\n code: string;\n statusCode?: number;\n\n constructor(message: string, code: string, statusCode?: number) {\n super(message);\n this.name = 'MpakError';\n this.code = code;\n this.statusCode = statusCode;\n }\n}\n\n/**\n * Thrown when a requested resource is not found (404)\n */\nexport class MpakNotFoundError extends MpakError {\n constructor(resource: string) {\n super(`Resource not found: ${resource}`, 'NOT_FOUND', 404);\n this.name = 'MpakNotFoundError';\n }\n}\n\n/**\n * Thrown when integrity verification fails (hash mismatch)\n * This is a fail-closed error - content is NOT returned when this is thrown\n */\nexport class MpakIntegrityError extends MpakError {\n expected: string;\n actual: string;\n\n constructor(expected: string, actual: string) {\n super(\n `Integrity mismatch: expected ${expected}, got ${actual}`,\n 'INTEGRITY_MISMATCH'\n );\n this.name = 'MpakIntegrityError';\n this.expected = expected;\n this.actual = actual;\n }\n}\n\n/**\n * Thrown for network-related failures (timeouts, connection errors)\n */\nexport class MpakNetworkError extends MpakError {\n constructor(message: string) {\n super(message, 'NETWORK_ERROR');\n this.name = 'MpakNetworkError';\n }\n}\n"],"mappings":";AAAA,SAAS,kBAAkB;;;ACGpB,IAAM,YAAN,cAAwB,MAAM;AAAA,EACnC;AAAA,EACA;AAAA,EAEA,YAAY,SAAiB,MAAc,YAAqB;AAC9D,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,aAAa;AAAA,EACpB;AACF;AAKO,IAAM,oBAAN,cAAgC,UAAU;AAAA,EAC/C,YAAY,UAAkB;AAC5B,UAAM,uBAAuB,QAAQ,IAAI,aAAa,GAAG;AACzD,SAAK,OAAO;AAAA,EACd;AACF;AAMO,IAAM,qBAAN,cAAiC,UAAU;AAAA,EAChD;AAAA,EACA;AAAA,EAEA,YAAY,UAAkB,QAAgB;AAC5C;AAAA,MACE,gCAAgC,QAAQ,SAAS,MAAM;AAAA,MACvD;AAAA,IACF;AACA,SAAK,OAAO;AACZ,SAAK,WAAW;AAChB,SAAK,SAAS;AAAA,EAChB;AACF;AAKO,IAAM,mBAAN,cAA+B,UAAU;AAAA,EAC9C,YAAY,SAAiB;AAC3B,UAAM,SAAS,eAAe;AAC9B,SAAK,OAAO;AAAA,EACd;AACF;;;AD3BA,IAAM,uBAAuB;AAC7B,IAAM,kBAAkB;AAQjB,IAAM,aAAN,MA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EzB,QAAI;AACJ,YAAQ,cAAc;AAAA,MACpB,KAAK;AACH,aAAK;AACL;AAAA,MACF,KAAK;AACH,aAAK;AACL;AAAA,MACF,KAAK;AACH,aAAK;AACL;AAAA,MACF;AACE,aAAK;AAAA,IACT;AAEA,QAAI;AACJ,YAAQ,UAAU;AAAA,MAChB,KAAK;AACH,eAAO;AACP;AAAA,MACF,KAAK;AACH,eAAO;AACP;AAAA,MACF;AACE,eAAO;AAAA,IACX;AAEA,WAAO,EAAE,IAAI,KAAK;AAAA,EACpB;AAAA;AAAA;AAAA;AAAA,EAKQ,cAAc,SAAyB;AAC7C,WAAO,WAAW,QAAQ,EAAE,OAAO,SAAS,MAAM,EAAE,OAAO,KAAK;AAAA,EAClE;AAAA;AAAA;AAAA;AAAA,EAKQ,mBAAmB,MAAoB;AAC7C,QAAI,CAAC,KAAK,WAAW,GAAG,GAAG;AACzB,YAAM,IAAI,MAAM,yDAAyD;AAAA,IAC3E;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,MAAc,iBACZ,KACA,MACmB;AACnB,UAAM,aAAa,IAAI,gBAAgB;AACvC,UAAM,YAAY,WAAW,MAAM;AACjC,iBAAW,MAAM;AAAA,IACnB,GAAG,KAAK,OAAO;AAEf,QAAI;AACF,aAAO,MAAM,MAAM,KAAK,EAAE,GAAG,MAAM,QAAQ,WAAW,OAAO,CAAC;AAAA,IAChE,SAAS,OAAO;AACd,UAAI,iBAAiB,SAAS,MAAM,SAAS,cAAc;AACzD,cAAM,IAAI,iBAAiB,yBAAyB,KAAK,OAAO,IAAI;AAAA,MACtE;AACA,YAAM,IAAI;AAAA,QACR,iBAAiB,QAAQ,MAAM,UAAU;AAAA,MAC3C;AAAA,IACF,UAAE;AACA,mBAAa,SAAS;AAAA,IACxB;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/client.ts","../src/errors.ts"],"sourcesContent":["import { createHash } from 'crypto';\nimport type {\n MpakClientConfig,\n BundleSearchParams,\n BundleDetailResponse,\n BundleVersionsResponse,\n BundleVersionResponse,\n BundleDownloadResponse,\n SkillDetailResponse,\n SkillDownloadResponse,\n SkillSearchParams,\n Platform,\n SkillReference,\n GithubSkillReference,\n UrlSkillReference,\n ResolvedSkill,\n} from './types.js';\nimport type { BundleSearchResponse, SkillSearchResponse } from '@nimblebrain/mpak-schemas';\nimport { MpakNotFoundError, MpakIntegrityError, MpakNetworkError } from './errors.js';\n\nconst DEFAULT_REGISTRY_URL = 'https://registry.mpak.dev';\nconst DEFAULT_TIMEOUT = 30000;\n\n/**\n * Client for interacting with the mpak registry\n *\n * Requires Node.js 18+ for native fetch support.\n * Uses jszip for skill bundle extraction.\n */\nexport class MpakClient {\n private readonly registryUrl: string;\n private readonly timeout: number;\n private readonly userAgent: string | undefined;\n\n constructor(config: MpakClientConfig = {}) {\n this.registryUrl = config.registryUrl ?? DEFAULT_REGISTRY_URL;\n this.timeout = config.timeout ?? DEFAULT_TIMEOUT;\n this.userAgent = config.userAgent;\n }\n\n // ===========================================================================\n // Bundle API\n // ===========================================================================\n\n /**\n * Search for bundles\n */\n async searchBundles(params: BundleSearchParams = {}): Promise<BundleSearchResponse> {\n const searchParams = new URLSearchParams();\n if (params.q) searchParams.set('q', params.q);\n if (params.type) searchParams.set('type', params.type);\n if (params.sort) searchParams.set('sort', params.sort);\n if (params.limit) searchParams.set('limit', String(params.limit));\n if (params.offset) searchParams.set('offset', String(params.offset));\n\n const queryString = searchParams.toString();\n const url = `${this.registryUrl}/v1/bundles/search${queryString ? `?${queryString}` : ''}`;\n\n const response = await this.fetchWithTimeout(url);\n\n if (response.status === 404) {\n throw new MpakNotFoundError('bundles/search endpoint');\n }\n\n if (!response.ok) {\n throw new MpakNetworkError(`Failed to search bundles: HTTP ${response.status}`);\n }\n\n return response.json() as Promise<BundleSearchResponse>;\n }\n\n /**\n * Get bundle details\n */\n async getBundle(name: string): Promise<BundleDetailResponse> {\n this.validateScopedName(name);\n\n const url = `${this.registryUrl}/v1/bundles/${name}`;\n const response = await this.fetchWithTimeout(url);\n\n if (response.status === 404) {\n throw new MpakNotFoundError(name);\n }\n\n if (!response.ok) {\n throw new MpakNetworkError(`Failed to get bundle: HTTP ${response.status}`);\n }\n\n return response.json() as Promise<BundleDetailResponse>;\n }\n\n /**\n * Get all versions of a bundle\n */\n async getBundleVersions(name: string): Promise<BundleVersionsResponse> {\n this.validateScopedName(name);\n\n const url = `${this.registryUrl}/v1/bundles/${name}/versions`;\n const response = await this.fetchWithTimeout(url);\n\n if (response.status === 404) {\n throw new MpakNotFoundError(name);\n }\n\n if (!response.ok) {\n throw new MpakNetworkError(`Failed to get bundle versions: HTTP ${response.status}`);\n }\n\n return response.json() as Promise<BundleVersionsResponse>;\n }\n\n /**\n * Get a specific version of a bundle\n */\n async getBundleVersion(name: string, version: string): Promise<BundleVersionResponse> {\n this.validateScopedName(name);\n\n const url = `${this.registryUrl}/v1/bundles/${name}/versions/${version}`;\n const response = await this.fetchWithTimeout(url);\n\n if (response.status === 404) {\n throw new MpakNotFoundError(`${name}@${version}`);\n }\n\n if (!response.ok) {\n throw new MpakNetworkError(`Failed to get bundle version: HTTP ${response.status}`);\n }\n\n return response.json() as Promise<BundleVersionResponse>;\n }\n\n /**\n * Get download info for a bundle\n */\n async getBundleDownload(\n name: string,\n version: string,\n platform?: Platform,\n ): Promise<BundleDownloadResponse> {\n this.validateScopedName(name);\n\n const params = new URLSearchParams();\n if (platform) {\n params.set('os', platform.os);\n params.set('arch', platform.arch);\n }\n\n const queryString = params.toString();\n const url = `${this.registryUrl}/v1/bundles/${name}/versions/${version}/download${queryString ? `?${queryString}` : ''}`;\n\n const response = await this.fetchWithTimeout(url, {\n headers: { Accept: 'application/json' },\n });\n\n if (response.status === 404) {\n throw new MpakNotFoundError(`${name}@${version}`);\n }\n\n if (!response.ok) {\n throw new MpakNetworkError(`Failed to get bundle download: HTTP ${response.status}`);\n }\n\n return response.json() as Promise<BundleDownloadResponse>;\n }\n\n // ===========================================================================\n // Skill API\n // ===========================================================================\n\n /**\n * Search for skills\n */\n async searchSkills(params: SkillSearchParams = {}): Promise<SkillSearchResponse> {\n const searchParams = new URLSearchParams();\n if (params.q) searchParams.set('q', params.q);\n if (params.tags) searchParams.set('tags', params.tags);\n if (params.category) searchParams.set('category', params.category);\n if (params.surface) searchParams.set('surface', params.surface);\n if (params.sort) searchParams.set('sort', params.sort);\n if (params.limit) searchParams.set('limit', String(params.limit));\n if (params.offset) searchParams.set('offset', String(params.offset));\n\n const queryString = searchParams.toString();\n const url = `${this.registryUrl}/v1/skills/search${queryString ? `?${queryString}` : ''}`;\n\n const response = await this.fetchWithTimeout(url);\n\n if (response.status === 404) {\n throw new MpakNotFoundError('skills/search endpoint');\n }\n\n if (!response.ok) {\n throw new MpakNetworkError(`Failed to search skills: HTTP ${response.status}`);\n }\n\n return response.json() as Promise<SkillSearchResponse>;\n }\n\n /**\n * Get skill details\n */\n async getSkill(name: string): Promise<SkillDetailResponse> {\n this.validateScopedName(name);\n\n const url = `${this.registryUrl}/v1/skills/${name}`;\n const response = await this.fetchWithTimeout(url);\n\n if (response.status === 404) {\n throw new MpakNotFoundError(name);\n }\n\n if (!response.ok) {\n throw new MpakNetworkError(`Failed to get skill: HTTP ${response.status}`);\n }\n\n return response.json() as Promise<SkillDetailResponse>;\n }\n\n /**\n * Get download info for a skill (latest version)\n */\n async getSkillDownload(name: string): Promise<SkillDownloadResponse> {\n this.validateScopedName(name);\n\n const url = `${this.registryUrl}/v1/skills/${name}/download`;\n\n const response = await this.fetchWithTimeout(url, {\n headers: { Accept: 'application/json' },\n });\n\n if (response.status === 404) {\n throw new MpakNotFoundError(name);\n }\n\n if (!response.ok) {\n throw new MpakNetworkError(`Failed to get skill download: HTTP ${response.status}`);\n }\n\n return response.json() as Promise<SkillDownloadResponse>;\n }\n\n /**\n * Get download info for a specific skill version\n */\n async getSkillVersionDownload(name: string, version: string): Promise<SkillDownloadResponse> {\n this.validateScopedName(name);\n\n const url = `${this.registryUrl}/v1/skills/${name}/versions/${version}/download`;\n\n const response = await this.fetchWithTimeout(url, {\n headers: { Accept: 'application/json' },\n });\n\n if (response.status === 404) {\n throw new MpakNotFoundError(`${name}@${version}`);\n }\n\n if (!response.ok) {\n throw new MpakNetworkError(`Failed to get skill download: HTTP ${response.status}`);\n }\n\n return response.json() as Promise<SkillDownloadResponse>;\n }\n\n /**\n * Download skill content and verify integrity\n *\n * @throws {MpakIntegrityError} If expectedSha256 is provided and doesn't match (fail-closed)\n */\n async downloadSkillContent(\n downloadUrl: string,\n expectedSha256?: string,\n ): Promise<{ content: string; verified: boolean }> {\n const response = await this.fetchWithTimeout(downloadUrl);\n\n if (!response.ok) {\n throw new MpakNetworkError(`Failed to download skill: HTTP ${response.status}`);\n }\n\n const content = await response.text();\n\n if (expectedSha256) {\n const actualHash = this.computeSha256(content);\n if (actualHash !== expectedSha256) {\n throw new MpakIntegrityError(expectedSha256, actualHash);\n }\n return { content, verified: true };\n }\n\n return { content, verified: false };\n }\n\n /**\n * Resolve a skill reference to actual content\n *\n * Supports mpak, github, and url sources. This is the main method for\n * fetching skill content from any supported source.\n *\n * @throws {MpakNotFoundError} If skill not found\n * @throws {MpakIntegrityError} If integrity check fails (fail-closed)\n * @throws {MpakNetworkError} For network failures\n *\n * @example\n * ```typescript\n * // Resolve from mpak registry\n * const skill = await client.resolveSkillRef({\n * source: 'mpak',\n * name: '@nimblebraininc/folk-crm',\n * version: '1.3.0',\n * });\n *\n * // Resolve from GitHub\n * const skill = await client.resolveSkillRef({\n * source: 'github',\n * name: '@example/my-skill',\n * version: 'v1.0.0',\n * repo: 'owner/repo',\n * path: 'skills/my-skill/SKILL.md',\n * });\n *\n * // Resolve from URL\n * const skill = await client.resolveSkillRef({\n * source: 'url',\n * name: '@example/custom',\n * version: '1.0.0',\n * url: 'https://example.com/skill.md',\n * });\n * ```\n */\n async resolveSkillRef(ref: SkillReference): Promise<ResolvedSkill> {\n switch (ref.source) {\n case 'mpak':\n return this.resolveMpakSkill(ref);\n case 'github':\n return this.resolveGithubSkill(ref);\n case 'url':\n return this.resolveUrlSkill(ref);\n default: {\n const _exhaustive: never = ref;\n throw new Error(`Unknown skill source: ${(_exhaustive as SkillReference).source}`);\n }\n }\n }\n\n /**\n * Resolve a skill from mpak registry\n *\n * The API returns a ZIP bundle containing SKILL.md and metadata.\n */\n private async resolveMpakSkill(ref: SkillReference & { source: 'mpak' }): Promise<ResolvedSkill> {\n const url = `${this.registryUrl}/v1/skills/${ref.name}/versions/${ref.version}/download`;\n\n const response = await this.fetchWithTimeout(url);\n\n if (response.status === 404) {\n throw new MpakNotFoundError(`${ref.name}@${ref.version}`);\n }\n\n if (!response.ok) {\n throw new MpakNetworkError(`Failed to fetch skill: HTTP ${response.status}`);\n }\n\n // Response is a ZIP file - extract SKILL.md\n const zipBuffer = await response.arrayBuffer();\n const content = await this.extractSkillFromZip(zipBuffer, ref.name);\n\n if (ref.integrity) {\n this.verifyIntegrityOrThrow(content, ref.integrity);\n return { content, version: ref.version, source: 'mpak', verified: true };\n }\n\n return { content, version: ref.version, source: 'mpak', verified: false };\n }\n\n /**\n * Resolve a skill from GitHub releases\n */\n private async resolveGithubSkill(ref: GithubSkillReference): Promise<ResolvedSkill> {\n const url = `https://github.com/${ref.repo}/releases/download/${ref.version}/${ref.path}`;\n const response = await this.fetchWithTimeout(url);\n\n if (!response.ok) {\n throw new MpakNotFoundError(`github:${ref.repo}/${ref.path}@${ref.version}`);\n }\n\n const content = await response.text();\n\n if (ref.integrity) {\n this.verifyIntegrityOrThrow(content, ref.integrity);\n return {\n content,\n version: ref.version,\n source: 'github',\n verified: true,\n };\n }\n\n return {\n content,\n version: ref.version,\n source: 'github',\n verified: false,\n };\n }\n\n /**\n * Resolve a skill from a direct URL\n */\n private async resolveUrlSkill(ref: UrlSkillReference): Promise<ResolvedSkill> {\n const response = await this.fetchWithTimeout(ref.url);\n\n if (!response.ok) {\n throw new MpakNotFoundError(`url:${ref.url}`);\n }\n\n const content = await response.text();\n\n if (ref.integrity) {\n this.verifyIntegrityOrThrow(content, ref.integrity);\n return { content, version: ref.version, source: 'url', verified: true };\n }\n\n return { content, version: ref.version, source: 'url', verified: false };\n }\n\n /**\n * Extract SKILL.md content from a skill bundle ZIP\n */\n private async extractSkillFromZip(zipBuffer: ArrayBuffer, skillName: string): Promise<string> {\n const JSZip = (await import('jszip')).default;\n const zip = await JSZip.loadAsync(zipBuffer);\n\n // Skill name format: @scope/name -> folder is just 'name'\n const folderName = skillName.split('/').pop() ?? skillName;\n const skillPath = `${folderName}/SKILL.md`;\n\n const skillFile = zip.file(skillPath);\n if (!skillFile) {\n // Try without folder prefix\n const altFile = zip.file('SKILL.md');\n if (!altFile) {\n throw new MpakNotFoundError(`SKILL.md not found in bundle for ${skillName}`);\n }\n return altFile.async('string');\n }\n\n return skillFile.async('string');\n }\n\n /**\n * Verify content integrity and throw if mismatch (fail-closed)\n */\n private verifyIntegrityOrThrow(content: string, integrity: string): void {\n const expectedHash = this.extractHash(integrity);\n const actualHash = this.computeSha256(content);\n\n if (actualHash !== expectedHash) {\n throw new MpakIntegrityError(expectedHash, actualHash);\n }\n }\n\n /**\n * Extract hash from integrity string (removes prefix)\n */\n private extractHash(integrity: string): string {\n if (integrity.startsWith('sha256:')) {\n return integrity.slice(7);\n }\n if (integrity.startsWith('sha256-')) {\n return integrity.slice(7);\n }\n return integrity;\n }\n\n // ===========================================================================\n // Utility Methods\n // ===========================================================================\n\n /**\n * Detect the current platform\n */\n static detectPlatform(): Platform {\n const nodePlatform = process.platform;\n const nodeArch = process.arch;\n\n let os: string;\n switch (nodePlatform) {\n case 'darwin':\n os = 'darwin';\n break;\n case 'win32':\n os = 'win32';\n break;\n case 'linux':\n os = 'linux';\n break;\n default:\n os = 'any';\n }\n\n let arch: string;\n switch (nodeArch) {\n case 'x64':\n arch = 'x64';\n break;\n case 'arm64':\n arch = 'arm64';\n break;\n default:\n arch = 'any';\n }\n\n return { os, arch };\n }\n\n /**\n * Compute SHA256 hash of content\n */\n private computeSha256(content: string): string {\n return createHash('sha256').update(content, 'utf8').digest('hex');\n }\n\n /**\n * Validate that a name is scoped (@scope/name)\n */\n private validateScopedName(name: string): void {\n if (!name.startsWith('@')) {\n throw new Error('Package name must be scoped (e.g., @scope/package-name)');\n }\n }\n\n /**\n * Fetch with timeout support\n */\n private async fetchWithTimeout(url: string, init?: RequestInit): Promise<Response> {\n const controller = new AbortController();\n const timeoutId = setTimeout(() => {\n controller.abort();\n }, this.timeout);\n\n const headers: Record<string, string> = {\n ...(init?.headers as Record<string, string>),\n };\n if (this.userAgent) {\n headers['User-Agent'] = this.userAgent;\n }\n\n try {\n return await fetch(url, {\n ...init,\n headers,\n signal: controller.signal,\n });\n } catch (error) {\n if (error instanceof Error && error.name === 'AbortError') {\n throw new MpakNetworkError(`Request timeout after ${this.timeout}ms`);\n }\n throw new MpakNetworkError(error instanceof Error ? error.message : 'Network error');\n } finally {\n clearTimeout(timeoutId);\n }\n }\n}\n","/**\n * Base error class for mpak SDK errors\n */\nexport class MpakError extends Error {\n code: string;\n statusCode: number | undefined;\n\n constructor(message: string, code: string, statusCode?: number) {\n super(message);\n this.name = 'MpakError';\n this.code = code;\n this.statusCode = statusCode;\n }\n}\n\n/**\n * Thrown when a requested resource is not found (404)\n */\nexport class MpakNotFoundError extends MpakError {\n constructor(resource: string) {\n super(`Resource not found: ${resource}`, 'NOT_FOUND', 404);\n this.name = 'MpakNotFoundError';\n }\n}\n\n/**\n * Thrown when integrity verification fails (hash mismatch)\n * This is a fail-closed error - content is NOT returned when this is thrown\n */\nexport class MpakIntegrityError extends MpakError {\n expected: string;\n actual: string;\n\n constructor(expected: string, actual: string) {\n super(`Integrity mismatch: expected ${expected}, got ${actual}`, 'INTEGRITY_MISMATCH');\n this.name = 'MpakIntegrityError';\n this.expected = expected;\n this.actual = actual;\n }\n}\n\n/**\n * Thrown for network-related failures (timeouts, connection errors)\n */\nexport class MpakNetworkError extends MpakError {\n constructor(message: string) {\n super(message, 'NETWORK_ERROR');\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;AACH,eAAO;AACP;AAAA,MACF,KAAK;AACH,eAAO;AACP;AAAA,MACF;AACE,eAAO;AAAA,IACX;AAEA,WAAO,EAAE,IAAI,KAAK;AAAA,EACpB;AAAA;AAAA;AAAA;AAAA,EAKQ,cAAc,SAAyB;AAC7C,WAAO,WAAW,QAAQ,EAAE,OAAO,SAAS,MAAM,EAAE,OAAO,KAAK;AAAA,EAClE;AAAA;AAAA;AAAA;AAAA,EAKQ,mBAAmB,MAAoB;AAC7C,QAAI,CAAC,KAAK,WAAW,GAAG,GAAG;AACzB,YAAM,IAAI,MAAM,yDAAyD;AAAA,IAC3E;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,MAAc,iBAAiB,KAAa,MAAuC;AACjF,UAAM,aAAa,IAAI,gBAAgB;AACvC,UAAM,YAAY,WAAW,MAAM;AACjC,iBAAW,MAAM;AAAA,IACnB,GAAG,KAAK,OAAO;AAEf,UAAM,UAAkC;AAAA,MACtC,GAAI,MAAM;AAAA,IACZ;AACA,QAAI,KAAK,WAAW;AAClB,cAAQ,YAAY,IAAI,KAAK;AAAA,IAC/B;AAEA,QAAI;AACF,aAAO,MAAM,MAAM,KAAK;AAAA,QACtB,GAAG;AAAA,QACH;AAAA,QACA,QAAQ,WAAW;AAAA,MACrB,CAAC;AAAA,IACH,SAAS,OAAO;AACd,UAAI,iBAAiB,SAAS,MAAM,SAAS,cAAc;AACzD,cAAM,IAAI,iBAAiB,yBAAyB,KAAK,OAAO,IAAI;AAAA,MACtE;AACA,YAAM,IAAI,iBAAiB,iBAAiB,QAAQ,MAAM,UAAU,eAAe;AAAA,IACrF,UAAE;AACA,mBAAa,SAAS;AAAA,IACxB;AAAA,EACF;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,70 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nimblebrain/mpak-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "TypeScript SDK for mpak registry - MCPB bundles and Agent Skills",
|
|
5
|
+
"author": "NimbleBrain Inc <engineering@mpak.dev>",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/NimbleBrainInc/mpak.git",
|
|
10
|
+
"directory": "packages/sdk-typescript"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://mpak.dev",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/NimbleBrainInc/mpak/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"mpak",
|
|
18
|
+
"mcp",
|
|
19
|
+
"sdk",
|
|
20
|
+
"mcpb",
|
|
21
|
+
"model-context-protocol",
|
|
22
|
+
"agent-skills"
|
|
23
|
+
],
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public",
|
|
26
|
+
"registry": "https://registry.npmjs.org/"
|
|
27
|
+
},
|
|
5
28
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.cjs",
|
|
7
|
-
"module": "./dist/index.js",
|
|
8
|
-
"types": "./dist/index.d.ts",
|
|
9
29
|
"exports": {
|
|
10
30
|
".": {
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
31
|
+
"import": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"default": "./dist/index.js"
|
|
34
|
+
},
|
|
35
|
+
"require": {
|
|
36
|
+
"types": "./dist/index.d.cts",
|
|
37
|
+
"default": "./dist/index.cjs"
|
|
38
|
+
}
|
|
14
39
|
}
|
|
15
40
|
},
|
|
41
|
+
"main": "./dist/index.cjs",
|
|
42
|
+
"module": "./dist/index.js",
|
|
43
|
+
"types": "./dist/index.d.ts",
|
|
16
44
|
"files": [
|
|
17
45
|
"dist",
|
|
18
|
-
"README.md"
|
|
19
|
-
"LICENSE"
|
|
46
|
+
"README.md"
|
|
20
47
|
],
|
|
21
48
|
"sideEffects": false,
|
|
22
49
|
"scripts": {
|
|
23
50
|
"build": "tsup",
|
|
24
51
|
"clean": "rm -rf dist coverage",
|
|
25
|
-
"
|
|
26
|
-
"lint": "eslint src/",
|
|
27
|
-
"lint:fix": "eslint src/ --fix",
|
|
52
|
+
"dev": "tsup --watch",
|
|
53
|
+
"lint": "eslint src/ tests/",
|
|
28
54
|
"test": "vitest run",
|
|
29
55
|
"test:watch": "vitest",
|
|
30
56
|
"test:coverage": "vitest run --coverage",
|
|
31
57
|
"test:integration": "vitest run --config vitest.integration.config.ts",
|
|
32
|
-
"
|
|
33
|
-
"verify": "npm run typecheck && npm run lint && npm run test",
|
|
34
|
-
"prepublishOnly": "npm run clean && npm run verify && npm run build"
|
|
58
|
+
"typecheck": "tsc --noEmit"
|
|
35
59
|
},
|
|
36
60
|
"engines": {
|
|
37
|
-
"node": ">=
|
|
38
|
-
},
|
|
39
|
-
"author": "NimbleBrain <support@nimblebrain.ai>",
|
|
40
|
-
"license": "Apache-2.0",
|
|
41
|
-
"repository": {
|
|
42
|
-
"type": "git",
|
|
43
|
-
"url": "https://github.com/NimbleBrainInc/mpak-sdk.git"
|
|
44
|
-
},
|
|
45
|
-
"keywords": [
|
|
46
|
-
"mpak",
|
|
47
|
-
"mcp",
|
|
48
|
-
"skills",
|
|
49
|
-
"agent",
|
|
50
|
-
"nimblebrain"
|
|
51
|
-
],
|
|
52
|
-
"publishConfig": {
|
|
53
|
-
"access": "public",
|
|
54
|
-
"registry": "https://registry.npmjs.org/"
|
|
61
|
+
"node": ">=22"
|
|
55
62
|
},
|
|
56
63
|
"dependencies": {
|
|
64
|
+
"@nimblebrain/mpak-schemas": "workspace:*",
|
|
57
65
|
"jszip": "^3.10.1"
|
|
58
66
|
},
|
|
59
67
|
"devDependencies": {
|
|
60
|
-
"@
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"openapi-typescript": "^7.10.1",
|
|
65
|
-
"tsup": "^8.5.1",
|
|
66
|
-
"typescript": "^5.7.3",
|
|
67
|
-
"typescript-eslint": "^8.21.0",
|
|
68
|
-
"vitest": "^2.1.8"
|
|
68
|
+
"@types/node": "^22.0.0",
|
|
69
|
+
"tsup": "^8.4.0",
|
|
70
|
+
"typescript": "^5.7.0",
|
|
71
|
+
"vitest": "^3.0.0"
|
|
69
72
|
}
|
|
70
73
|
}
|
package/LICENSE
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
Copyright 2026 NimbleBrain Inc.
|
|
179
|
-
|
|
180
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
-
you may not use this file except in compliance with the License.
|
|
182
|
-
You may obtain a copy of the License at
|
|
183
|
-
|
|
184
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
-
|
|
186
|
-
Unless required by applicable law or agreed to in writing, software
|
|
187
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
-
See the License for the specific language governing permissions and
|
|
190
|
-
limitations under the License.
|