@shisho/plugin-types 0.0.8 → 0.0.10

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/host-api.d.ts CHANGED
@@ -112,8 +112,8 @@ export interface ShishoXML {
112
112
  ): XMLElement[];
113
113
  }
114
114
 
115
- /** Result from shisho.ffmpeg.run(). */
116
- export interface FFmpegResult {
115
+ /** Result from shisho.ffmpeg.transcode(). */
116
+ export interface TranscodeResult {
117
117
  /** Process exit code (0 = success). */
118
118
  exitCode: number;
119
119
  /** Standard output. */
@@ -122,10 +122,147 @@ export interface FFmpegResult {
122
122
  stderr: string;
123
123
  }
124
124
 
125
+ /** Result from shisho.ffmpeg.probe(). */
126
+ export interface ProbeResult {
127
+ format: ProbeFormat;
128
+ streams: ProbeStream[];
129
+ chapters: ProbeChapter[];
130
+ /** Standard error output (for debugging). */
131
+ stderr: string;
132
+ /** JSON parse error message if ffprobe output could not be parsed. Empty string if parsing succeeded. */
133
+ parseError: string;
134
+ }
135
+
136
+ /** Format information from ffprobe. */
137
+ export interface ProbeFormat {
138
+ filename: string;
139
+ nb_streams: number;
140
+ nb_programs: number;
141
+ format_name: string;
142
+ format_long_name: string;
143
+ start_time: string;
144
+ duration: string;
145
+ size: string;
146
+ bit_rate: string;
147
+ probe_score: number;
148
+ tags?: Record<string, string>;
149
+ }
150
+
151
+ /** Stream information from ffprobe. */
152
+ export interface ProbeStream {
153
+ index: number;
154
+ codec_name?: string;
155
+ codec_long_name?: string;
156
+ codec_type: "video" | "audio" | "subtitle" | "data" | "attachment";
157
+ codec_tag_string?: string;
158
+ codec_tag?: string;
159
+
160
+ // Video-specific
161
+ width?: number;
162
+ height?: number;
163
+ coded_width?: number;
164
+ coded_height?: number;
165
+ closed_captions?: number;
166
+ has_b_frames?: number;
167
+ sample_aspect_ratio?: string;
168
+ display_aspect_ratio?: string;
169
+ pix_fmt?: string;
170
+ level?: number;
171
+ color_range?: string;
172
+ color_space?: string;
173
+ color_transfer?: string;
174
+ color_primaries?: string;
175
+ chroma_location?: string;
176
+ field_order?: string;
177
+ refs?: number;
178
+
179
+ // Audio-specific
180
+ sample_fmt?: string;
181
+ sample_rate?: string;
182
+ channels?: number;
183
+ channel_layout?: string;
184
+ bits_per_sample?: number;
185
+
186
+ // Common (optional since not all stream types have these)
187
+ r_frame_rate?: string;
188
+ avg_frame_rate?: string;
189
+ time_base?: string;
190
+ start_pts?: number;
191
+ start_time?: string;
192
+ duration_ts?: number;
193
+ duration?: string;
194
+ bit_rate?: string;
195
+ bits_per_raw_sample?: string;
196
+ nb_frames?: string;
197
+ disposition?: ProbeDisposition;
198
+ tags?: Record<string, string>;
199
+ }
200
+
201
+ /** Stream disposition flags from ffprobe. */
202
+ export interface ProbeDisposition {
203
+ default: number;
204
+ dub: number;
205
+ original: number;
206
+ comment: number;
207
+ lyrics: number;
208
+ karaoke: number;
209
+ forced: number;
210
+ hearing_impaired: number;
211
+ visual_impaired: number;
212
+ clean_effects: number;
213
+ attached_pic: number;
214
+ timed_thumbnails: number;
215
+ }
216
+
217
+ /** Chapter information from ffprobe. */
218
+ export interface ProbeChapter {
219
+ id: number;
220
+ time_base: string;
221
+ start: number;
222
+ start_time: string;
223
+ end: number;
224
+ end_time: string;
225
+ tags?: Record<string, string>;
226
+ }
227
+
228
+ /** Result from shisho.ffmpeg.version(). */
229
+ export interface VersionResult {
230
+ /** FFmpeg version string (e.g., "7.0"). */
231
+ version: string;
232
+ /** Build configuration flags (e.g., ["--enable-libx264", "--enable-gpl"]). */
233
+ configuration: string[];
234
+ /** Library versions (e.g., { libavcodec: "60.31.102", ... }). */
235
+ libraries: Record<string, string>;
236
+ }
237
+
125
238
  /** FFmpeg subprocess execution. */
126
239
  export interface ShishoFFmpeg {
127
- /** Run FFmpeg with the given arguments. Requires ffmpegAccess capability. */
128
- run(args: string[]): FFmpegResult;
240
+ /** Transcode files with FFmpeg. Requires ffmpegAccess capability. */
241
+ transcode(args: string[]): TranscodeResult;
242
+ /** Probe file metadata with ffprobe. Returns parsed JSON. Requires ffmpegAccess capability. */
243
+ probe(args: string[]): ProbeResult;
244
+ /** Get FFmpeg version and configuration. Requires ffmpegAccess capability. */
245
+ version(): VersionResult;
246
+ }
247
+
248
+ /** Result from shisho.shell.exec(). */
249
+ export interface ExecResult {
250
+ /** Process exit code (0 = success). */
251
+ exitCode: number;
252
+ /** Standard output. */
253
+ stdout: string;
254
+ /** Standard error. */
255
+ stderr: string;
256
+ }
257
+
258
+ /** Shell command execution (with allowlist). */
259
+ export interface ShishoShell {
260
+ /**
261
+ * Execute an allowed command with arguments.
262
+ * Command must be declared in manifest shellAccess.commands.
263
+ * Uses exec directly (no shell) to prevent injection.
264
+ */
265
+ exec(command: string, args: string[]): ExecResult;
129
266
  }
130
267
 
131
268
  /** Top-level host API object available as the global `shisho` variable. */
@@ -137,4 +274,5 @@ export interface ShishoHostAPI {
137
274
  archive: ShishoArchive;
138
275
  xml: ShishoXML;
139
276
  ffmpeg: ShishoFFmpeg;
277
+ shell: ShishoShell;
140
278
  }
package/manifest.d.ts CHANGED
@@ -29,11 +29,34 @@ export interface OutputGeneratorCap {
29
29
  sourceTypes: string[];
30
30
  }
31
31
 
32
+ /** Valid metadata field names for enricher declarations. */
33
+ export type MetadataField =
34
+ | "title"
35
+ | "subtitle"
36
+ | "authors"
37
+ | "narrators"
38
+ | "series"
39
+ | "seriesNumber"
40
+ | "genres"
41
+ | "tags"
42
+ | "description"
43
+ | "publisher"
44
+ | "imprint"
45
+ | "url"
46
+ | "releaseDate"
47
+ | "cover"
48
+ | "identifiers";
49
+
32
50
  /** Metadata enricher capability declaration. */
33
51
  export interface MetadataEnricherCap {
34
52
  description?: string;
35
53
  /** File types this enricher applies to (e.g., ["epub", "cbz"]). */
36
54
  fileTypes?: string[];
55
+ /**
56
+ * Metadata fields this enricher may set.
57
+ * Required for enrichers - if omitted, the enricher hook is disabled.
58
+ */
59
+ fields: MetadataField[];
37
60
  }
38
61
 
39
62
  /** Custom identifier type declaration. */
@@ -67,6 +90,13 @@ export interface FFmpegAccessCap {
67
90
  description?: string;
68
91
  }
69
92
 
93
+ /** Shell access capability declaration. */
94
+ export interface ShellAccessCap {
95
+ description?: string;
96
+ /** Allowed commands (e.g., ["convert", "magick", "identify"]). */
97
+ commands: string[];
98
+ }
99
+
70
100
  /** All plugin capabilities. */
71
101
  export interface Capabilities {
72
102
  inputConverter?: InputConverterCap;
@@ -77,6 +107,7 @@ export interface Capabilities {
77
107
  httpAccess?: HTTPAccessCap;
78
108
  fileAccess?: FileAccessCap;
79
109
  ffmpegAccess?: FFmpegAccessCap;
110
+ shellAccess?: ShellAccessCap;
80
111
  }
81
112
 
82
113
  /** Option for select-type config fields. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shisho/plugin-types",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "TypeScript type definitions for Shisho plugin development",
5
5
  "homepage": "https://github.com/shishobooks/shisho/blob/master/packages/plugin-types/README.md",
6
6
  "types": "index.d.ts",