drone-path 1.1.1 → 1.2.0
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/dist/archive-cli.js +69 -1
- package/dist/archive-query-cli.js +95 -0
- package/dist/extract-frame-cli.js +6 -1
- package/dist/mcp-tools.js +117 -2
- package/package.json +12 -8
package/dist/archive-cli.js
CHANGED
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
|
-
import { Command } from 'commander';
|
|
2
|
+
import { Command, Option } from 'commander';
|
|
3
3
|
import { scanArchive } from 'drone-path-archive/indexed-scan';
|
|
4
4
|
import { archiveDbPath } from 'drone-path-archive/paths';
|
|
5
|
+
import { analyzeArchiveSharpness } from 'drone-path-archive/sharpness';
|
|
5
6
|
import { requireFfmpegTools } from 'drone-path-core/ffmpeg';
|
|
6
7
|
import { resolveFfmpegTools } from 'drone-path-core/ffmpeg-tools';
|
|
7
8
|
import { addArchiveQueries, archiveCommand } from './archive-query-cli.js';
|
|
9
|
+
function positiveInt(text) {
|
|
10
|
+
const trimmed = text.trim();
|
|
11
|
+
if (!/^\d+$/u.test(trimmed))
|
|
12
|
+
throw new Error('expected a positive integer');
|
|
13
|
+
const value = Number(trimmed);
|
|
14
|
+
if (!Number.isSafeInteger(value) || value < 1)
|
|
15
|
+
throw new Error('expected a positive integer');
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
function unitRatio(text) {
|
|
19
|
+
const value = Number(text.trim());
|
|
20
|
+
if (!Number.isFinite(value) || value < 0 || value > 1) {
|
|
21
|
+
throw new Error('expected a number between 0 and 1');
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
}
|
|
8
25
|
export async function runArchive(argv) {
|
|
9
26
|
const program = new Command('drone-path archive')
|
|
10
27
|
.description('Inspect a library of drone recordings.')
|
|
@@ -45,6 +62,57 @@ export async function runArchive(argv) {
|
|
|
45
62
|
process.off('SIGINT', interrupt);
|
|
46
63
|
}
|
|
47
64
|
});
|
|
65
|
+
const analyzeSharpness = archiveCommand(program.command('analyze-sharpness'))
|
|
66
|
+
.description('Analyze and store clip-wide luminance sharpness timelines in the archive.')
|
|
67
|
+
.argument('<video>', 'recording video file')
|
|
68
|
+
.addOption(new Option('--mode <mode>', 'sampling mode: sampled (1/sec) or every-frame')
|
|
69
|
+
.choices(['sampled', 'every-frame'])
|
|
70
|
+
.default('sampled'))
|
|
71
|
+
.option('--analysis-width <px>', 'width in pixels for luminance analysis', positiveInt)
|
|
72
|
+
.option('--min-edge-coverage <ratio>', 'minimum edge coverage ratio in [0, 1]', unitRatio)
|
|
73
|
+
.option('--force', 're-run analysis even if a matching cached run exists')
|
|
74
|
+
.option('--ffmpeg <path>', 'path to the ffmpeg executable')
|
|
75
|
+
.option('--ffprobe <path>', 'path to the ffprobe executable')
|
|
76
|
+
.option('--json', 'write the analysis summary as JSON to stdout')
|
|
77
|
+
.action(async (video) => {
|
|
78
|
+
const opts = analyzeSharpness.opts();
|
|
79
|
+
const controller = new AbortController();
|
|
80
|
+
const interrupt = () => controller.abort(new Error('sharpness analysis canceled'));
|
|
81
|
+
process.on('SIGINT', interrupt);
|
|
82
|
+
try {
|
|
83
|
+
const result = await analyzeArchiveSharpness(archiveDbPath(opts.archiveDb), video, {
|
|
84
|
+
mode: opts.mode,
|
|
85
|
+
analysisWidth: opts.analysisWidth,
|
|
86
|
+
minEdgeCoverage: opts.minEdgeCoverage,
|
|
87
|
+
force: opts.force,
|
|
88
|
+
signal: controller.signal,
|
|
89
|
+
getTools: async () => {
|
|
90
|
+
const tools = resolveFfmpegTools({
|
|
91
|
+
ffmpeg: opts.ffmpeg ?? null,
|
|
92
|
+
ffprobe: opts.ffprobe ?? null,
|
|
93
|
+
});
|
|
94
|
+
await requireFfmpegTools(tools, controller.signal);
|
|
95
|
+
return tools;
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
if (opts.json) {
|
|
99
|
+
process.stdout.write(JSON.stringify(result) + '\n');
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
const state = result.cached ? 'cached' : 'fresh';
|
|
103
|
+
process.stdout.write(`${result.clip.path}: ${result.run.sampleCount} sample(s) ` +
|
|
104
|
+
`(mode ${result.run.settings.mode}, stride ${result.run.settings.stride}, ${state})\n`);
|
|
105
|
+
}
|
|
106
|
+
process.stderr.write(`[drone-path] ${result.cached ? 'reused' : 'stored'} ${result.run.sampleCount} sharpness sample(s) for ${result.clip.path}\n`);
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
controller.signal.throwIfAborted();
|
|
110
|
+
throw error;
|
|
111
|
+
}
|
|
112
|
+
finally {
|
|
113
|
+
process.off('SIGINT', interrupt);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
48
116
|
addArchiveQueries(program);
|
|
49
117
|
await program.parseAsync(argv, { from: 'user' });
|
|
50
118
|
}
|
|
@@ -2,6 +2,7 @@ import { Option } from 'commander';
|
|
|
2
2
|
import { exportArchiveMap, exportArchiveMarkers, exportArchiveTracks } from 'drone-path-archive/export';
|
|
3
3
|
import { archiveDbPath } from 'drone-path-archive/paths';
|
|
4
4
|
import { DEFAULT_RADIUS_M, listArchive, listArchiveFlights, listArchiveSegments, nearArchive, parseDateBound } from 'drone-path-archive/query';
|
|
5
|
+
import { DEFAULT_SHARPNESS_QUERY_LIMIT, MAX_SHARPNESS_QUERY_LIMIT, exportArchiveSharpnessNdjson, getArchiveSharpness, } from 'drone-path-archive/sharpness';
|
|
5
6
|
import { SHOT_TYPES } from 'drone-path-core/shot-segmentation';
|
|
6
7
|
function decimal(text) {
|
|
7
8
|
const value = text.trim();
|
|
@@ -25,6 +26,33 @@ function smoothnessScore(text) {
|
|
|
25
26
|
}
|
|
26
27
|
return value;
|
|
27
28
|
}
|
|
29
|
+
function nonNegativeSeconds(text) {
|
|
30
|
+
const value = decimal(text);
|
|
31
|
+
if (!Number.isFinite(value) || value < 0) {
|
|
32
|
+
throw new Error('expected a non-negative timestamp in seconds');
|
|
33
|
+
}
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
function boundedLimit(text) {
|
|
37
|
+
const trimmed = text.trim();
|
|
38
|
+
if (!/^\d+$/u.test(trimmed)) {
|
|
39
|
+
throw new Error(`expected an integer limit between 1 and ${MAX_SHARPNESS_QUERY_LIMIT}`);
|
|
40
|
+
}
|
|
41
|
+
const value = Number(trimmed);
|
|
42
|
+
if (!Number.isSafeInteger(value) || value < 1 || value > MAX_SHARPNESS_QUERY_LIMIT) {
|
|
43
|
+
throw new Error(`expected an integer limit between 1 and ${MAX_SHARPNESS_QUERY_LIMIT}`);
|
|
44
|
+
}
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
function nonNegativeInt(text) {
|
|
48
|
+
const trimmed = text.trim();
|
|
49
|
+
if (!/^\d+$/u.test(trimmed))
|
|
50
|
+
throw new Error('expected a non-negative integer');
|
|
51
|
+
const value = Number(trimmed);
|
|
52
|
+
if (!Number.isSafeInteger(value) || value < 0)
|
|
53
|
+
throw new Error('expected a non-negative integer');
|
|
54
|
+
return value;
|
|
55
|
+
}
|
|
28
56
|
function point(text) {
|
|
29
57
|
const [lat, lon, extra] = text.split(',').map(decimal);
|
|
30
58
|
if (!(Math.abs(lat) <= 90 && Math.abs(lon) <= 180) || extra !== undefined) {
|
|
@@ -166,4 +194,71 @@ export function addArchiveQueries(program) {
|
|
|
166
194
|
filters: listOptions(options),
|
|
167
195
|
});
|
|
168
196
|
});
|
|
197
|
+
archiveCommand(program.command('sharpness'))
|
|
198
|
+
.description('Query stored sharpness timelines for an indexed recording (works offline).')
|
|
199
|
+
.argument('<video>', 'recording video file path')
|
|
200
|
+
.addOption(new Option('--mode <mode>', 'filter by analysis mode').choices(['sampled', 'every-frame']))
|
|
201
|
+
.option('--start-sec <sec>', 'earliest clip-relative timestamp in seconds, inclusive', nonNegativeSeconds)
|
|
202
|
+
.option('--end-sec <sec>', 'latest clip-relative timestamp in seconds, inclusive', nonNegativeSeconds)
|
|
203
|
+
.option('--limit <n>', `maximum samples to return (1-${MAX_SHARPNESS_QUERY_LIMIT}, default ${DEFAULT_SHARPNESS_QUERY_LIMIT})`, boundedLimit)
|
|
204
|
+
.option('--offset <n>', 'sample offset for pagination', nonNegativeInt)
|
|
205
|
+
.option('--ndjson', 'write the full matching timeline as NDJSON to stdout')
|
|
206
|
+
.option('--out <file>', 'write the full matching timeline as NDJSON to a file')
|
|
207
|
+
.option('--overwrite', 'allow overwriting an existing --out file')
|
|
208
|
+
.option('--json', 'write the bounded sharpness timeline JSON to stdout')
|
|
209
|
+
.action((video, options) => {
|
|
210
|
+
if (options.json && options.ndjson) {
|
|
211
|
+
throw new Error('specify either --json or --ndjson, not both');
|
|
212
|
+
}
|
|
213
|
+
const db = archiveDbPath(options.archiveDb);
|
|
214
|
+
if (options.ndjson || options.out !== undefined) {
|
|
215
|
+
const exported = exportArchiveSharpnessNdjson(db, video, {
|
|
216
|
+
mode: options.mode,
|
|
217
|
+
startSec: options.startSec,
|
|
218
|
+
endSec: options.endSec,
|
|
219
|
+
outPath: options.out,
|
|
220
|
+
overwrite: Boolean(options.overwrite),
|
|
221
|
+
});
|
|
222
|
+
if (options.ndjson) {
|
|
223
|
+
process.stdout.write(exported.ndjson);
|
|
224
|
+
}
|
|
225
|
+
else if (options.json) {
|
|
226
|
+
writeJson({
|
|
227
|
+
clipPath: exported.clipPath,
|
|
228
|
+
availability: exported.availability,
|
|
229
|
+
run: exported.run,
|
|
230
|
+
outPath: options.out,
|
|
231
|
+
format: 'ndjson',
|
|
232
|
+
count: exported.count,
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
process.stderr.write(`[drone-path] exported ${exported.count} sharpness sample(s) to ${options.out}\n`);
|
|
237
|
+
}
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
const timeline = getArchiveSharpness(db, video, {
|
|
241
|
+
mode: options.mode,
|
|
242
|
+
startSec: options.startSec,
|
|
243
|
+
endSec: options.endSec,
|
|
244
|
+
limit: options.limit,
|
|
245
|
+
offset: options.offset,
|
|
246
|
+
});
|
|
247
|
+
if (options.json) {
|
|
248
|
+
writeJson(timeline);
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
if (!timeline.analyzed || !timeline.run) {
|
|
252
|
+
process.stdout.write(`No sharpness analysis found for ${timeline.clipPath}\n`);
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
process.stdout.write(`${timeline.clipPath} [${timeline.availability}] (${timeline.run.settings.mode}, stride ${timeline.run.settings.stride}, ${timeline.totalSamples} matching sample(s))\n`);
|
|
256
|
+
for (const sample of timeline.samples) {
|
|
257
|
+
const score = sample.sharpnessScore === null ? 'null' : sample.sharpnessScore.toFixed(2);
|
|
258
|
+
process.stdout.write(` frame ${sample.frameIndex} (${sample.tSec.toFixed(3)}s): sharpness ${score}, edge coverage ${(sample.edgeCoverage * 100).toFixed(2)}%\n`);
|
|
259
|
+
}
|
|
260
|
+
if (timeline.truncated) {
|
|
261
|
+
process.stdout.write(` ... showing ${timeline.samples.length} of ${timeline.totalSamples} sample(s) (use --offset/--limit or --ndjson)\n`);
|
|
262
|
+
}
|
|
263
|
+
});
|
|
169
264
|
}
|
|
@@ -21,6 +21,7 @@ export async function runExtractFrame(argv) {
|
|
|
21
21
|
.requiredOption('--at <specs>', 'comma-separated timestamps (s) or frames (fN, frame:N)')
|
|
22
22
|
.option('--max-width <px>', 'maximum output width in pixels, preserving aspect ratio', parseMaxWidth)
|
|
23
23
|
.option('--out-dir <dir>', 'output directory (defaults to video directory)')
|
|
24
|
+
.option('--sharpness', 'analyze decoded luminance sharpness for each extracted frame')
|
|
24
25
|
.option('--ffmpeg <path>', 'path to the ffmpeg executable')
|
|
25
26
|
.option('--ffprobe <path>', 'path to the ffprobe executable')
|
|
26
27
|
.option('--json', 'write extracted keyframes JSON array to stdout');
|
|
@@ -41,6 +42,7 @@ export async function runExtractFrame(argv) {
|
|
|
41
42
|
at: requests,
|
|
42
43
|
maxWidth: opts.maxWidth,
|
|
43
44
|
outDir: opts.outDir,
|
|
45
|
+
sharpness: opts.sharpness,
|
|
44
46
|
tools,
|
|
45
47
|
signal: controller.signal,
|
|
46
48
|
});
|
|
@@ -49,7 +51,10 @@ export async function runExtractFrame(argv) {
|
|
|
49
51
|
return;
|
|
50
52
|
}
|
|
51
53
|
for (const kf of keyframes) {
|
|
52
|
-
|
|
54
|
+
const sharpnessSuffix = kf.sharpness
|
|
55
|
+
? `, sharpness ${kf.sharpness.sharpnessScore === null ? 'n/a' : kf.sharpness.sharpnessScore.toFixed(2)} (edge coverage ${(kf.sharpness.edgeCoverage * 100).toFixed(2)}%)`
|
|
56
|
+
: '';
|
|
57
|
+
process.stdout.write(`${kf.path} (frame ${kf.frame}, ${kf.tSec.toFixed(3)}s, ${kf.width}x${kf.height}${sharpnessSuffix})\n`);
|
|
53
58
|
}
|
|
54
59
|
process.stderr.write(`[drone-path] extracted ${keyframes.length} keyframe(s)\n`);
|
|
55
60
|
}
|
package/dist/mcp-tools.js
CHANGED
|
@@ -4,6 +4,7 @@ import { z } from 'zod';
|
|
|
4
4
|
import { exportArchiveMarkers } from 'drone-path-archive/export';
|
|
5
5
|
import { scanArchive } from 'drone-path-archive/indexed-scan';
|
|
6
6
|
import { DEFAULT_RADIUS_M, listArchive, listArchiveFlights, listArchiveSegments, nearArchive, parseDateBound, } from 'drone-path-archive/query';
|
|
7
|
+
import { MAX_SHARPNESS_QUERY_LIMIT, analyzeArchiveSharpness, exportArchiveSharpnessNdjson, getArchiveSharpness, } from 'drone-path-archive/sharpness';
|
|
7
8
|
import { errorMessage } from 'drone-path-core/errors';
|
|
8
9
|
import { probeVideo } from 'drone-path-core/ffmpeg';
|
|
9
10
|
import { extractKeyframes, parseKeyframeSpecs } from 'drone-path-core/keyframes';
|
|
@@ -16,7 +17,30 @@ import { CODEC_VALUES, ENCODER_PRESET_VALUES, MAP_STYLE_VALUES, QUALITY_VALUES,
|
|
|
16
17
|
import { resolveConfig } from 'drone-path-engine/configfile';
|
|
17
18
|
import { planOutputs } from 'drone-path-engine/pipeline';
|
|
18
19
|
import { collectRecordings } from 'drone-path-engine/recordings';
|
|
19
|
-
import { assertNotArchiveDb, assertPathInAllowedRoots, canonicalizePath, isPathInAllowedRoots, } from './mcp-paths.js';
|
|
20
|
+
import { assertNotArchiveDb, assertPathInAllowedRoots, canonicalizePath, isPathInAllowedRoots, isPathWithinRoot, } from './mcp-paths.js';
|
|
21
|
+
function toAllowedRootRelativePath(targetPath, allowedRoots) {
|
|
22
|
+
let canonical;
|
|
23
|
+
try {
|
|
24
|
+
canonical = canonicalizePath(targetPath);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return path.basename(targetPath);
|
|
28
|
+
}
|
|
29
|
+
for (const root of allowedRoots) {
|
|
30
|
+
if (isPathWithinRoot(canonical, root)) {
|
|
31
|
+
const rel = path.relative(root, canonical).split(path.sep).join('/');
|
|
32
|
+
return rel === '' ? path.basename(canonical) : rel;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return path.basename(canonical);
|
|
36
|
+
}
|
|
37
|
+
function sanitizeArchiveSharpnessRun(run, allowedRoots) {
|
|
38
|
+
const { clipKey: _omittedClipKey, ...rest } = run;
|
|
39
|
+
return {
|
|
40
|
+
...rest,
|
|
41
|
+
clipPath: toAllowedRootRelativePath(run.clipKey, allowedRoots),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
20
44
|
const DEFAULT_MAX_SAMPLES = 100;
|
|
21
45
|
export const MAX_MCP_RENDER_VIDEOS = 10;
|
|
22
46
|
function isMcpOverwriteAllowed() {
|
|
@@ -255,6 +279,95 @@ export function registerMcpTools(sdkServer, ctx) {
|
|
|
255
279
|
const segments = listArchiveSegments(ctx.archiveDb, toListFilters(args)).filter((seg) => isPathInAllowedRoots(seg.clip.path, ctx.allowedRoots));
|
|
256
280
|
return { count: segments.length, segments };
|
|
257
281
|
}));
|
|
282
|
+
sdkServer.registerTool('archive_analyze_sharpness', {
|
|
283
|
+
description: 'Run or reuse opt-in clip-wide luminance sharpness analysis for an allowed recording and store the timeline in the archive database.',
|
|
284
|
+
inputSchema: z
|
|
285
|
+
.object({
|
|
286
|
+
videoPath: z.string().min(1),
|
|
287
|
+
mode: z.enum(['sampled', 'every-frame']).optional(),
|
|
288
|
+
analysisWidth: z.number().int().min(1).optional(),
|
|
289
|
+
minEdgeCoverage: z.number().finite().min(0).max(1).optional(),
|
|
290
|
+
force: z.boolean().optional(),
|
|
291
|
+
})
|
|
292
|
+
.strict(),
|
|
293
|
+
}, wrap(async (args) => {
|
|
294
|
+
const videoPath = assertPathInAllowedRoots(args.videoPath, ctx.allowedRoots);
|
|
295
|
+
assertNotArchiveDb(videoPath, ctx.archiveDb);
|
|
296
|
+
const result = await analyzeArchiveSharpness(ctx.archiveDb, videoPath, {
|
|
297
|
+
mode: args.mode,
|
|
298
|
+
analysisWidth: args.analysisWidth,
|
|
299
|
+
minEdgeCoverage: args.minEdgeCoverage,
|
|
300
|
+
force: args.force,
|
|
301
|
+
getTools: ctx.getTools,
|
|
302
|
+
assertAllowedPath: (filePath) => {
|
|
303
|
+
assertPathInAllowedRoots(filePath, ctx.allowedRoots);
|
|
304
|
+
},
|
|
305
|
+
});
|
|
306
|
+
return {
|
|
307
|
+
clipPath: toAllowedRootRelativePath(result.clip.path, ctx.allowedRoots),
|
|
308
|
+
availability: result.clip.availability,
|
|
309
|
+
cached: result.cached,
|
|
310
|
+
run: sanitizeArchiveSharpnessRun(result.run, ctx.allowedRoots),
|
|
311
|
+
};
|
|
312
|
+
}));
|
|
313
|
+
sdkServer.registerTool('archive_get_sharpness', {
|
|
314
|
+
description: 'Query stored archive sharpness timelines for an allowed recording (works offline) with optional time-range filters, bounded pagination, or full NDJSON export to outPath.',
|
|
315
|
+
inputSchema: z
|
|
316
|
+
.object({
|
|
317
|
+
videoPath: z.string().min(1),
|
|
318
|
+
mode: z.enum(['sampled', 'every-frame']).optional(),
|
|
319
|
+
startSec: z.number().finite().min(0).optional(),
|
|
320
|
+
endSec: z.number().finite().min(0).optional(),
|
|
321
|
+
limit: z.number().int().min(1).max(MAX_SHARPNESS_QUERY_LIMIT).optional(),
|
|
322
|
+
offset: z.number().int().min(0).optional(),
|
|
323
|
+
outPath: z.string().min(1).optional(),
|
|
324
|
+
})
|
|
325
|
+
.strict(),
|
|
326
|
+
}, wrap(async (args) => {
|
|
327
|
+
const videoPath = assertPathInAllowedRoots(args.videoPath, ctx.allowedRoots);
|
|
328
|
+
assertNotArchiveDb(videoPath, ctx.archiveDb);
|
|
329
|
+
if (args.outPath !== undefined) {
|
|
330
|
+
const outPath = assertPathInAllowedRoots(args.outPath, ctx.allowedRoots);
|
|
331
|
+
assertNotArchiveDb(outPath, ctx.archiveDb);
|
|
332
|
+
if (fs.existsSync(outPath)) {
|
|
333
|
+
throw new Error('refusing to overwrite existing sharpness export file');
|
|
334
|
+
}
|
|
335
|
+
const exported = exportArchiveSharpnessNdjson(ctx.archiveDb, videoPath, {
|
|
336
|
+
mode: args.mode,
|
|
337
|
+
startSec: args.startSec,
|
|
338
|
+
endSec: args.endSec,
|
|
339
|
+
outPath,
|
|
340
|
+
overwrite: false,
|
|
341
|
+
});
|
|
342
|
+
return {
|
|
343
|
+
clipPath: toAllowedRootRelativePath(exported.clipPath, ctx.allowedRoots),
|
|
344
|
+
availability: exported.availability,
|
|
345
|
+
analyzed: true,
|
|
346
|
+
run: sanitizeArchiveSharpnessRun(exported.run, ctx.allowedRoots),
|
|
347
|
+
outPath: toAllowedRootRelativePath(outPath, ctx.allowedRoots),
|
|
348
|
+
format: 'ndjson',
|
|
349
|
+
count: exported.count,
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
const timeline = getArchiveSharpness(ctx.archiveDb, videoPath, {
|
|
353
|
+
mode: args.mode,
|
|
354
|
+
startSec: args.startSec,
|
|
355
|
+
endSec: args.endSec,
|
|
356
|
+
limit: args.limit,
|
|
357
|
+
offset: args.offset,
|
|
358
|
+
});
|
|
359
|
+
return {
|
|
360
|
+
clipPath: toAllowedRootRelativePath(timeline.clipPath, ctx.allowedRoots),
|
|
361
|
+
availability: timeline.availability,
|
|
362
|
+
analyzed: timeline.analyzed,
|
|
363
|
+
run: timeline.run ? sanitizeArchiveSharpnessRun(timeline.run, ctx.allowedRoots) : null,
|
|
364
|
+
totalSamples: timeline.totalSamples,
|
|
365
|
+
limit: timeline.limit,
|
|
366
|
+
offset: timeline.offset,
|
|
367
|
+
truncated: timeline.truncated,
|
|
368
|
+
samples: timeline.samples,
|
|
369
|
+
};
|
|
370
|
+
}));
|
|
258
371
|
sdkServer.registerTool('clip_get_telemetry', {
|
|
259
372
|
description: 'Probe a recording and extract its telemetry summary, kinematic shot segments, and a bounded track sample preview.',
|
|
260
373
|
inputSchema: z
|
|
@@ -331,7 +444,7 @@ export function registerMcpTools(sdkServer, ctx) {
|
|
|
331
444
|
};
|
|
332
445
|
}));
|
|
333
446
|
sdkServer.registerTool('clip_extract_keyframes', {
|
|
334
|
-
description: 'Extract targeted JPEG keyframes
|
|
447
|
+
description: 'Extract targeted JPEG keyframes, nearest telemetry snapshots, and optional luminance sharpness scores from a recording at specified timestamps or frame numbers.',
|
|
335
448
|
inputSchema: z
|
|
336
449
|
.object({
|
|
337
450
|
videoPath: z.string().min(1),
|
|
@@ -341,6 +454,7 @@ export function registerMcpTools(sdkServer, ctx) {
|
|
|
341
454
|
]),
|
|
342
455
|
maxWidth: z.number().int().min(1).optional(),
|
|
343
456
|
outDir: z.string().min(1).optional(),
|
|
457
|
+
sharpness: z.boolean().optional(),
|
|
344
458
|
})
|
|
345
459
|
.strict(),
|
|
346
460
|
}, wrap(async (args) => {
|
|
@@ -353,6 +467,7 @@ export function registerMcpTools(sdkServer, ctx) {
|
|
|
353
467
|
at: requests,
|
|
354
468
|
maxWidth: args.maxWidth,
|
|
355
469
|
outDir,
|
|
470
|
+
sharpness: args.sharpness,
|
|
356
471
|
tools,
|
|
357
472
|
});
|
|
358
473
|
return { videoPath, outDir, count: keyframes.length, keyframes };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "drone-path",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Render flight-path map overlay videos (exactly the source frame rate and frame count) from DJI drone recordings - telemetry from the embedded CAM-meta (DVTM) stream or the .SRT sidecar.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -26,7 +26,11 @@
|
|
|
26
26
|
"map",
|
|
27
27
|
"video",
|
|
28
28
|
"ffmpeg",
|
|
29
|
-
"leaflet"
|
|
29
|
+
"leaflet",
|
|
30
|
+
"gpx",
|
|
31
|
+
"kml",
|
|
32
|
+
"mcp",
|
|
33
|
+
"davinci-resolve"
|
|
30
34
|
],
|
|
31
35
|
"author": "Manuel Warum",
|
|
32
36
|
"license": "MIT",
|
|
@@ -38,7 +42,7 @@
|
|
|
38
42
|
"bugs": {
|
|
39
43
|
"url": "https://github.com/MrManny/drone-path/issues"
|
|
40
44
|
},
|
|
41
|
-
"homepage": "https://
|
|
45
|
+
"homepage": "https://www.dronepath.dev",
|
|
42
46
|
"files": [
|
|
43
47
|
"bin/drone-path.mjs",
|
|
44
48
|
"dist/**/*.js",
|
|
@@ -46,15 +50,15 @@
|
|
|
46
50
|
"THIRD-PARTY-NOTICES.md"
|
|
47
51
|
],
|
|
48
52
|
"scripts": {
|
|
49
|
-
"build": "
|
|
50
|
-
"prepack": "
|
|
53
|
+
"build": "tsc -b",
|
|
54
|
+
"prepack": "node ../../scripts/clean-package-dist.mjs && tsc -b"
|
|
51
55
|
},
|
|
52
56
|
"dependencies": {
|
|
53
57
|
"@modelcontextprotocol/server": "~2.4.0",
|
|
54
58
|
"commander": "~15.1.0",
|
|
55
|
-
"drone-path-archive": "~1.
|
|
56
|
-
"drone-path-core": "~1.
|
|
57
|
-
"drone-path-engine": "~1.
|
|
59
|
+
"drone-path-archive": "~1.2.0",
|
|
60
|
+
"drone-path-core": "~1.2.0",
|
|
61
|
+
"drone-path-engine": "~1.2.0",
|
|
58
62
|
"zod": "~4.6.7"
|
|
59
63
|
}
|
|
60
64
|
}
|