@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.
- package/README.md +43 -9
- package/dist/client/EnriProxyClient.d.ts +296 -248
- package/dist/client/EnriProxyClient.d.ts.map +1 -1
- package/dist/client/EnriProxyClient.js +849 -119
- package/dist/client/EnriProxyClient.js.map +1 -1
- package/dist/client/EnriProxyClientContract.d.ts +478 -0
- package/dist/client/EnriProxyClientContract.d.ts.map +1 -0
- package/dist/client/EnriProxyClientContract.js +136 -0
- package/dist/client/EnriProxyClientContract.js.map +1 -0
- package/dist/index.js +23 -12
- package/dist/index.js.map +1 -1
- package/dist/package-info.d.ts +28 -0
- package/dist/package-info.d.ts.map +1 -1
- package/dist/package-info.js +28 -0
- package/dist/package-info.js.map +1 -1
- package/dist/server/EnriVisionServer.d.ts +186 -0
- package/dist/server/EnriVisionServer.d.ts.map +1 -1
- package/dist/server/EnriVisionServer.js +804 -94
- package/dist/server/EnriVisionServer.js.map +1 -1
- package/dist/shared/codepointTruncation.d.ts +61 -0
- package/dist/shared/codepointTruncation.d.ts.map +1 -0
- package/dist/shared/codepointTruncation.js +73 -0
- package/dist/shared/codepointTruncation.js.map +1 -0
- package/dist/shared/mediaUrlFetcher.d.ts +247 -9
- package/dist/shared/mediaUrlFetcher.d.ts.map +1 -1
- package/dist/shared/mediaUrlFetcher.js +712 -53
- package/dist/shared/mediaUrlFetcher.js.map +1 -1
- package/dist/shared/tar.d.ts +82 -2
- package/dist/shared/tar.d.ts.map +1 -1
- package/dist/shared/tar.js +106 -43
- package/dist/shared/tar.js.map +1 -1
- package/dist/shared/validation.d.ts +96 -2
- package/dist/shared/validation.d.ts.map +1 -1
- package/dist/shared/validation.js +169 -10
- package/dist/shared/validation.js.map +1 -1
- package/dist/tools/AnalyzeMediaContract.d.ts +462 -0
- package/dist/tools/AnalyzeMediaContract.d.ts.map +1 -0
- package/dist/tools/AnalyzeMediaContract.js +161 -0
- package/dist/tools/AnalyzeMediaContract.js.map +1 -0
- package/dist/tools/AnalyzeMediaExtractionSanitizer.d.ts +35 -0
- package/dist/tools/AnalyzeMediaExtractionSanitizer.d.ts.map +1 -0
- package/dist/tools/AnalyzeMediaExtractionSanitizer.js +214 -0
- package/dist/tools/AnalyzeMediaExtractionSanitizer.js.map +1 -0
- package/dist/tools/AnalyzeMediaInputResolver.d.ts +250 -0
- package/dist/tools/AnalyzeMediaInputResolver.d.ts.map +1 -0
- package/dist/tools/AnalyzeMediaInputResolver.js +430 -0
- package/dist/tools/AnalyzeMediaInputResolver.js.map +1 -0
- package/dist/tools/AnalyzeMediaParamParser.d.ts +307 -0
- package/dist/tools/AnalyzeMediaParamParser.d.ts.map +1 -0
- package/dist/tools/AnalyzeMediaParamParser.js +843 -0
- package/dist/tools/AnalyzeMediaParamParser.js.map +1 -0
- package/dist/tools/AnalyzeMediaResumableUploader.d.ts +244 -0
- package/dist/tools/AnalyzeMediaResumableUploader.d.ts.map +1 -0
- package/dist/tools/AnalyzeMediaResumableUploader.js +549 -0
- package/dist/tools/AnalyzeMediaResumableUploader.js.map +1 -0
- package/dist/tools/AnalyzeMediaTarPackager.d.ts +42 -0
- package/dist/tools/AnalyzeMediaTarPackager.d.ts.map +1 -0
- package/dist/tools/AnalyzeMediaTarPackager.js +245 -0
- package/dist/tools/AnalyzeMediaTarPackager.js.map +1 -0
- package/dist/tools/AnalyzeMediaTool.d.ts +156 -294
- package/dist/tools/AnalyzeMediaTool.d.ts.map +1 -1
- package/dist/tools/AnalyzeMediaTool.js +611 -457
- package/dist/tools/AnalyzeMediaTool.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ This is useful for media types that many MCP clients cannot read reliably (video
|
|
|
11
11
|
|
|
12
12
|
## Requirements
|
|
13
13
|
|
|
14
|
-
- Node.js `>=
|
|
14
|
+
- Node.js `>= 24`
|
|
15
15
|
- A reachable EnriProxy server with these endpoints enabled:
|
|
16
16
|
- `POST /v1/uploads`
|
|
17
17
|
- `HEAD /v1/uploads/:id`
|
|
@@ -85,7 +85,7 @@ Example: no install (always uses whatever npm currently tags as `latest`)
|
|
|
85
85
|
"EnriVision": {
|
|
86
86
|
"type": "stdio",
|
|
87
87
|
"command": "node",
|
|
88
|
-
"args": ["C
|
|
88
|
+
"args": ["C:\\Users\\Administrator\\Projects\\EnriVision\\dist\\index.js"],
|
|
89
89
|
"env": {
|
|
90
90
|
"ENRIPROXY_URL": "http://127.0.0.1:8787",
|
|
91
91
|
"ENRIPROXY_API_KEY": "YOUR_ENRIPROXY_API_KEY",
|
|
@@ -104,9 +104,34 @@ EnriVision is configured via environment variables:
|
|
|
104
104
|
- `ENRIPROXY_URL` (`string`, optional, default: `http://127.0.0.1:8787`)
|
|
105
105
|
- `ENRIPROXY_API_KEY` (`string`, required)
|
|
106
106
|
- `ENRIVISION_TIMEOUT_MS` (`string`, optional, default: `1800000`)
|
|
107
|
-
- Parsed as an integer (milliseconds). Uploads are performed in chunks;
|
|
107
|
+
- Parsed as an integer (milliseconds). This is the operator cap: the per-call analyze timeout is `min(operator, mode budget)` with `single` = 10 min (one pass, fast/cheap), `multipass`/`auto` = 20 min (per-segment/batch map + reduce; `auto` may escalate to multipass server-side). Uploads are performed in chunks; per-chunk timeouts honor `min(operator, derived 30s..300s)` floored at 30 s (an operator budget below 30 s never forces tighter single-chunk budgets).
|
|
108
108
|
- `ENRIVISION_DEFAULT_LANGUAGE` (`string`, optional)
|
|
109
109
|
- Default language to send when the tool call does not provide `language`.
|
|
110
|
+
- `ENRIVISION_DENY_SYMLINKS` (`string`, optional)
|
|
111
|
+
- Set to `1` to reject symlinked `path`/`paths` inputs. Strict mode opens with `O_NOFOLLOW` (POSIX) and compares the `dev:ino` handle identity from `fstat`. On Windows (`win32`) `O_NOFOLLOW` is `0` (advisory only), so strict mode there rests solely on the `lstat`-vs-`fstat` comparison with a small swap window: prefer POSIX hosts when symlink races are in scope.
|
|
112
|
+
- `ENRIVISION_MODEL` (`string`, optional)
|
|
113
|
+
- Model id for server-side dispatch affinity; omit for auto-dispatch.
|
|
114
|
+
- `ENRIVISION_QUIET` (`string`, optional)
|
|
115
|
+
- Set to `1` to silence upload/retry progress lines on stderr.
|
|
116
|
+
|
|
117
|
+
## Analysis budgets
|
|
118
|
+
|
|
119
|
+
The client analyze timeout is `min(ENRIVISION_TIMEOUT_MS, mode budget)`:
|
|
120
|
+
|
|
121
|
+
- `single` → 10 min (mirrors EnriCode and the EnriProxy single-pass stage budget).
|
|
122
|
+
- `multipass` → 20 min (mirrors EnriCode and the server multipass wall-clock budget).
|
|
123
|
+
- `auto` (default) → 20 min: the server picks the mode and may escalate to multipass, so the client cannot assume the short budget. If unsure, omit tuning (`auto`).
|
|
124
|
+
|
|
125
|
+
## Error shape
|
|
126
|
+
|
|
127
|
+
Tool failures return MCP `isError` with Spanish-first bilingual text (ES first, EN second) plus machine-readable `structuredContent: { code, retryable, httpStatus? }` reusing the EnriCode vocabulary:
|
|
128
|
+
|
|
129
|
+
- `ENRICODE_ERR_TOOL_INPUT_INVALID` — argument/tuning errors (including proxy 400/422). Never retry unchanged (`retryable: false`).
|
|
130
|
+
- `ENRICODE_ERR_TOOL_EXECUTION_FAILED` — server/transport failures. `retryable` is true for 408/429/5xx, false otherwise.
|
|
131
|
+
- `ENRICODE_ERR_TOOL_EXECUTION_TIMEOUT` — expired upload/analyze budgets (`retryable: true`; retry with a smaller scope).
|
|
132
|
+
- `ENRICODE_ERR_TOOL_EXECUTION_ABORTED` — caller-cancelled (`retryable: false`).
|
|
133
|
+
|
|
134
|
+
`httpStatus` is present only when the failure carries a proxy HTTP status.
|
|
110
135
|
|
|
111
136
|
## MCP tools
|
|
112
137
|
|
|
@@ -120,28 +145,37 @@ EnriVision exposes this MCP tool:
|
|
|
120
145
|
General notes:
|
|
121
146
|
|
|
122
147
|
- The tool accepts a single JSON object as its input (the MCP `arguments`).
|
|
123
|
-
-
|
|
124
|
-
- Paths must be absolute on the machine running the MCP server, or http(s) URLs. URLs are downloaded to a temporary directory on the MCP host (up to 64 MiB each; localhost and private-network destinations are blocked) and deleted after analysis.
|
|
148
|
+
- At least one of `path`, `paths`, or `cursor` is required. When `paths` carries at least one valid entry, `path` is ignored (explicit ignore-path contract: sending both is allowed, `path` is silently ignored — prefer oneOf semantics and send only one). A `cursor` (from a truncated response) reads the next window of the list without uploading or analyzing anything.
|
|
149
|
+
- Paths must be absolute on the machine running the MCP server, or http(s) URLs. URLs are downloaded to a temporary directory on the MCP host (up to 64 MiB each; localhost and private-network destinations are blocked) and deleted after analysis. A solitary URL above 64 MiB escalates to EnriProxy's server-side `source_url` ingestion (resumable download with extra hops); local files use resumable upload up to 4 GiB.
|
|
125
150
|
- EnriVision does not accept per-call `server_url`/`api_key` overrides (these are configured via env vars).
|
|
126
151
|
|
|
127
152
|
### `analyze_media`
|
|
128
153
|
|
|
129
154
|
Inputs:
|
|
130
155
|
|
|
131
|
-
- `path` (`string`, optional): absolute local file path, or one http(s) URL to download and analyze (up to 64 MiB).
|
|
156
|
+
- `path` (`string`, optional): absolute local file path, or one http(s) URL to download and analyze (up to 64 MiB; a solitary larger URL escalates to server-side `source_url` ingestion).
|
|
132
157
|
- `paths` (`string[]`, optional): absolute local image paths or http(s) image URLs (useful for UI screenshot sets).
|
|
133
158
|
- `context` (`string`, optional): high-level hint (examples: `ui`, `diagram`, `chart`, `error`, `code`, `meeting`, `tutorial`, `photo`).
|
|
134
159
|
- `question` (`string`, optional): what you want to extract/answer.
|
|
135
160
|
- `language` (`string`, optional): preferred response language (ISO 639-1; e.g., `es`, `en`). If omitted, uses `ENRIVISION_DEFAULT_LANGUAGE` when set.
|
|
136
161
|
- `analysis_mode` (`string`, optional): `auto` | `single` | `multipass`.
|
|
137
162
|
- `max_frames` (`number`, optional): single-pass video frames (`1..20`).
|
|
138
|
-
- `
|
|
163
|
+
- `model` (`string`, optional): model id for server-side dispatch affinity (max 128 chars; env `ENRIVISION_MODEL`; omit for auto-dispatch).
|
|
164
|
+
- `region` (`object`, optional): relative `[0,1]` zoom box `{x, y, width, height}` for one image (native-resolution reading of small text); single images only.
|
|
165
|
+
- `transcribe` (`boolean`, optional): enable/disable transcription (videos). Has no effect on images/documents (declared in `warnings`, ignored).
|
|
139
166
|
- `transcription_language` (`string`, optional): whisper hint (`auto`, `es`, `en`, ...).
|
|
140
167
|
|
|
168
|
+
Continuation:
|
|
169
|
+
|
|
170
|
+
- `cursor` (`string`, optional): opaque cursor from a truncated response (`segment_summaries_cursor` or `transcription_segments_cursor`); reads the next window without re-analyzing.
|
|
171
|
+
- `offset` (`integer`, optional): continuation start index (defaults to the response `next_offset`).
|
|
172
|
+
- `limit` (`integer`, optional): continuation window length (`1..100`; defaults to the server window size).
|
|
173
|
+
|
|
141
174
|
Video targeting:
|
|
142
175
|
|
|
143
176
|
- `video.clip_start_seconds` (`number`, optional)
|
|
144
177
|
- `video.clip_duration_seconds` (`number`, optional)
|
|
178
|
+
- `video.clip_end_seconds` (`number`, optional; end = start + duration, wins over `clip_duration_seconds`)
|
|
145
179
|
|
|
146
180
|
Multipass tuning (advanced; used only for `analysis_mode: multipass`):
|
|
147
181
|
|
|
@@ -169,7 +203,7 @@ Example `arguments` object:
|
|
|
169
203
|
|
|
170
204
|
```jsonc
|
|
171
205
|
{
|
|
172
|
-
"path": "C
|
|
206
|
+
"path": "C:\\path\\to\\video.mp4",
|
|
173
207
|
"question": "What are the key steps demonstrated?",
|
|
174
208
|
"analysis_mode": "auto",
|
|
175
209
|
"transcribe": true,
|
|
@@ -209,6 +243,6 @@ Images:
|
|
|
209
243
|
|
|
210
244
|
Documents:
|
|
211
245
|
|
|
212
|
-
- `.pdf`, `.docx`, `.pptx`, `.xlsx
|
|
246
|
+
- `.pdf`, `.docx`, `.pptx`, `.xlsx`
|
|
213
247
|
|
|
214
248
|
</details>
|