@musher-dev/musher-sdk 0.1.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.
@@ -0,0 +1,1141 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * FileHandle — binary-safe content wrapper for bundle assets.
5
+ */
6
+ declare class FileHandle {
7
+ readonly logicalPath: string;
8
+ readonly assetType: string;
9
+ readonly sha256: string;
10
+ readonly mediaType: string | undefined;
11
+ readonly sizeBytes: number;
12
+ private readonly _content;
13
+ constructor(logicalPath: string, assetType: string, sha256: string, sizeBytes: number, content: Buffer, mediaType?: string | undefined);
14
+ /** Return content as a UTF-8 string. */
15
+ text(): string;
16
+ /** Return content as a Uint8Array. */
17
+ bytes(): Uint8Array;
18
+ /** Return content as a ReadableStream. */
19
+ stream(): ReadableStream<Uint8Array>;
20
+ }
21
+
22
+ /**
23
+ * AgentSpecHandle — wraps a single agent_definition asset.
24
+ */
25
+
26
+ declare class AgentSpecHandle {
27
+ readonly name: string;
28
+ private readonly _file;
29
+ constructor(name: string, file: FileHandle);
30
+ /** All files belonging to this agent spec (single file). */
31
+ files(): FileHandle[];
32
+ /** The agent spec content as text. */
33
+ content(): string;
34
+ /** The underlying file handle. */
35
+ file(): FileHandle;
36
+ }
37
+
38
+ /**
39
+ * PromptHandle — wraps a single prompt asset.
40
+ */
41
+
42
+ declare class PromptHandle {
43
+ readonly name: string;
44
+ private readonly _file;
45
+ constructor(name: string, file: FileHandle);
46
+ /** All files belonging to this prompt (single file). */
47
+ files(): FileHandle[];
48
+ /** The prompt content as text. */
49
+ content(): string;
50
+ /** The underlying file handle. */
51
+ file(): FileHandle;
52
+ }
53
+
54
+ /**
55
+ * OpenAI adapter — export skills as local files or inline base64 ZIP.
56
+ */
57
+
58
+ interface OpenAILocalSkill {
59
+ name: string;
60
+ description: string;
61
+ path: string;
62
+ }
63
+ interface OpenAIInlineSkill {
64
+ type: "inline";
65
+ name: string;
66
+ description: string;
67
+ source: {
68
+ type: "base64";
69
+ mediaType: "application/zip";
70
+ data: string;
71
+ };
72
+ }
73
+ /**
74
+ * Export a skill as a local file directory structure.
75
+ */
76
+ declare function exportOpenAILocalSkill(skill: SkillHandle, targetDir: string): Promise<OpenAILocalSkill>;
77
+ /**
78
+ * Export a skill as an inline base64 ZIP matching OpenAI's ShellToolInlineSkill shape.
79
+ */
80
+ declare function exportOpenAIInlineSkill(skill: SkillHandle): OpenAIInlineSkill;
81
+
82
+ /**
83
+ * Minimal YAML frontmatter parser for SKILL.md files.
84
+ *
85
+ * Extracts `name` and `description` from `---` delimited frontmatter.
86
+ * Only handles single-line scalar values (quoted or unquoted).
87
+ */
88
+
89
+ interface FrontmatterResult {
90
+ name?: string | undefined;
91
+ description?: string | undefined;
92
+ body: string;
93
+ }
94
+ /**
95
+ * Parse YAML frontmatter from a markdown string.
96
+ * Returns extracted `name` and `description` fields plus the remaining body.
97
+ */
98
+ declare function parseFrontmatter(text: string): FrontmatterResult;
99
+ /**
100
+ * Extract a description string from a skill, preferring frontmatter metadata.
101
+ */
102
+ declare function extractDescription(skill: SkillHandle): string;
103
+
104
+ declare class SkillHandle {
105
+ readonly name: string;
106
+ private readonly _files;
107
+ constructor(name: string, files: FileHandle[]);
108
+ /** All files belonging to this skill. */
109
+ files(): FileHandle[];
110
+ /** The SKILL.md definition file, if present. */
111
+ definition(): FileHandle | undefined;
112
+ /** Parsed frontmatter from SKILL.md, if present. */
113
+ metadata(): FrontmatterResult | undefined;
114
+ /** Export as an OpenAI local skill directory. */
115
+ exportOpenAILocal(targetDir: string): Promise<OpenAILocalSkill>;
116
+ /** Export as an OpenAI inline base64 ZIP skill. */
117
+ exportOpenAIInline(): Promise<OpenAIInlineSkill>;
118
+ }
119
+
120
+ /**
121
+ * ToolsetHandle — wraps a single tool_config asset.
122
+ */
123
+
124
+ declare class ToolsetHandle {
125
+ readonly name: string;
126
+ private readonly _file;
127
+ constructor(name: string, file: FileHandle);
128
+ /** All files belonging to this toolset (single file). */
129
+ files(): FileHandle[];
130
+ /** The toolset content as text. */
131
+ content(): string;
132
+ /** The underlying file handle. */
133
+ file(): FileHandle;
134
+ }
135
+
136
+ /**
137
+ * BundleRef — parse and represent bundle references.
138
+ *
139
+ * Supported formats:
140
+ * namespace/slug
141
+ * namespace/slug:version
142
+ * namespace/slug@sha256:digest
143
+ */
144
+ declare class BundleRef {
145
+ readonly namespace: string;
146
+ readonly slug: string;
147
+ readonly version: string | undefined;
148
+ readonly digest: string | undefined;
149
+ private constructor();
150
+ /** Parse a ref string into a BundleRef. */
151
+ static parse(ref: string): BundleRef;
152
+ /** Return the base ref without version or digest: "namespace/slug". */
153
+ toBaseRef(): string;
154
+ /** Return the full ref string. */
155
+ toString(): string;
156
+ }
157
+
158
+ declare const AssetSummaryOutputSchema: z.ZodObject<{
159
+ id: z.ZodString;
160
+ bundleId: z.ZodString;
161
+ assetType: z.ZodString;
162
+ logicalPath: z.ZodString;
163
+ contentSha256: z.ZodString;
164
+ contentSizeBytes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
165
+ mediaType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
166
+ createdAt: z.ZodString;
167
+ updatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
168
+ }, "strip", z.ZodTypeAny, {
169
+ id: string;
170
+ bundleId: string;
171
+ assetType: string;
172
+ logicalPath: string;
173
+ contentSha256: string;
174
+ createdAt: string;
175
+ contentSizeBytes?: number | null | undefined;
176
+ mediaType?: string | null | undefined;
177
+ updatedAt?: string | null | undefined;
178
+ }, {
179
+ id: string;
180
+ bundleId: string;
181
+ assetType: string;
182
+ logicalPath: string;
183
+ contentSha256: string;
184
+ createdAt: string;
185
+ contentSizeBytes?: number | null | undefined;
186
+ mediaType?: string | null | undefined;
187
+ updatedAt?: string | null | undefined;
188
+ }>;
189
+ declare const AssetDetailOutputSchema: z.ZodObject<{
190
+ id: z.ZodString;
191
+ bundleId: z.ZodString;
192
+ assetType: z.ZodString;
193
+ logicalPath: z.ZodString;
194
+ contentSha256: z.ZodString;
195
+ contentSizeBytes: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
196
+ mediaType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
197
+ createdAt: z.ZodString;
198
+ updatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
199
+ } & {
200
+ contentText: z.ZodOptional<z.ZodNullable<z.ZodString>>;
201
+ }, "strip", z.ZodTypeAny, {
202
+ id: string;
203
+ bundleId: string;
204
+ assetType: string;
205
+ logicalPath: string;
206
+ contentSha256: string;
207
+ createdAt: string;
208
+ contentSizeBytes?: number | null | undefined;
209
+ mediaType?: string | null | undefined;
210
+ updatedAt?: string | null | undefined;
211
+ contentText?: string | null | undefined;
212
+ }, {
213
+ id: string;
214
+ bundleId: string;
215
+ assetType: string;
216
+ logicalPath: string;
217
+ contentSha256: string;
218
+ createdAt: string;
219
+ contentSizeBytes?: number | null | undefined;
220
+ mediaType?: string | null | undefined;
221
+ updatedAt?: string | null | undefined;
222
+ contentText?: string | null | undefined;
223
+ }>;
224
+
225
+ declare const BundleOutputSchema: z.ZodObject<{
226
+ id: z.ZodString;
227
+ namespace: z.ZodString;
228
+ slug: z.ZodString;
229
+ ref: z.ZodString;
230
+ name: z.ZodString;
231
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
232
+ visibility: z.ZodEnum<["private", "public"]>;
233
+ sourceType: z.ZodEnum<["console", "registry"]>;
234
+ readmeFormat: z.ZodOptional<z.ZodNullable<z.ZodString>>;
235
+ createdAt: z.ZodString;
236
+ updatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
237
+ }, "strip", z.ZodTypeAny, {
238
+ name: string;
239
+ namespace: string;
240
+ slug: string;
241
+ id: string;
242
+ createdAt: string;
243
+ ref: string;
244
+ visibility: "private" | "public";
245
+ sourceType: "console" | "registry";
246
+ description?: string | null | undefined;
247
+ updatedAt?: string | null | undefined;
248
+ readmeFormat?: string | null | undefined;
249
+ }, {
250
+ name: string;
251
+ namespace: string;
252
+ slug: string;
253
+ id: string;
254
+ createdAt: string;
255
+ ref: string;
256
+ visibility: "private" | "public";
257
+ sourceType: "console" | "registry";
258
+ description?: string | null | undefined;
259
+ updatedAt?: string | null | undefined;
260
+ readmeFormat?: string | null | undefined;
261
+ }>;
262
+ declare const BundleDetailOutputSchema: z.ZodObject<{
263
+ id: z.ZodString;
264
+ namespace: z.ZodString;
265
+ slug: z.ZodString;
266
+ ref: z.ZodString;
267
+ name: z.ZodString;
268
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
269
+ visibility: z.ZodEnum<["private", "public"]>;
270
+ sourceType: z.ZodEnum<["console", "registry"]>;
271
+ readmeFormat: z.ZodOptional<z.ZodNullable<z.ZodString>>;
272
+ createdAt: z.ZodString;
273
+ updatedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
274
+ } & {
275
+ readmeContent: z.ZodOptional<z.ZodNullable<z.ZodString>>;
276
+ latestVersion: z.ZodOptional<z.ZodNullable<z.ZodString>>;
277
+ versionCount: z.ZodNumber;
278
+ assetCount: z.ZodNumber;
279
+ }, "strip", z.ZodTypeAny, {
280
+ name: string;
281
+ namespace: string;
282
+ slug: string;
283
+ id: string;
284
+ createdAt: string;
285
+ ref: string;
286
+ visibility: "private" | "public";
287
+ sourceType: "console" | "registry";
288
+ versionCount: number;
289
+ assetCount: number;
290
+ description?: string | null | undefined;
291
+ updatedAt?: string | null | undefined;
292
+ readmeFormat?: string | null | undefined;
293
+ readmeContent?: string | null | undefined;
294
+ latestVersion?: string | null | undefined;
295
+ }, {
296
+ name: string;
297
+ namespace: string;
298
+ slug: string;
299
+ id: string;
300
+ createdAt: string;
301
+ ref: string;
302
+ visibility: "private" | "public";
303
+ sourceType: "console" | "registry";
304
+ versionCount: number;
305
+ assetCount: number;
306
+ description?: string | null | undefined;
307
+ updatedAt?: string | null | undefined;
308
+ readmeFormat?: string | null | undefined;
309
+ readmeContent?: string | null | undefined;
310
+ latestVersion?: string | null | undefined;
311
+ }>;
312
+
313
+ declare const BundleVisibility: z.ZodEnum<["private", "public"]>;
314
+ declare const BundleVersionState: z.ZodEnum<["published", "yanked"]>;
315
+ declare const AssetType: z.ZodEnum<["agent_definition", "skill", "tool_config", "prompt", "config", "other"]>;
316
+ declare const BundleSourceType: z.ZodEnum<["console", "registry"]>;
317
+ declare const PaginationMetaSchema: z.ZodObject<{
318
+ nextCursor: z.ZodNullable<z.ZodString>;
319
+ hasMore: z.ZodBoolean;
320
+ }, "strip", z.ZodTypeAny, {
321
+ nextCursor: string | null;
322
+ hasMore: boolean;
323
+ }, {
324
+ nextCursor: string | null;
325
+ hasMore: boolean;
326
+ }>;
327
+ /** Paginated response envelope. */
328
+ declare function paginatedSchema<T extends z.ZodTypeAny>(itemSchema: T): z.ZodObject<{
329
+ data: z.ZodArray<T, "many">;
330
+ meta: z.ZodObject<{
331
+ nextCursor: z.ZodNullable<z.ZodString>;
332
+ hasMore: z.ZodBoolean;
333
+ }, "strip", z.ZodTypeAny, {
334
+ nextCursor: string | null;
335
+ hasMore: boolean;
336
+ }, {
337
+ nextCursor: string | null;
338
+ hasMore: boolean;
339
+ }>;
340
+ }, "strip", z.ZodTypeAny, {
341
+ data: T["_output"][];
342
+ meta: {
343
+ nextCursor: string | null;
344
+ hasMore: boolean;
345
+ };
346
+ }, {
347
+ data: T["_input"][];
348
+ meta: {
349
+ nextCursor: string | null;
350
+ hasMore: boolean;
351
+ };
352
+ }>;
353
+
354
+ declare const BundleLayerOutputSchema: z.ZodObject<{
355
+ assetId: z.ZodString;
356
+ logicalPath: z.ZodString;
357
+ assetType: z.ZodString;
358
+ contentSha256: z.ZodString;
359
+ sizeBytes: z.ZodNumber;
360
+ mediaType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
361
+ }, "strip", z.ZodTypeAny, {
362
+ assetType: string;
363
+ logicalPath: string;
364
+ contentSha256: string;
365
+ assetId: string;
366
+ sizeBytes: number;
367
+ mediaType?: string | null | undefined;
368
+ }, {
369
+ assetType: string;
370
+ logicalPath: string;
371
+ contentSha256: string;
372
+ assetId: string;
373
+ sizeBytes: number;
374
+ mediaType?: string | null | undefined;
375
+ }>;
376
+ declare const BundleManifestOutputSchema: z.ZodObject<{
377
+ layers: z.ZodArray<z.ZodObject<{
378
+ assetId: z.ZodString;
379
+ logicalPath: z.ZodString;
380
+ assetType: z.ZodString;
381
+ contentSha256: z.ZodString;
382
+ sizeBytes: z.ZodNumber;
383
+ mediaType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
384
+ }, "strip", z.ZodTypeAny, {
385
+ assetType: string;
386
+ logicalPath: string;
387
+ contentSha256: string;
388
+ assetId: string;
389
+ sizeBytes: number;
390
+ mediaType?: string | null | undefined;
391
+ }, {
392
+ assetType: string;
393
+ logicalPath: string;
394
+ contentSha256: string;
395
+ assetId: string;
396
+ sizeBytes: number;
397
+ mediaType?: string | null | undefined;
398
+ }>, "many">;
399
+ }, "strip", z.ZodTypeAny, {
400
+ layers: {
401
+ assetType: string;
402
+ logicalPath: string;
403
+ contentSha256: string;
404
+ assetId: string;
405
+ sizeBytes: number;
406
+ mediaType?: string | null | undefined;
407
+ }[];
408
+ }, {
409
+ layers: {
410
+ assetType: string;
411
+ logicalPath: string;
412
+ contentSha256: string;
413
+ assetId: string;
414
+ sizeBytes: number;
415
+ mediaType?: string | null | undefined;
416
+ }[];
417
+ }>;
418
+ declare const BundleResolveOutputSchema: z.ZodObject<{
419
+ bundleId: z.ZodString;
420
+ versionId: z.ZodString;
421
+ namespace: z.ZodString;
422
+ slug: z.ZodString;
423
+ ref: z.ZodString;
424
+ version: z.ZodString;
425
+ sourceType: z.ZodEnum<["console", "registry"]>;
426
+ ociRef: z.ZodOptional<z.ZodNullable<z.ZodString>>;
427
+ ociDigest: z.ZodOptional<z.ZodNullable<z.ZodString>>;
428
+ state: z.ZodEnum<["published", "yanked"]>;
429
+ manifest: z.ZodOptional<z.ZodNullable<z.ZodObject<{
430
+ layers: z.ZodArray<z.ZodObject<{
431
+ assetId: z.ZodString;
432
+ logicalPath: z.ZodString;
433
+ assetType: z.ZodString;
434
+ contentSha256: z.ZodString;
435
+ sizeBytes: z.ZodNumber;
436
+ mediaType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
437
+ }, "strip", z.ZodTypeAny, {
438
+ assetType: string;
439
+ logicalPath: string;
440
+ contentSha256: string;
441
+ assetId: string;
442
+ sizeBytes: number;
443
+ mediaType?: string | null | undefined;
444
+ }, {
445
+ assetType: string;
446
+ logicalPath: string;
447
+ contentSha256: string;
448
+ assetId: string;
449
+ sizeBytes: number;
450
+ mediaType?: string | null | undefined;
451
+ }>, "many">;
452
+ }, "strip", z.ZodTypeAny, {
453
+ layers: {
454
+ assetType: string;
455
+ logicalPath: string;
456
+ contentSha256: string;
457
+ assetId: string;
458
+ sizeBytes: number;
459
+ mediaType?: string | null | undefined;
460
+ }[];
461
+ }, {
462
+ layers: {
463
+ assetType: string;
464
+ logicalPath: string;
465
+ contentSha256: string;
466
+ assetId: string;
467
+ sizeBytes: number;
468
+ mediaType?: string | null | undefined;
469
+ }[];
470
+ }>>>;
471
+ }, "strip", z.ZodTypeAny, {
472
+ namespace: string;
473
+ slug: string;
474
+ version: string;
475
+ bundleId: string;
476
+ ref: string;
477
+ sourceType: "console" | "registry";
478
+ versionId: string;
479
+ state: "published" | "yanked";
480
+ ociRef?: string | null | undefined;
481
+ ociDigest?: string | null | undefined;
482
+ manifest?: {
483
+ layers: {
484
+ assetType: string;
485
+ logicalPath: string;
486
+ contentSha256: string;
487
+ assetId: string;
488
+ sizeBytes: number;
489
+ mediaType?: string | null | undefined;
490
+ }[];
491
+ } | null | undefined;
492
+ }, {
493
+ namespace: string;
494
+ slug: string;
495
+ version: string;
496
+ bundleId: string;
497
+ ref: string;
498
+ sourceType: "console" | "registry";
499
+ versionId: string;
500
+ state: "published" | "yanked";
501
+ ociRef?: string | null | undefined;
502
+ ociDigest?: string | null | undefined;
503
+ manifest?: {
504
+ layers: {
505
+ assetType: string;
506
+ logicalPath: string;
507
+ contentSha256: string;
508
+ assetId: string;
509
+ sizeBytes: number;
510
+ mediaType?: string | null | undefined;
511
+ }[];
512
+ } | null | undefined;
513
+ }>;
514
+
515
+ declare const BundleVersionSummaryOutputSchema: z.ZodObject<{
516
+ id: z.ZodString;
517
+ bundleId: z.ZodString;
518
+ version: z.ZodString;
519
+ state: z.ZodEnum<["published", "yanked"]>;
520
+ ociRef: z.ZodOptional<z.ZodNullable<z.ZodString>>;
521
+ ociDigest: z.ZodOptional<z.ZodNullable<z.ZodString>>;
522
+ publishedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
523
+ yankedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
524
+ yankedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
525
+ yankReason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
526
+ createdAt: z.ZodString;
527
+ }, "strip", z.ZodTypeAny, {
528
+ version: string;
529
+ id: string;
530
+ bundleId: string;
531
+ createdAt: string;
532
+ state: "published" | "yanked";
533
+ ociRef?: string | null | undefined;
534
+ ociDigest?: string | null | undefined;
535
+ publishedBy?: string | null | undefined;
536
+ yankedBy?: string | null | undefined;
537
+ yankedAt?: string | null | undefined;
538
+ yankReason?: string | null | undefined;
539
+ }, {
540
+ version: string;
541
+ id: string;
542
+ bundleId: string;
543
+ createdAt: string;
544
+ state: "published" | "yanked";
545
+ ociRef?: string | null | undefined;
546
+ ociDigest?: string | null | undefined;
547
+ publishedBy?: string | null | undefined;
548
+ yankedBy?: string | null | undefined;
549
+ yankedAt?: string | null | undefined;
550
+ yankReason?: string | null | undefined;
551
+ }>;
552
+ declare const ManifestAssetOutputSchema: z.ZodObject<{
553
+ assetId: z.ZodString;
554
+ logicalPath: z.ZodString;
555
+ assetType: z.ZodString;
556
+ contentSha256: z.ZodString;
557
+ sizeBytes: z.ZodNumber;
558
+ mediaType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
559
+ }, "strip", z.ZodTypeAny, {
560
+ assetType: string;
561
+ logicalPath: string;
562
+ contentSha256: string;
563
+ assetId: string;
564
+ sizeBytes: number;
565
+ mediaType?: string | null | undefined;
566
+ }, {
567
+ assetType: string;
568
+ logicalPath: string;
569
+ contentSha256: string;
570
+ assetId: string;
571
+ sizeBytes: number;
572
+ mediaType?: string | null | undefined;
573
+ }>;
574
+ declare const ManifestDetailOutputSchema: z.ZodObject<{
575
+ namespace: z.ZodString;
576
+ bundleSlug: z.ZodString;
577
+ version: z.ZodString;
578
+ assets: z.ZodArray<z.ZodObject<{
579
+ assetId: z.ZodString;
580
+ logicalPath: z.ZodString;
581
+ assetType: z.ZodString;
582
+ contentSha256: z.ZodString;
583
+ sizeBytes: z.ZodNumber;
584
+ mediaType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
585
+ }, "strip", z.ZodTypeAny, {
586
+ assetType: string;
587
+ logicalPath: string;
588
+ contentSha256: string;
589
+ assetId: string;
590
+ sizeBytes: number;
591
+ mediaType?: string | null | undefined;
592
+ }, {
593
+ assetType: string;
594
+ logicalPath: string;
595
+ contentSha256: string;
596
+ assetId: string;
597
+ sizeBytes: number;
598
+ mediaType?: string | null | undefined;
599
+ }>, "many">;
600
+ }, "strip", z.ZodTypeAny, {
601
+ namespace: string;
602
+ version: string;
603
+ bundleSlug: string;
604
+ assets: {
605
+ assetType: string;
606
+ logicalPath: string;
607
+ contentSha256: string;
608
+ assetId: string;
609
+ sizeBytes: number;
610
+ mediaType?: string | null | undefined;
611
+ }[];
612
+ }, {
613
+ namespace: string;
614
+ version: string;
615
+ bundleSlug: string;
616
+ assets: {
617
+ assetType: string;
618
+ logicalPath: string;
619
+ contentSha256: string;
620
+ assetId: string;
621
+ sizeBytes: number;
622
+ mediaType?: string | null | undefined;
623
+ }[];
624
+ }>;
625
+ declare const BundleVersionDetailOutputSchema: z.ZodObject<{
626
+ id: z.ZodString;
627
+ bundleId: z.ZodString;
628
+ version: z.ZodString;
629
+ state: z.ZodEnum<["published", "yanked"]>;
630
+ ociRef: z.ZodOptional<z.ZodNullable<z.ZodString>>;
631
+ ociDigest: z.ZodOptional<z.ZodNullable<z.ZodString>>;
632
+ manifest: z.ZodOptional<z.ZodNullable<z.ZodObject<{
633
+ namespace: z.ZodString;
634
+ bundleSlug: z.ZodString;
635
+ version: z.ZodString;
636
+ assets: z.ZodArray<z.ZodObject<{
637
+ assetId: z.ZodString;
638
+ logicalPath: z.ZodString;
639
+ assetType: z.ZodString;
640
+ contentSha256: z.ZodString;
641
+ sizeBytes: z.ZodNumber;
642
+ mediaType: z.ZodOptional<z.ZodNullable<z.ZodString>>;
643
+ }, "strip", z.ZodTypeAny, {
644
+ assetType: string;
645
+ logicalPath: string;
646
+ contentSha256: string;
647
+ assetId: string;
648
+ sizeBytes: number;
649
+ mediaType?: string | null | undefined;
650
+ }, {
651
+ assetType: string;
652
+ logicalPath: string;
653
+ contentSha256: string;
654
+ assetId: string;
655
+ sizeBytes: number;
656
+ mediaType?: string | null | undefined;
657
+ }>, "many">;
658
+ }, "strip", z.ZodTypeAny, {
659
+ namespace: string;
660
+ version: string;
661
+ bundleSlug: string;
662
+ assets: {
663
+ assetType: string;
664
+ logicalPath: string;
665
+ contentSha256: string;
666
+ assetId: string;
667
+ sizeBytes: number;
668
+ mediaType?: string | null | undefined;
669
+ }[];
670
+ }, {
671
+ namespace: string;
672
+ version: string;
673
+ bundleSlug: string;
674
+ assets: {
675
+ assetType: string;
676
+ logicalPath: string;
677
+ contentSha256: string;
678
+ assetId: string;
679
+ sizeBytes: number;
680
+ mediaType?: string | null | undefined;
681
+ }[];
682
+ }>>>;
683
+ publishedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
684
+ yankedBy: z.ZodOptional<z.ZodNullable<z.ZodString>>;
685
+ yankedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
686
+ yankReason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
687
+ createdAt: z.ZodString;
688
+ }, "strip", z.ZodTypeAny, {
689
+ version: string;
690
+ id: string;
691
+ bundleId: string;
692
+ createdAt: string;
693
+ state: "published" | "yanked";
694
+ ociRef?: string | null | undefined;
695
+ ociDigest?: string | null | undefined;
696
+ manifest?: {
697
+ namespace: string;
698
+ version: string;
699
+ bundleSlug: string;
700
+ assets: {
701
+ assetType: string;
702
+ logicalPath: string;
703
+ contentSha256: string;
704
+ assetId: string;
705
+ sizeBytes: number;
706
+ mediaType?: string | null | undefined;
707
+ }[];
708
+ } | null | undefined;
709
+ publishedBy?: string | null | undefined;
710
+ yankedBy?: string | null | undefined;
711
+ yankedAt?: string | null | undefined;
712
+ yankReason?: string | null | undefined;
713
+ }, {
714
+ version: string;
715
+ id: string;
716
+ bundleId: string;
717
+ createdAt: string;
718
+ state: "published" | "yanked";
719
+ ociRef?: string | null | undefined;
720
+ ociDigest?: string | null | undefined;
721
+ manifest?: {
722
+ namespace: string;
723
+ version: string;
724
+ bundleSlug: string;
725
+ assets: {
726
+ assetType: string;
727
+ logicalPath: string;
728
+ contentSha256: string;
729
+ assetId: string;
730
+ sizeBytes: number;
731
+ mediaType?: string | null | undefined;
732
+ }[];
733
+ } | null | undefined;
734
+ publishedBy?: string | null | undefined;
735
+ yankedBy?: string | null | undefined;
736
+ yankedAt?: string | null | undefined;
737
+ yankReason?: string | null | undefined;
738
+ }>;
739
+
740
+ /**
741
+ * Inferred TypeScript types from Zod schemas.
742
+ *
743
+ * Use these for type annotations — the Zod schemas are used at runtime.
744
+ */
745
+
746
+ type PaginationMeta = z.infer<typeof PaginationMetaSchema>;
747
+ interface Paginated<T> {
748
+ data: T[];
749
+ meta: PaginationMeta;
750
+ }
751
+ interface PaginateParams {
752
+ cursor?: string;
753
+ limit?: number;
754
+ }
755
+ type BundleOutput = z.infer<typeof BundleOutputSchema>;
756
+ type BundleDetailOutput = z.infer<typeof BundleDetailOutputSchema>;
757
+ type AssetSummaryOutput = z.infer<typeof AssetSummaryOutputSchema>;
758
+ type AssetDetailOutput = z.infer<typeof AssetDetailOutputSchema>;
759
+ type BundleVersionSummaryOutput = z.infer<typeof BundleVersionSummaryOutputSchema>;
760
+ type BundleVersionDetailOutput = z.infer<typeof BundleVersionDetailOutputSchema>;
761
+ type ManifestAssetOutput = z.infer<typeof ManifestAssetOutputSchema>;
762
+ type ManifestDetailOutput = z.infer<typeof ManifestDetailOutputSchema>;
763
+ type BundleResolveOutput = z.infer<typeof BundleResolveOutputSchema>;
764
+ type BundleLayerOutput = z.infer<typeof BundleLayerOutputSchema>;
765
+ type BundleManifestOutput = z.infer<typeof BundleManifestOutputSchema>;
766
+ /**
767
+ * @deprecated Use `FileHandle` instead.
768
+ */
769
+ interface LoadedAsset {
770
+ logicalPath: string;
771
+ assetType: string;
772
+ content: string;
773
+ sha256: string;
774
+ mediaType?: string | undefined;
775
+ }
776
+ /**
777
+ * @deprecated Use `Bundle` class instead.
778
+ */
779
+ interface LoadedBundle {
780
+ ref: string;
781
+ version: string;
782
+ assets: Map<string, LoadedAsset>;
783
+ getAsset(path: string): LoadedAsset | undefined;
784
+ getAssetsByType(type: string): LoadedAsset[];
785
+ }
786
+ /** @deprecated Use `Bundle` class instead. */
787
+ interface CachedBundle {
788
+ ref: string;
789
+ version: string;
790
+ cacheDir: string;
791
+ manifest: BundleResolveOutput;
792
+ }
793
+ interface VerifyResult {
794
+ ok: boolean;
795
+ errors: Array<{
796
+ path: string;
797
+ expected: string;
798
+ actual: string;
799
+ }>;
800
+ }
801
+ interface SelectionFilter {
802
+ skills?: string[];
803
+ prompts?: string[];
804
+ toolsets?: string[];
805
+ agentSpecs?: string[];
806
+ paths?: string[];
807
+ }
808
+
809
+ /**
810
+ * Selection — lazy filtered view over a Bundle.
811
+ */
812
+
813
+ declare class Selection {
814
+ private readonly _bundle;
815
+ private readonly _filter;
816
+ constructor(bundle: Bundle, filter: SelectionFilter);
817
+ /** The underlying bundle. */
818
+ get bundle(): Bundle;
819
+ files(): FileHandle[];
820
+ skills(): SkillHandle[];
821
+ prompts(): PromptHandle[];
822
+ toolsets(): ToolsetHandle[];
823
+ agentSpecs(): AgentSpecHandle[];
824
+ /** Write selected files to targetDir preserving logical paths. */
825
+ materialize(targetDir: string): Promise<string[]>;
826
+ exportClaudePlugin(opts: {
827
+ targetDir: string;
828
+ name?: string;
829
+ description?: string;
830
+ }): Promise<string>;
831
+ installClaudeSkills(dir: string, opts?: {
832
+ prefix?: string;
833
+ }): Promise<string[]>;
834
+ installVSCodeSkills(dir: string, opts?: {
835
+ subdir?: string;
836
+ }): Promise<string[]>;
837
+ }
838
+
839
+ /**
840
+ * Bundle — high-level object returned by pull().
841
+ *
842
+ * Groups files into domain handles (skills, prompts, toolsets, agent specs)
843
+ * by reading assetType + parsing logical path conventions from manifest layers.
844
+ */
845
+
846
+ declare class Bundle {
847
+ readonly ref: BundleRef;
848
+ readonly version: string;
849
+ readonly metadata: BundleResolveOutput;
850
+ private readonly _files;
851
+ private readonly _skills;
852
+ private readonly _prompts;
853
+ private readonly _toolsets;
854
+ private readonly _agentSpecs;
855
+ constructor(metadata: BundleResolveOutput, contents: Map<string, Buffer>);
856
+ file(path: string): FileHandle | undefined;
857
+ files(): FileHandle[];
858
+ skills(): SkillHandle[];
859
+ skill(name: string): SkillHandle;
860
+ prompts(): PromptHandle[];
861
+ prompt(name: string): PromptHandle;
862
+ toolsets(): ToolsetHandle[];
863
+ toolset(name: string): ToolsetHandle;
864
+ agentSpecs(): AgentSpecHandle[];
865
+ agentSpec(name: string): AgentSpecHandle;
866
+ select(filter: SelectionFilter): Selection;
867
+ verify(): VerifyResult;
868
+ writeLockfile(path: string): Promise<void>;
869
+ exportClaudePlugin(opts: {
870
+ targetDir: string;
871
+ name?: string;
872
+ description?: string;
873
+ }): Promise<string>;
874
+ installClaudeSkills(dir: string, opts?: {
875
+ prefix?: string;
876
+ }): Promise<string[]>;
877
+ installVSCodeSkills(dir: string, opts?: {
878
+ subdir?: string;
879
+ }): Promise<string[]>;
880
+ /** @deprecated Use `file(path)` instead. */
881
+ getAsset(path: string): LoadedAsset | undefined;
882
+ /** @deprecated Use `files().filter(...)` instead. */
883
+ getAssetsByType(type: string): LoadedAsset[];
884
+ }
885
+
886
+ /**
887
+ * Client configuration with env-var resolution.
888
+ */
889
+ interface ClientConfig {
890
+ /** Base URL for the Musher API. Default: https://api.musher.dev */
891
+ baseUrl?: string;
892
+ /** API key authentication. */
893
+ apiKey?: string;
894
+ /** Override cache directory path. */
895
+ cacheDir?: string;
896
+ /** Override config directory path. */
897
+ configDir?: string;
898
+ /** Manifest cache TTL in seconds. Default: 86400 (24 hours) */
899
+ manifestTtlSeconds?: number;
900
+ /** Ref cache TTL in seconds. Default: 300 (5 minutes) */
901
+ refTtlSeconds?: number;
902
+ /** Request timeout in milliseconds. Default: 30000 */
903
+ timeout?: number;
904
+ /** Number of retries on transient failures. Default: 2 */
905
+ retries?: number;
906
+ }
907
+ interface ResolvedConfig {
908
+ baseUrl: string;
909
+ apiKey: string | undefined;
910
+ cacheDir: string;
911
+ configDir: string;
912
+ manifestTtlSeconds: number;
913
+ refTtlSeconds: number;
914
+ timeout: number;
915
+ retries: number;
916
+ }
917
+
918
+ /**
919
+ * HTTP transport layer — fetch-based with auth, retry, error mapping, and Zod validation.
920
+ */
921
+
922
+ declare class HttpTransport {
923
+ private readonly config;
924
+ constructor(config: ResolvedConfig);
925
+ request<T>(method: string, path: string, schema: z.ZodType<T>, options?: {
926
+ body?: unknown;
927
+ params?: Record<string, string | number | boolean | undefined> | undefined;
928
+ }): Promise<T>;
929
+ private buildUrl;
930
+ private buildHeaders;
931
+ private fetchWithTimeout;
932
+ private mapError;
933
+ private parse;
934
+ private backoff;
935
+ }
936
+
937
+ /**
938
+ * Bundles resource — namespace-scoped bundle operations.
939
+ */
940
+
941
+ declare class BundlesResource {
942
+ private readonly http;
943
+ constructor(http: HttpTransport);
944
+ get(namespace: string, bundle: string): Promise<BundleDetailOutput>;
945
+ list(namespace: string, params?: PaginateParams): Promise<Paginated<BundleOutput>>;
946
+ resolve(namespace: string, bundle: string, version?: string, digest?: string): Promise<BundleResolveOutput>;
947
+ listVersions(namespace: string, bundle: string, params?: PaginateParams): Promise<Paginated<BundleVersionSummaryOutput>>;
948
+ getVersion(namespace: string, bundle: string, version: string): Promise<BundleVersionDetailOutput>;
949
+ listAssets(namespace: string, bundle: string, params?: PaginateParams): Promise<Paginated<AssetSummaryOutput>>;
950
+ getAsset(namespace: string, bundle: string, assetId: string, version: string): Promise<AssetDetailOutput>;
951
+ }
952
+
953
+ /**
954
+ * MusherClient — main entry point for the SDK.
955
+ *
956
+ * Composes HTTP transport, resource classes, and disk cache
957
+ * into a single facade with high-level pull/load convenience methods.
958
+ */
959
+
960
+ declare class MusherClient {
961
+ readonly bundles: BundlesResource;
962
+ private readonly _cache;
963
+ private readonly _http;
964
+ constructor(config?: ClientConfig);
965
+ /**
966
+ * Resolve a bundle via the API, download all assets, and write to disk cache.
967
+ * Returns a Bundle object.
968
+ *
969
+ * @param ref - Bundle reference (e.g. "namespace/slug", "namespace/slug:version").
970
+ * @param version - Optional semver constraint. Defaults to latest.
971
+ */
972
+ pull(ref: string, version?: string): Promise<Bundle>;
973
+ /**
974
+ * Resolve bundle metadata without downloading content.
975
+ * Checks the manifest cache (with TTL) before calling the API.
976
+ *
977
+ * @param ref - Bundle reference.
978
+ * @param version - Optional semver constraint.
979
+ */
980
+ resolve(ref: string, version?: string): Promise<BundleResolveOutput>;
981
+ /**
982
+ * @deprecated Use `pull()` instead. This method will be removed in a future version.
983
+ *
984
+ * Load a bundle into memory. Checks cache first (TTL-aware), pulls if stale.
985
+ */
986
+ load(ref: string, version?: string): Promise<Bundle>;
987
+ /** Cache management utilities. */
988
+ readonly cache: {
989
+ /** Remove expired cache entries and garbage-collect unreferenced blobs. */
990
+ clean: () => Promise<void>;
991
+ /** Remove all cached data. */
992
+ purge: () => Promise<void>;
993
+ };
994
+ }
995
+
996
+ /**
997
+ * Platform-aware directory resolution for the Musher SDK.
998
+ *
999
+ * Follows the shared cross-platform storage spec:
1000
+ * - Linux: XDG Base Directory spec
1001
+ * - macOS: ~/Library/{Caches,Application Support}/musher
1002
+ * - Windows: %LOCALAPPDATA%\musher\{cache,config,data,state}
1003
+ *
1004
+ * Resolution order per directory:
1005
+ * 1. MUSHER_<TYPE>_HOME (e.g. MUSHER_CACHE_HOME)
1006
+ * 2. MUSHER_HOME/<type> (umbrella override)
1007
+ * 3. Platform default
1008
+ *
1009
+ * Relative override/XDG paths are rejected (per XDG spec).
1010
+ */
1011
+ interface MusherDirs {
1012
+ cache: string;
1013
+ config: string;
1014
+ data: string;
1015
+ state: string;
1016
+ runtime: string;
1017
+ }
1018
+ /** Resolve all Musher directory paths for the current platform. */
1019
+ declare function resolveMusherDirs(): MusherDirs;
1020
+
1021
+ /**
1022
+ * Claude Code adapter — export plugin dirs and install skills to .claude/skills/.
1023
+ */
1024
+
1025
+ /**
1026
+ * Export a Claude Code plugin directory structure from a Bundle or Selection.
1027
+ *
1028
+ * Produces the layout expected by Claude Code's plugin system:
1029
+ *
1030
+ * <pluginDir>/.claude-plugin/plugin.json — plugin metadata
1031
+ * <pluginDir>/skills/<name>/SKILL.md — skill content
1032
+ *
1033
+ * Returns the absolute path of the created plugin directory.
1034
+ */
1035
+ declare function exportClaudePlugin(source: Bundle | Selection, opts: {
1036
+ targetDir: string;
1037
+ name?: string;
1038
+ description?: string;
1039
+ }): Promise<string>;
1040
+ /**
1041
+ * Install skills from a bundle into a .claude/skills/ directory.
1042
+ * Returns the list of written absolute paths.
1043
+ */
1044
+ declare function installClaudeSkills(bundle: Bundle | Selection, dir: string, opts?: {
1045
+ prefix?: string;
1046
+ }): Promise<string[]>;
1047
+
1048
+ /**
1049
+ * VS Code / IDE adapter — install skill directories.
1050
+ */
1051
+
1052
+ /**
1053
+ * Install skills from a bundle into an IDE skill tree directory.
1054
+ * Default subdir is ".agents/skills".
1055
+ * Mode is always "copy" (real files, not symlinks).
1056
+ * Returns list of written absolute paths.
1057
+ */
1058
+ declare function installVSCodeSkills(source: Bundle | Selection, dir: string, opts?: {
1059
+ subdir?: string;
1060
+ }): Promise<string[]>;
1061
+
1062
+ /**
1063
+ * Module-level convenience functions matching the Python SDK.
1064
+ */
1065
+
1066
+ /** Configure the default client used by module-level convenience functions. */
1067
+ declare function configure(config: ClientConfig): void;
1068
+ /** Get or create the default MusherClient. */
1069
+ declare function getClient(): MusherClient;
1070
+ /** Pull a bundle (resolve + download + cache). */
1071
+ declare function pull(ref: string, version?: string): Promise<Bundle>;
1072
+ /** Resolve bundle metadata without downloading content. */
1073
+ declare function resolve(ref: string, version?: string): Promise<BundleResolveOutput>;
1074
+
1075
+ /**
1076
+ * Error hierarchy for the Musher SDK.
1077
+ *
1078
+ * All errors extend MushError so consumers can catch the base class.
1079
+ */
1080
+ declare class MushError extends Error {
1081
+ constructor(message: string, options?: ErrorOptions);
1082
+ }
1083
+ interface ProblemDetail {
1084
+ type: string;
1085
+ title: string;
1086
+ status: number;
1087
+ detail: string;
1088
+ instance?: string | undefined;
1089
+ traceId?: string | undefined;
1090
+ }
1091
+ declare class ApiError extends MushError {
1092
+ readonly status: number;
1093
+ readonly problem: ProblemDetail;
1094
+ constructor(problem: ProblemDetail, options?: ErrorOptions);
1095
+ }
1096
+ declare class NotFoundError extends ApiError {
1097
+ constructor(problem: ProblemDetail, options?: ErrorOptions);
1098
+ }
1099
+ declare class AuthenticationError extends ApiError {
1100
+ constructor(problem: ProblemDetail, options?: ErrorOptions);
1101
+ }
1102
+ declare class ForbiddenError extends ApiError {
1103
+ constructor(problem: ProblemDetail, options?: ErrorOptions);
1104
+ }
1105
+ declare class ValidationError extends ApiError {
1106
+ readonly errors?: Array<{
1107
+ loc: string[];
1108
+ msg: string;
1109
+ type: string;
1110
+ }> | undefined;
1111
+ constructor(problem: ProblemDetail & {
1112
+ errors?: Array<{
1113
+ loc: string[];
1114
+ msg: string;
1115
+ type: string;
1116
+ }>;
1117
+ }, options?: ErrorOptions);
1118
+ }
1119
+ declare class RateLimitError extends ApiError {
1120
+ readonly retryAfter: number | undefined;
1121
+ constructor(problem: ProblemDetail, retryAfter?: number, options?: ErrorOptions);
1122
+ }
1123
+ declare class NetworkError extends MushError {
1124
+ constructor(message: string, options?: ErrorOptions);
1125
+ }
1126
+ declare class TimeoutError extends NetworkError {
1127
+ constructor(message: string, options?: ErrorOptions);
1128
+ }
1129
+ declare class CacheError extends MushError {
1130
+ constructor(message: string, options?: ErrorOptions);
1131
+ }
1132
+ declare class IntegrityError extends CacheError {
1133
+ readonly expected: string;
1134
+ readonly actual: string;
1135
+ constructor(expected: string, actual: string, options?: ErrorOptions);
1136
+ }
1137
+ declare class SchemaError extends MushError {
1138
+ constructor(message: string, options?: ErrorOptions);
1139
+ }
1140
+
1141
+ export { AgentSpecHandle, ApiError, type AssetDetailOutput, AssetDetailOutputSchema, type AssetSummaryOutput, AssetSummaryOutputSchema, AssetType, AuthenticationError, Bundle, type BundleDetailOutput, BundleDetailOutputSchema, type BundleLayerOutput, BundleLayerOutputSchema, type BundleManifestOutput, BundleManifestOutputSchema, type BundleOutput, BundleOutputSchema, BundleRef, type BundleResolveOutput, BundleResolveOutputSchema, BundleSourceType, type BundleVersionDetailOutput, BundleVersionDetailOutputSchema, BundleVersionState, type BundleVersionSummaryOutput, BundleVersionSummaryOutputSchema, BundleVisibility, CacheError, type CachedBundle, type ClientConfig, FileHandle, ForbiddenError, type FrontmatterResult, IntegrityError, type LoadedAsset, type LoadedBundle, type ManifestAssetOutput, ManifestAssetOutputSchema, type ManifestDetailOutput, ManifestDetailOutputSchema, MushError, MusherClient, type MusherDirs, NetworkError, NotFoundError, type OpenAIInlineSkill, type OpenAILocalSkill, type PaginateParams, type Paginated, type PaginationMeta, PaginationMetaSchema, type ProblemDetail, PromptHandle, RateLimitError, SchemaError, Selection, type SelectionFilter, SkillHandle, TimeoutError, ToolsetHandle, ValidationError, type VerifyResult, configure, exportClaudePlugin, exportOpenAIInlineSkill, exportOpenAILocalSkill, extractDescription, getClient, installClaudeSkills, installVSCodeSkills, paginatedSchema, parseFrontmatter, pull, resolve, resolveMusherDirs };