@bedolla/enrivision 0.1.5 → 0.1.7

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.
Files changed (64) hide show
  1. package/README.md +43 -9
  2. package/dist/client/EnriProxyClient.d.ts +296 -248
  3. package/dist/client/EnriProxyClient.d.ts.map +1 -1
  4. package/dist/client/EnriProxyClient.js +849 -119
  5. package/dist/client/EnriProxyClient.js.map +1 -1
  6. package/dist/client/EnriProxyClientContract.d.ts +478 -0
  7. package/dist/client/EnriProxyClientContract.d.ts.map +1 -0
  8. package/dist/client/EnriProxyClientContract.js +136 -0
  9. package/dist/client/EnriProxyClientContract.js.map +1 -0
  10. package/dist/index.js +23 -12
  11. package/dist/index.js.map +1 -1
  12. package/dist/package-info.d.ts +28 -0
  13. package/dist/package-info.d.ts.map +1 -1
  14. package/dist/package-info.js +28 -0
  15. package/dist/package-info.js.map +1 -1
  16. package/dist/server/EnriVisionServer.d.ts +186 -0
  17. package/dist/server/EnriVisionServer.d.ts.map +1 -1
  18. package/dist/server/EnriVisionServer.js +804 -94
  19. package/dist/server/EnriVisionServer.js.map +1 -1
  20. package/dist/shared/codepointTruncation.d.ts +61 -0
  21. package/dist/shared/codepointTruncation.d.ts.map +1 -0
  22. package/dist/shared/codepointTruncation.js +73 -0
  23. package/dist/shared/codepointTruncation.js.map +1 -0
  24. package/dist/shared/mediaUrlFetcher.d.ts +247 -9
  25. package/dist/shared/mediaUrlFetcher.d.ts.map +1 -1
  26. package/dist/shared/mediaUrlFetcher.js +712 -53
  27. package/dist/shared/mediaUrlFetcher.js.map +1 -1
  28. package/dist/shared/tar.d.ts +82 -2
  29. package/dist/shared/tar.d.ts.map +1 -1
  30. package/dist/shared/tar.js +106 -43
  31. package/dist/shared/tar.js.map +1 -1
  32. package/dist/shared/validation.d.ts +96 -2
  33. package/dist/shared/validation.d.ts.map +1 -1
  34. package/dist/shared/validation.js +169 -10
  35. package/dist/shared/validation.js.map +1 -1
  36. package/dist/tools/AnalyzeMediaContract.d.ts +462 -0
  37. package/dist/tools/AnalyzeMediaContract.d.ts.map +1 -0
  38. package/dist/tools/AnalyzeMediaContract.js +161 -0
  39. package/dist/tools/AnalyzeMediaContract.js.map +1 -0
  40. package/dist/tools/AnalyzeMediaExtractionSanitizer.d.ts +35 -0
  41. package/dist/tools/AnalyzeMediaExtractionSanitizer.d.ts.map +1 -0
  42. package/dist/tools/AnalyzeMediaExtractionSanitizer.js +214 -0
  43. package/dist/tools/AnalyzeMediaExtractionSanitizer.js.map +1 -0
  44. package/dist/tools/AnalyzeMediaInputResolver.d.ts +250 -0
  45. package/dist/tools/AnalyzeMediaInputResolver.d.ts.map +1 -0
  46. package/dist/tools/AnalyzeMediaInputResolver.js +430 -0
  47. package/dist/tools/AnalyzeMediaInputResolver.js.map +1 -0
  48. package/dist/tools/AnalyzeMediaParamParser.d.ts +307 -0
  49. package/dist/tools/AnalyzeMediaParamParser.d.ts.map +1 -0
  50. package/dist/tools/AnalyzeMediaParamParser.js +843 -0
  51. package/dist/tools/AnalyzeMediaParamParser.js.map +1 -0
  52. package/dist/tools/AnalyzeMediaResumableUploader.d.ts +244 -0
  53. package/dist/tools/AnalyzeMediaResumableUploader.d.ts.map +1 -0
  54. package/dist/tools/AnalyzeMediaResumableUploader.js +549 -0
  55. package/dist/tools/AnalyzeMediaResumableUploader.js.map +1 -0
  56. package/dist/tools/AnalyzeMediaTarPackager.d.ts +42 -0
  57. package/dist/tools/AnalyzeMediaTarPackager.d.ts.map +1 -0
  58. package/dist/tools/AnalyzeMediaTarPackager.js +245 -0
  59. package/dist/tools/AnalyzeMediaTarPackager.js.map +1 -0
  60. package/dist/tools/AnalyzeMediaTool.d.ts +156 -294
  61. package/dist/tools/AnalyzeMediaTool.d.ts.map +1 -1
  62. package/dist/tools/AnalyzeMediaTool.js +611 -457
  63. package/dist/tools/AnalyzeMediaTool.js.map +1 -1
  64. package/package.json +2 -1
@@ -1,370 +1,232 @@
1
1
  /**
2
2
  * ANALYZE MEDIA TOOL
3
3
  *
4
- * Implements the `analyze_media` MCP tool:
5
- * - Validates local file paths or http(s) URLs
6
- * - Materializes URL inputs via bounded downloads (temporary, owned cleanup)
7
- * - Streams the bytes to EnriProxy via resumable uploads
8
- * - Triggers server-side analysis and returns text-only results
4
+ * Facade for the `analyze_media` MCP tool:
5
+ * - Validates local file paths or http(s) URLs (param parser)
6
+ * - Materializes URL inputs via bounded downloads (input resolver)
7
+ * - Uploads single files or multi-image tar sets through resumable
8
+ * EnriProxy sessions (uploader + tar packager)
9
+ * - Triggers server-side analysis and returns sanitized text-only results
9
10
  *
10
11
  * @module tools/AnalyzeMediaTool
11
12
  */
12
- import { type EnriProxyClient } from "../client/EnriProxyClient.js";
13
13
  import { MediaUrlFetcher } from "../shared/mediaUrlFetcher.js";
14
+ import type { AnalyzeMediaElementBox, AnalyzeMediaExecutionOptions, AnalyzeMediaToolDeps, AnalyzeMediaToolParams, AnalyzeMediaToolResult, ImageRegion } from "./AnalyzeMediaContract.js";
15
+ export type { AnalyzeMediaElementBox, AnalyzeMediaExecutionOptions, AnalyzeMediaToolDeps, AnalyzeMediaToolParams, AnalyzeMediaToolResult, ImageRegion, };
14
16
  /**
15
- * Tool parameters for `analyze_media`.
17
+ * MCP tool that uploads and analyzes local or http(s) URL media.
16
18
  */
17
- export interface AnalyzeMediaToolParams {
18
- /**
19
- * Absolute local filesystem path on the MCP host, or one http(s) URL to
20
- * download (bounded, temporary) and analyze.
21
- *
22
- * @remarks
23
- * Use `paths` to analyze multiple images in a single call.
24
- */
25
- readonly path?: string;
26
- /**
27
- * Absolute local filesystem paths or http(s) URLs on the MCP host.
28
- *
29
- * @remarks
30
- * When provided, EnriVision uploads the files as a single media-set archive
31
- * (resumable, up to 4GB) and triggers server-side batching + reduce.
32
- *
33
- * This is intended for many UI screenshots / photo sets.
34
- */
35
- readonly paths?: ReadonlyArray<string>;
36
- /**
37
- * Optional analysis hint (ui, diagram, chart, error, code, meeting, tutorial, photo).
38
- */
39
- readonly context?: string;
40
- /**
41
- * Optional explicit user question.
42
- */
43
- readonly question?: string;
44
- /**
45
- * Preferred response language code (e.g., "es", "en").
46
- */
47
- readonly language?: string;
48
- /**
49
- * Optional max frames override for videos (1-20).
50
- */
51
- readonly maxFrames?: number;
52
- /**
53
- * Optional override for transcription on videos.
54
- */
55
- readonly transcribe?: boolean;
56
- /**
57
- * Optional transcription language hint for Whisper.
58
- */
59
- readonly transcriptionLanguage?: string;
60
- /**
61
- * Optional analysis mode selector (auto|single|multipass).
62
- */
63
- readonly analysisMode?: "auto" | "single" | "multipass";
64
- /**
65
- * Optional video multipass tuning.
66
- */
67
- readonly video?: {
68
- /**
69
- * Optional clip start offset in seconds for targeted video analysis.
70
- *
71
- * @remarks
72
- * Use this when the question references a specific timestamp to avoid
73
- * scanning the full timeline.
74
- */
75
- readonly clipStartSeconds?: number;
76
- /**
77
- * Optional clip duration in seconds for targeted video analysis.
78
- *
79
- * @remarks
80
- * Use together with {@link clipStartSeconds} to analyze only a time window.
81
- */
82
- readonly clipDurationSeconds?: number;
83
- /**
84
- * Segment duration in seconds.
85
- */
86
- readonly segmentSeconds?: number;
87
- /**
88
- * Maximum number of segments to analyze.
89
- */
90
- readonly maxSegments?: number;
91
- /**
92
- * Maximum frames per segment.
93
- */
94
- readonly maxFramesPerSegment?: number;
95
- };
96
- /**
97
- * Optional document multipass tuning (PDF).
98
- */
99
- readonly document?: {
100
- /**
101
- * Maximum pages to analyze in total.
102
- */
103
- readonly maxPagesTotal?: number;
104
- /**
105
- * Pages per batch.
106
- */
107
- readonly pagesPerBatch?: number;
108
- /**
109
- * Maximum rendered pages per batch.
110
- */
111
- readonly maxImagesPerBatch?: number;
112
- /**
113
- * Minimum extracted text length to treat a page as textual.
114
- */
115
- readonly scannedTextThresholdChars?: number;
116
- };
117
- /**
118
- * Optional audio multipass tuning.
119
- */
120
- readonly audio?: {
121
- /**
122
- * Whether to include timestamped segments in audio extraction.
123
- */
124
- readonly timestamps?: boolean;
125
- /**
126
- * Segment duration in seconds for audio multipass.
127
- */
128
- readonly segmentSeconds?: number;
129
- /**
130
- * Maximum number of audio segments to analyze.
131
- */
132
- readonly maxSegments?: number;
133
- };
134
- /**
135
- * Optional image-set multipass tuning.
136
- *
137
- * @remarks
138
- * Used only when analyzing multiple images via `paths`.
139
- */
140
- readonly images?: {
141
- /**
142
- * Maximum number of images to analyze in total.
143
- */
144
- readonly maxImagesTotal?: number;
145
- /**
146
- * Images per batch for multipass map calls.
147
- */
148
- readonly imagesPerBatch?: number;
149
- /**
150
- * Maximum dimension for images (width/height).
151
- */
152
- readonly maxDimension?: number;
153
- };
19
+ export declare class AnalyzeMediaTool {
154
20
  /**
155
- * Optional relative region of the analyzed image for native-resolution zoom.
156
- *
157
- * @remarks
158
- * Normalized [0,1] coordinates over the original image (0,0 = top-left
159
- * corner). Use the boxes returned in `elements` of a previous analysis of
160
- * the same image; never invent coordinates.
21
+ * Tool dependencies.
161
22
  */
162
- readonly region?: {
163
- readonly x: number;
164
- readonly y: number;
165
- readonly width: number;
166
- readonly height: number;
167
- };
168
- }
169
- /**
170
- * One grounded element box returned by an image analysis.
171
- */
172
- export interface AnalyzeMediaElementBox {
23
+ private readonly deps;
173
24
  /**
174
- * Short label naming the grounded element.
25
+ * Raw argument validator.
175
26
  */
176
- readonly label: string;
27
+ private readonly paramParser;
177
28
  /**
178
- * Original-relative [0,1] box that can be echoed back as `region`.
29
+ * Local/URL input materializer.
179
30
  */
180
- readonly box: {
181
- readonly x: number;
182
- readonly y: number;
183
- readonly width: number;
184
- readonly height: number;
185
- };
186
- }
187
- /**
188
- * Structured result for `analyze_media`.
189
- */
190
- export interface AnalyzeMediaToolResult extends Record<string, unknown> {
31
+ private readonly inputResolver;
191
32
  /**
192
- * Text analysis produced by EnriProxy.
33
+ * Resumable chunk uploader.
193
34
  */
194
- readonly analysis: string;
35
+ private readonly uploader;
195
36
  /**
196
- * Grounded element boxes for image analyses (original-relative [0,1]).
37
+ * Multi-image tar set packager.
197
38
  */
198
- readonly elements?: ReadonlyArray<AnalyzeMediaElementBox>;
39
+ private readonly tarPackager;
199
40
  /**
200
- * Detected media type.
41
+ * Extraction output sanitizer.
201
42
  */
202
- readonly media_type: string;
43
+ private readonly sanitizer;
203
44
  /**
204
- * Extraction metadata returned by the server.
45
+ * Cached vision-capability verdicts keyed by endpoint + model.
205
46
  *
206
47
  * @remarks
207
- * This metadata is intended for debugging and transparency (e.g., duration,
208
- * selected frames, warnings). Internal identifiers like upload ids are
209
- * stripped to avoid leaking implementation details into the model context.
48
+ * `execute` builds a fresh client per call, so instance-keyed caching
49
+ * would never hit: the key is `serverUrl + model` (one account per
50
+ * endpoint). Entries live for `ANALYZE_MEDIA_LIMITS.visionProbeCacheTtlMs`
51
+ * (mirrors EnriCode `PROBE_CACHE_TTL_MS` and its per-client scoping).
210
52
  */
211
- readonly extraction: Record<string, unknown>;
212
- }
213
- /**
214
- * Dependencies for {@link AnalyzeMediaTool}.
215
- */
216
- export interface AnalyzeMediaToolDeps {
217
- /**
218
- * Creates an EnriProxy client with a base URL, API key, and timeout.
219
- *
220
- * @param serverUrl - EnriProxy URL
221
- * @param apiKey - EnriProxy API key
222
- * @param timeoutMs - Timeout in ms
223
- * @returns Client instance
224
- */
225
- readonly createClient: (serverUrl: string, apiKey: string, timeoutMs: number) => EnriProxyClient;
226
- /**
227
- * Default EnriProxy server URL.
228
- */
229
- readonly defaultServerUrl: string;
230
- /**
231
- * Default EnriProxy API key.
232
- */
233
- readonly defaultApiKey: string;
234
- /**
235
- * Default timeout in milliseconds.
236
- */
237
- readonly defaultTimeoutMs: number;
238
- }
239
- /**
240
- * MCP tool that uploads and analyzes local or http(s) URL media.
241
- */
242
- export declare class AnalyzeMediaTool {
243
- /**
244
- * Tool dependencies.
245
- */
246
- private readonly deps;
247
- /**
248
- * Bounded http(s) media fetcher used when `path`/`paths` carry URLs.
249
- */
250
- private readonly urlFetcher;
53
+ private readonly visionProbeCache;
251
54
  /**
252
55
  * Creates a new {@link AnalyzeMediaTool}.
253
56
  *
254
- * @param deps - Tool dependencies
255
- * @param urlFetcher - Optional URL fetcher override for tests
57
+ * @param deps - Tool dependencies.
58
+ * @param urlFetcher - Optional URL fetcher override for tests.
256
59
  */
257
60
  constructor(deps: AnalyzeMediaToolDeps, urlFetcher?: MediaUrlFetcher);
258
61
  /**
259
62
  * Validates raw MCP tool arguments.
260
63
  *
261
- * @param raw - Raw tool arguments
262
- * @returns Validated parameters
64
+ * @param raw - Raw tool arguments.
65
+ * @returns Validated parameters.
66
+ * @throws Error with an Spanish-first bilingual message when arguments are missing or out of range.
263
67
  */
264
68
  parseParams(raw: unknown): AnalyzeMediaToolParams;
265
69
  /**
266
70
  * Executes the tool.
267
71
  *
268
- * @param params - Validated parameters
269
- * @returns Tool result
72
+ * @param params - Validated parameters.
73
+ * @param options - Optional execution options (cancellation signal).
74
+ * @returns Tool result.
75
+ * @throws Error with an Spanish-first bilingual message when configuration, upload, or analysis fails.
270
76
  */
271
- execute(params: AnalyzeMediaToolParams): Promise<AnalyzeMediaToolResult>;
77
+ execute(params: AnalyzeMediaToolParams, options?: AnalyzeMediaExecutionOptions): Promise<AnalyzeMediaToolResult>;
272
78
  /**
273
- * Resolves the upload content type for one media input.
79
+ * Rejects a `region` zoom against non-image inputs before any upload.
274
80
  *
275
81
  * @remarks
276
- * URL downloads keep their extension-derived type when the extension is
277
- * recognized; otherwise the server-reported content type wins over the
278
- * generic `application/octet-stream` fallback.
82
+ * `region` zooms one image at native resolution: sending it with video,
83
+ * audio, PDF, or a tar set wastes an upload plus a server rejection (or
84
+ * a silent ignore). Fail locally in Spanish using the resolved effective
85
+ * content type (server-reported type wins, mirroring the resolver).
279
86
  *
280
- * @param localPath - Local file path (already materialized for URLs)
281
- * @param urlContentType - Server-reported content type for downloaded URLs
282
- * @returns Effective MIME type
87
+ * @param region - Validated region, or undefined when absent.
88
+ * @param inputs - Resolved upload-ready inputs.
89
+ * @throws Error with an Spanish-first bilingual message when `region` targets non-image media.
283
90
  */
284
- private resolveEffectiveContentType;
91
+ private rejectRegionForNonImage;
285
92
  /**
286
- * Removes internal identifiers (upload ids, routing-only values, etc.) from the
287
- * extraction payload before returning it to the model.
93
+ * Rejects tuning knobs that the resolved content type would silently ignore.
94
+ *
95
+ * @remarks
96
+ * Pre-upload gate mirroring EnriCode `VisionAnalyzeMediaRequestRecords`:
97
+ * `video.*` tuning only applies to video, `images.*` only to images
98
+ * and documents (PDF page-image sets on the remote route), `document.*`
99
+ * only to PDF/Office/TXT/CSV, clip/`maxFramesPerSegment` never to audio,
100
+ * `video.segment_seconds`/`max_segments` never to audio without an audio
101
+ * section, and `audio.segment_seconds`/`max_segments` never to video
102
+ * without a video section (shared flats fan out to both sections by
103
+ * design and are exempt). Multi-image sets only accept `images.*`. The top-level
104
+ * `maxFrames` knob is media-agnostic by design (EnriCode declares
105
+ * `max_frames` "sin efecto en imágenes fijas o audio"): it never
106
+ * triggers a mismatch gate and is forwarded for the server to apply or
107
+ * ignore. Unknown content types (`application/octet-stream` included)
108
+ * skip every gate by design so the server (not this gate) decides
109
+ * applicability, mirroring EnriCode `VisionAnalyzeMediaRequestRecords`.
110
+ * Failing here saves the
111
+ * full upload plus a late server rejection.
112
+ *
113
+ * @param params - Validated tool parameters.
114
+ * @param inputs - Resolved upload-ready inputs.
115
+ * @throws Error with an Spanish-first bilingual message when tuning mismatches the content type.
116
+ */
117
+ private rejectMismatchedTuning;
118
+ /**
119
+ * Resolves the requested server-side model id for dispatch affinity.
120
+ *
121
+ * @remarks
122
+ * Pure read of `params.model` plus the validated `ENRIVISION_MODEL` env
123
+ * fallback (no operator logging): used by the pre-upload vision probe,
124
+ * which runs before the main model-resolution block in `execute`.
288
125
  *
289
- * @param extraction - Raw extraction object returned by EnriProxy
290
- * @returns Sanitized extraction object
126
+ * @param params - Validated tool parameters.
127
+ * @returns Trimmed model id, or undefined for auto-dispatch.
291
128
  */
292
- private stripInternalExtractionFields;
129
+ private resolveRequestedModel;
293
130
  /**
294
- * Recursively strips internal fields from an unknown value.
131
+ * Fails fast when the requested model explicitly lacks vision, before any byte.
132
+ *
133
+ * @remarks
134
+ * Mirrors EnriCode `assertRemoteVisionCapable`: probes `GET
135
+ * `/v1/account/models` (15 s budget inside the client) and matches the
136
+ * requested model by `id`, `requestModelId`, or canonical ids. Only an
137
+ * explicit `vision === false` rejects; unknown models, missing flags, and
138
+ * probe failures stay fail-open so a stale discovery snapshot never blocks
139
+ * a valid upload. Verdicts are cached per client for 5 min; 401/404 probe
140
+ * failures invalidate the entry so revoked keys never ride a stale verdict.
141
+ * Clients without `getAccountModels` (older stubs) skip the probe entirely.
295
142
  *
296
- * @param value - Unknown value to sanitize
297
- * @returns Sanitized value
143
+ * @param client - EnriProxy client used for the upload.
144
+ * @param requestedModel - Trimmed model id, or undefined for auto-dispatch.
145
+ * @param signal - Optional cancellation signal.
146
+ * @throws Error with an Spanish-first bilingual message when the model explicitly lacks vision.
298
147
  */
299
- private stripInternalFields;
148
+ private assertVisionCapable;
300
149
  /**
301
- * Ensures the sanitized extraction value is a plain JSON object.
302
- *
303
- * @param value - Sanitized value
304
- * @returns Plain object
150
+ * Maximum vision-probe cache entries (model ids are caller-controlled).
305
151
  */
306
- private asPlainObject;
152
+ private static readonly MAX_VISION_PROBE_ENTRIES;
307
153
  /**
308
- * Validates that a path exists and is a readable file.
154
+ * Remembers one vision-probe verdict, purging expired entries and
155
+ * evicting oldest-first past the cap so long-lived tool instances
156
+ * cannot leak one entry per distinct model id.
309
157
  *
310
- * @param filePath - Local filesystem path
158
+ * @param cacheKey - Server plus model cache key.
159
+ * @param verdict - Whether the model has vision.
160
+ * @param now - Current epoch milliseconds.
161
+ * @returns Nothing.
162
+ */
163
+ private rememberVisionProbe;
311
164
  /**
312
- * Parses and validates the optional relative image region.
165
+ * Builds the visionless-model rejection error.
313
166
  *
314
- * @param raw - Raw `region` argument.
315
- * @returns Validated region, or undefined when absent.
167
+ * @param modelId - Requested model id.
168
+ * @returns Spanish-first bilingual error (no byte was uploaded).
316
169
  */
317
- private parseRegion;
170
+ private static buildVisionlessModelError;
318
171
  /**
319
- * Validates that a path exists and is a readable file.
172
+ * Executes one truncated-list continuation read (no upload, no analysis).
320
173
  *
321
- * @param filePath - Local filesystem path
322
- * @returns File size in bytes
174
+ * @param client - EnriProxy client.
175
+ * @param cursor - Opaque cursor from a truncated response.
176
+ * @param offset - Start index, or undefined for the stored next offset.
177
+ * @param limit - Window length (1-100), or undefined for the server default.
178
+ * @param signal - Optional cancellation signal.
179
+ * @returns Tool result carrying the page plus chaining state.
323
180
  */
324
- private assertReadableFile;
181
+ private executeContinuation;
325
182
  /**
326
- * Detects MIME type using file extension.
183
+ * Warns when `transcribe` is set for media it cannot affect.
327
184
  *
328
- * @param filePath - File path
329
- * @returns MIME type string
185
+ * @remarks
186
+ * Mirrors EnriCode `LocalMediaAnalysisService` (transcribe is inapplicable
187
+ * for images and documents): instead of failing, the knob is forwarded
188
+ * and declared as a bilingual honesty warning so the model never assumes
189
+ * audio was transcribed. Videos and audio files never warn.
190
+ *
191
+ * @param params - Validated tool parameters.
192
+ * @param inputs - Resolved upload-ready inputs.
193
+ * @returns Bilingual warning, or undefined when `transcribe` may apply.
330
194
  */
331
- private detectMimeType;
195
+ private transcribeInapplicableWarning;
332
196
  /**
333
- * Uploads multiple local images as a single EnriVision media-set tar archive.
197
+ * Runs the mismatch gates on the remote (`source_url`) branch as advisories.
334
198
  *
335
199
  * @remarks
336
- * This avoids creating many concurrent resumable upload sessions (which are
337
- * capped per API key) and enables server-side batching + reduce for large
338
- * screenshot sets.
200
+ * The local gates no-op on the empty remote input list by design (the
201
+ * server, which sees the served type, decides applicability). When the URL
202
+ * extension guesses a known media type, the same gates run against the
203
+ * guess and likely-ignored tuning is declared as bilingual warnings
204
+ * instead of errors; URLs with no usable extension stay server-decides
205
+ * with no warnings.
339
206
  *
340
- * @param client - EnriProxy client
341
- * @param inputs - Resolved media inputs (local paths, URLs already materialized)
342
- * @param timeoutMs - Request timeout per HTTP request
343
- * @param clientTraceId - Client trace id for correlation
344
- * @returns Upload id for the created tar session
207
+ * @param params - Validated tool parameters.
208
+ * @param remoteUrl - Remote http(s) URL the server will ingest.
209
+ * @returns Advisory warnings (empty when nothing looks mismatched).
345
210
  */
346
- private uploadImageSetAsMediaSetTar;
211
+ private advisoryRemoteTuningWarnings;
347
212
  /**
348
- * Uploads a file to EnriProxy in resumable chunks.
213
+ * Releases uploaded bytes when the analysis fails or is cancelled.
349
214
  *
350
- * @param client - EnriProxy client
351
- * @param filePath - Local file path
352
- * @param fileSize - Total file size in bytes
353
- * @param session - Server-created session
354
- * @param timeoutMs - Request timeout in milliseconds
355
- * @returns Final offset
215
+ * @remarks
216
+ * Best-effort by design: it runs on an independent 15 s signal (the
217
+ * caller signal may already be cancelled) and never throws, so the
218
+ * original upload/analysis error always reaches the model unchanged.
219
+ *
220
+ * @param client - EnriProxy client used for the upload.
221
+ * @param uploadId - Upload id to release, or null when nothing was uploaded.
356
222
  */
357
- private uploadFileResumable;
223
+ private deleteUploadedBytesBestEffort;
358
224
  /**
359
- * Uploads a single chunk with retry and offset resync.
225
+ * Removes internal identifiers from the extraction payload.
360
226
  *
361
- * @param client - EnriProxy client
362
- * @param uploadId - Upload id
363
- * @param offset - Expected offset
364
- * @param chunk - Chunk bytes
365
- * @param timeoutMs - Timeout in ms
366
- * @returns New offset
227
+ * @param extraction - Raw extraction object returned by EnriProxy.
228
+ * @returns Sanitized extraction object.
367
229
  */
368
- private uploadChunkWithRetry;
230
+ private stripInternalExtractionFields;
369
231
  }
370
232
  //# sourceMappingURL=AnalyzeMediaTool.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnalyzeMediaTool.d.ts","sourceRoot":"","sources":["../../src/tools/AnalyzeMediaTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AASH,OAAO,EAAwD,KAAK,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE1H,OAAO,EAAE,eAAe,EAA4B,MAAM,8B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