@cueai/omni-reader-mcp 1.1.2 → 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/README.md +139 -80
- package/dist/artifact-store.d.ts +58 -0
- package/dist/artifact-store.js +449 -5
- package/dist/capabilities.d.ts +92 -0
- package/dist/capabilities.js +123 -0
- package/dist/constants.d.ts +34 -1
- package/dist/constants.js +39 -1
- package/dist/cube-client.d.ts +3 -0
- package/dist/cube-client.js +141 -9
- package/dist/cursor.d.ts +12 -0
- package/dist/cursor.js +89 -9
- package/dist/operation-journal.d.ts +19 -5
- package/dist/operation-journal.js +435 -73
- package/dist/operation-manager.d.ts +7 -2
- package/dist/operation-manager.js +215 -16
- package/dist/protocol.d.ts +16 -3
- package/dist/protocol.js +25 -1
- package/dist/remote-client.d.ts +4 -2
- package/dist/remote-client.js +155 -13
- package/dist/result-bundle.d.ts +21 -0
- package/dist/result-bundle.js +320 -0
- package/dist/result-contract.d.ts +398 -4
- package/dist/result-contract.js +175 -19
- package/dist/server.d.ts +17 -0
- package/dist/server.js +45 -1
- package/dist/tools.d.ts +7 -3
- package/dist/tools.js +77 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,87 +1,110 @@
|
|
|
1
1
|
# @cueai/omni-reader-mcp
|
|
2
2
|
|
|
3
|
-
Omni Bridge
|
|
3
|
+
Omni Bridge is the unified local stdio facade for agents. The user provides only the
|
|
4
|
+
source; Bridge handles an HTTPS URL or a local file inside an authorized directory
|
|
5
|
+
through the same `parse(source)` call — no "local/remote", "upload/URL", or internal
|
|
6
|
+
service choice.
|
|
4
7
|
|
|
5
|
-
##
|
|
8
|
+
## User journey
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
Tell the agent the source and the follow-up task:
|
|
8
11
|
|
|
9
12
|
```text
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
Parse ./report.pdf with Omni
|
|
14
|
+
Parse https://example.com/report.pdf with Omni
|
|
15
|
+
Parse ./report.pdf with Omni and summarize the revenue changes
|
|
13
16
|
```
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
URLs never require installing Bridge. For local files, the agent should first explain the
|
|
19
|
+
minimal directory authorization and data handling and obtain confirmation, then install
|
|
20
|
+
a pinned Bridge version. After parsing completes, the agent continues the original task —
|
|
21
|
+
summarization, Q&A, field extraction — rather than stopping at "parse done".
|
|
16
22
|
|
|
17
|
-
##
|
|
23
|
+
## Requirements
|
|
18
24
|
|
|
19
|
-
- Node.js 20.12
|
|
20
|
-
- Cue API Key
|
|
21
|
-
-
|
|
22
|
-
-
|
|
25
|
+
- Node.js 20.12 or newer.
|
|
26
|
+
- Cue API Key: <https://cuecue.cn/api-key>.
|
|
27
|
+
- New accounts receive free credits to try; the current grant and daily allowance follow
|
|
28
|
+
the server-side onboarding policy and the `doctor` output.
|
|
29
|
+
- Configure `CUE_API_KEY` in the agent's secret store or local environment.
|
|
30
|
+
**Never paste the API Key into a conversation.**
|
|
23
31
|
|
|
24
|
-
Bridge
|
|
32
|
+
Bridge reads only these product configuration variables at runtime:
|
|
25
33
|
|
|
26
34
|
- `CUE_API_KEY`
|
|
27
35
|
- `OMNI_ALLOWED_ROOTS`
|
|
28
36
|
|
|
29
|
-
`OMNI_ALLOWED_ROOTS`
|
|
37
|
+
`OMNI_ALLOWED_ROOTS` is only for additional absolute directories the user explicitly
|
|
38
|
+
authorizes; colon-separated on macOS/Linux, semicolon-separated on Windows. The current
|
|
39
|
+
agent workspace remains the default allowed scope.
|
|
30
40
|
|
|
31
|
-
##
|
|
41
|
+
## Installation and configuration
|
|
32
42
|
|
|
33
|
-
|
|
43
|
+
Always use an audited exact version, never an implicit `latest`:
|
|
34
44
|
|
|
35
45
|
```sh
|
|
36
|
-
npx -y @cueai/omni-reader-mcp@1.
|
|
46
|
+
npx -y @cueai/omni-reader-mcp@1.2.0 setup
|
|
37
47
|
```
|
|
38
48
|
|
|
39
|
-
|
|
49
|
+
The interactive setup supports Hermes, Cursor, Claude Desktop, and generic stdio
|
|
50
|
+
configuration. Non-interactive installation uses the same argument parsing and write
|
|
51
|
+
logic:
|
|
40
52
|
|
|
41
53
|
```sh
|
|
42
|
-
npx -y @cueai/omni-reader-mcp@1.
|
|
43
|
-
npx -y @cueai/omni-reader-mcp@1.
|
|
44
|
-
npx -y @cueai/omni-reader-mcp@1.
|
|
54
|
+
npx -y @cueai/omni-reader-mcp@1.2.0 setup --client hermes --allowed-root /absolute/minimum/root --yes --json
|
|
55
|
+
npx -y @cueai/omni-reader-mcp@1.2.0 setup --client cursor --add-root /absolute/minimum/root --yes --json
|
|
56
|
+
npx -y @cueai/omni-reader-mcp@1.2.0 setup --client claude-desktop --allowed-root /absolute/minimum/root --yes --json
|
|
45
57
|
```
|
|
46
58
|
|
|
47
|
-
|
|
59
|
+
When an agent or script runs under a pty (stdin is still a TTY), declare non-interactive
|
|
60
|
+
mode explicitly with `--headless` (alias `--non-interactive`): no `--yes` is required and
|
|
61
|
+
stdin is never read:
|
|
48
62
|
|
|
49
63
|
```sh
|
|
50
|
-
npx -y @cueai/omni-reader-mcp@1.
|
|
64
|
+
npx -y @cueai/omni-reader-mcp@1.2.0 setup --client cursor --allowed-root /absolute/minimum/root --headless --json
|
|
51
65
|
```
|
|
52
66
|
|
|
53
|
-
##
|
|
67
|
+
## Cache and journal isolation
|
|
54
68
|
|
|
55
|
-
|
|
69
|
+
The local parse cache and operation journal default to the user-level cache directory
|
|
70
|
+
(macOS `~/Library/Caches/cue/omni-reader-mcp`, Windows
|
|
71
|
+
`%LOCALAPPDATA%\Cue\omni-reader-mcp\Cache`, Linux `~/.cache/cue/omni-reader-mcp`). If the
|
|
72
|
+
agent's file watcher (e.g. WorkBuddy) locks files under that directory and writes fail,
|
|
73
|
+
set `OMNI_CACHE_DIR` to isolate cache and journal together into a directory that is not
|
|
74
|
+
watched:
|
|
56
75
|
|
|
57
76
|
```sh
|
|
58
77
|
export OMNI_CACHE_DIR=/var/cache/omni-reader
|
|
59
78
|
```
|
|
60
79
|
|
|
61
|
-
|
|
80
|
+
An explicit `OMNI_CACHE_DIR` is never rewritten to a temporary directory by the
|
|
81
|
+
project-overlap check; mutual containment with a project directory remains forbidden.
|
|
62
82
|
|
|
63
|
-
setup
|
|
83
|
+
`setup` will:
|
|
64
84
|
|
|
65
|
-
1.
|
|
66
|
-
2.
|
|
67
|
-
3.
|
|
68
|
-
4.
|
|
69
|
-
5.
|
|
70
|
-
6.
|
|
85
|
+
1. show the user-scope configuration target and changes;
|
|
86
|
+
2. write a single, exact-version `omni-reader` facade;
|
|
87
|
+
3. use a private lock, trusted backup, and atomic replacement;
|
|
88
|
+
4. verify the Omni secure parse environment;
|
|
89
|
+
5. restore the previous configuration when verification fails;
|
|
90
|
+
6. prompt the corresponding agent to reload or restart.
|
|
71
91
|
|
|
72
|
-
|
|
92
|
+
Configuration never writes the API Key in plaintext. Hermes uses native separate
|
|
93
|
+
`command`, `args`, and safe environment variable references.
|
|
73
94
|
|
|
74
|
-
## Agent
|
|
95
|
+
## Agent calling rules
|
|
75
96
|
|
|
76
|
-
|
|
97
|
+
Agents pass the user-provided source string directly to `parse(source)`:
|
|
77
98
|
|
|
78
|
-
-
|
|
79
|
-
- Do not read, attach, base64-encode, or insert the file content into the conversation
|
|
80
|
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
99
|
+
- Only HTTP(S) is treated as a URL; a plain string is treated as a local path.
|
|
100
|
+
- Do not read, attach, base64-encode, or insert the file content into the conversation
|
|
101
|
+
before calling Omni.
|
|
102
|
+
- Do not use `file://`, localhost, or public temporary upload sites as a fallback.
|
|
103
|
+
- Confirm before installing Bridge or widening the allowed roots.
|
|
104
|
+
- Prefer the existing `operation_id` for status recovery; never re-upload or duplicate a
|
|
105
|
+
parse for a timeout.
|
|
83
106
|
|
|
84
|
-
|
|
107
|
+
The public tools are fixed:
|
|
85
108
|
|
|
86
109
|
- `parse`
|
|
87
110
|
- `get_parse_status`
|
|
@@ -89,66 +112,102 @@ Agent 将用户提供的来源字符串直接传给 `parse(source)`:
|
|
|
89
112
|
- `read_result`
|
|
90
113
|
- `discard_result`
|
|
91
114
|
|
|
92
|
-
|
|
115
|
+
Every tool returns `structuredContent` with a strict `outputSchema`, plus an equivalent
|
|
116
|
+
fallback for clients that only read legacy MCP `content[].text`:
|
|
93
117
|
|
|
94
|
-
|
|
118
|
+
- when `parse` completes and the result is inlineable, text returns the full Markdown
|
|
119
|
+
directly;
|
|
120
|
+
- for processing, artifact, cleanup, cancel, expired, and failure states, text returns
|
|
121
|
+
compact JSON equivalent to the `structuredContent` fields;
|
|
122
|
+
- the `read_result` text JSON contains the current `result.text` and an optional
|
|
123
|
+
`next_cursor`; clients must exhaust all cursors before concatenating the body;
|
|
124
|
+
- the `discard_result` text JSON explicitly returns `discarded`; never claim deletion on
|
|
125
|
+
call success alone.
|
|
95
126
|
|
|
96
|
-
|
|
127
|
+
This gives clients that do not render `structuredContent` the operation/result handles
|
|
128
|
+
and the full body without changing the contract for structured-capable clients.
|
|
97
129
|
|
|
98
|
-
|
|
99
|
-
- 超过 15 秒:返回可恢复的 processing operation。
|
|
100
|
-
- 客户端明确请求且支持 MCP Tasks 时,Bridge 使用 task。
|
|
101
|
-
- 其他客户端使用 `get_parse_status` 的有界轮询;不承诺客户端不支持的主动通知。
|
|
130
|
+
## Foreground, background, and progress
|
|
102
131
|
|
|
103
|
-
|
|
132
|
+
The foreground budget of every parse is fixed at **15 seconds**:
|
|
104
133
|
|
|
105
|
-
|
|
134
|
+
- completes within 15 seconds: the full result is returned directly;
|
|
135
|
+
- exceeds 15 seconds: a recoverable processing operation is returned;
|
|
136
|
+
- when the client explicitly requests it and supports MCP Tasks, Bridge uses a task;
|
|
137
|
+
- other clients use bounded polling of `get_parse_status`; proactive notifications that
|
|
138
|
+
the client does not support are not promised.
|
|
106
139
|
|
|
107
|
-
|
|
140
|
+
processing/task status contains only the operation, stage, percentage, and an optional
|
|
141
|
+
authoritative unit progress. Available units are only `page`, `sheet`, `slide`, `frame`,
|
|
142
|
+
`segment`. Status never contains the result body, previews, Markdown, page images, crop
|
|
143
|
+
images, or accumulated partial output.
|
|
108
144
|
|
|
109
|
-
|
|
110
|
-
- Omni 创建的处理副本和临时数据在完成后主动清理。
|
|
111
|
-
- 加密交付数据在 ACK 后删除;未确认 ACK 时最迟在 **10 分钟**交付窗口到期。
|
|
112
|
-
- 只有远端 ACK 和清理已确认后才返回 `completed`。
|
|
113
|
-
- 本地结果已保留但远端清理仍不确定时返回 `cleanup_pending`,不会提前声称已删除。
|
|
114
|
-
- 超过 64 KiB 的结果可以保存在用户私有 Bridge cache,最长 **24 小时**;这与远端 10 分钟交付窗口是两类不同数据。
|
|
115
|
-
- `read_result` 分块读取本地结果;`discard_result` 可立即删除指定结果;`clean` 清理 Bridge 创建的本地 artifact 和到期记录。
|
|
145
|
+
## Data handling and retention
|
|
116
146
|
|
|
117
|
-
|
|
147
|
+
Both URL and local files use mandatory no-store semantics and enter the
|
|
148
|
+
**Omni secure parse environment**:
|
|
118
149
|
|
|
119
|
-
|
|
150
|
+
- the original local file on the user's machine stays unchanged; URL sources are never
|
|
151
|
+
modified or deleted;
|
|
152
|
+
- processing copies and temporary data created by Omni are actively cleaned after
|
|
153
|
+
completion;
|
|
154
|
+
- encrypted delivery data is deleted after ACK; without a confirmed ACK, at the latest
|
|
155
|
+
when the **10-minute** delivery window expires;
|
|
156
|
+
- `completed` is returned only after the remote ACK and cleanup are confirmed;
|
|
157
|
+
- `cleanup_pending` is returned when the local result is retained but remote cleanup is
|
|
158
|
+
still uncertain — never claim deletion prematurely;
|
|
159
|
+
- results over 64 KiB may be kept in the user's private Bridge cache for up to
|
|
160
|
+
**24 hours**; this is a different class of data from the remote 10-minute delivery
|
|
161
|
+
window;
|
|
162
|
+
- `read_result` reads local results in chunks; `discard_result` deletes a specific result
|
|
163
|
+
immediately; `clean` removes Bridge-created local artifacts and expired records.
|
|
120
164
|
|
|
121
|
-
|
|
165
|
+
Status queries, result reads, and discards never create a new parse or usage event.
|
|
166
|
+
`cancel_parse` reports only the real settlement state confirmed by the server and never
|
|
167
|
+
causes a second billing by itself.
|
|
122
168
|
|
|
123
|
-
|
|
124
|
-
- `UNSUPPORTED_MEDIA_TYPE`:媒体类型不受支持,并返回当前权威 `supported_extensions`。
|
|
169
|
+
## Constraint errors
|
|
125
170
|
|
|
126
|
-
|
|
171
|
+
Bridge validates the local source before grant, upload, and billing:
|
|
127
172
|
|
|
128
|
-
|
|
173
|
+
- `SOURCE_TOO_LARGE`: exceeds the current 256 MiB cap, with machine-readable
|
|
174
|
+
`constraints.max_bytes`.
|
|
175
|
+
- `UNSUPPORTED_MEDIA_TYPE`: unsupported media type, with the current authoritative
|
|
176
|
+
`supported_extensions`.
|
|
177
|
+
|
|
178
|
+
Agents should not auto-split, transcode, or upload to public sites; ask the user for a
|
|
179
|
+
new source that satisfies the constraints.
|
|
180
|
+
|
|
181
|
+
## Commands
|
|
129
182
|
|
|
130
183
|
```sh
|
|
131
|
-
npx -y @cueai/omni-reader-mcp@1.
|
|
132
|
-
npx -y @cueai/omni-reader-mcp@1.
|
|
133
|
-
npx -y @cueai/omni-reader-mcp@1.
|
|
134
|
-
npx -y @cueai/omni-reader-mcp@1.
|
|
184
|
+
npx -y @cueai/omni-reader-mcp@1.2.0 doctor
|
|
185
|
+
npx -y @cueai/omni-reader-mcp@1.2.0 doctor --json
|
|
186
|
+
npx -y @cueai/omni-reader-mcp@1.2.0 clean
|
|
187
|
+
npx -y @cueai/omni-reader-mcp@1.2.0 uninstall --yes --json
|
|
135
188
|
```
|
|
136
189
|
|
|
137
|
-
|
|
190
|
+
Running the pinned version without a command starts the stdio MCP server:
|
|
138
191
|
|
|
139
192
|
```sh
|
|
140
|
-
npx -y @cueai/omni-reader-mcp@1.
|
|
193
|
+
npx -y @cueai/omni-reader-mcp@1.2.0
|
|
141
194
|
```
|
|
142
195
|
|
|
143
|
-
`doctor --json`
|
|
196
|
+
`doctor --json` returns package/npm/client adapter, Key present/absent, allowed-root
|
|
197
|
+
safety status, endpoint compatibility, artifacts, cache mode, onboarding, and reload
|
|
198
|
+
status; it never prints the Key, private source paths, or content.
|
|
144
199
|
|
|
145
|
-
##
|
|
200
|
+
## Uninstall and rollback
|
|
146
201
|
|
|
147
|
-
`uninstall --yes --json`
|
|
202
|
+
`uninstall --yes --json` removes only the currently trusted 1.2.0 Bridge entry; when a
|
|
203
|
+
matching trusted backup exists, it restores the original URL-only `omni-reader` entry.
|
|
204
|
+
Uninstall never deletes user source files and never silently removes unexpired local
|
|
205
|
+
results.
|
|
148
206
|
|
|
149
|
-
|
|
207
|
+
To roll back from 1.1.1:
|
|
150
208
|
|
|
151
|
-
1.
|
|
152
|
-
2.
|
|
153
|
-
3.
|
|
154
|
-
|
|
209
|
+
1. stop recommending or installing that version;
|
|
210
|
+
2. run `uninstall --yes --json` to restore the trusted URL-only entry;
|
|
211
|
+
3. for already-uploaded operations, continue using status recovery so settlement and
|
|
212
|
+
cleanup complete;
|
|
213
|
+
4. keep local results, or have the user explicitly run `discard_result` / `clean`.
|
package/dist/artifact-store.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { FileHandle } from "node:fs/promises";
|
|
2
2
|
import type { ReleasedMetadata, ResultRetentionSink, ResultRetentionStart } from "./iiis-client.js";
|
|
3
|
+
import { GROUNDING_SCHEMA_VERSION, RESULT_BUNDLE_PROTOCOL_VERSION } from "./protocol.js";
|
|
4
|
+
import { type VerifiedBundle } from "./result-bundle.js";
|
|
3
5
|
export interface ArtifactStoreOptions {
|
|
4
6
|
readonly rootDirectory?: string;
|
|
5
7
|
readonly projectDirectory?: string;
|
|
@@ -41,6 +43,59 @@ export interface ArtifactReadResult {
|
|
|
41
43
|
readonly text: string;
|
|
42
44
|
readonly nextCursor?: string;
|
|
43
45
|
}
|
|
46
|
+
export type BundlePartName = "content" | "grounding";
|
|
47
|
+
export type BundleContentStorage = {
|
|
48
|
+
readonly kind: "inline";
|
|
49
|
+
readonly text: string;
|
|
50
|
+
} | {
|
|
51
|
+
readonly kind: "artifact";
|
|
52
|
+
readonly nextCursor: string;
|
|
53
|
+
};
|
|
54
|
+
export type BundleGroundingStorage = {
|
|
55
|
+
readonly kind: "inline";
|
|
56
|
+
readonly value: unknown;
|
|
57
|
+
} | {
|
|
58
|
+
readonly kind: "artifact";
|
|
59
|
+
readonly nextCursor: string;
|
|
60
|
+
};
|
|
61
|
+
export interface BundleLocalResult {
|
|
62
|
+
readonly kind: "bundle";
|
|
63
|
+
readonly operationId: string;
|
|
64
|
+
readonly resultId: string;
|
|
65
|
+
readonly detail: "grounded" | "layout";
|
|
66
|
+
readonly bundleBytes: number;
|
|
67
|
+
readonly bundleDigest: string;
|
|
68
|
+
readonly expiresAt: string;
|
|
69
|
+
readonly bundleProtocolVersion: typeof RESULT_BUNDLE_PROTOCOL_VERSION;
|
|
70
|
+
readonly groundingSchemaVersion: typeof GROUNDING_SCHEMA_VERSION;
|
|
71
|
+
readonly parts: {
|
|
72
|
+
readonly content: {
|
|
73
|
+
readonly part: "content";
|
|
74
|
+
readonly mediaType: "text/markdown; charset=utf-8";
|
|
75
|
+
readonly resultBytes: number;
|
|
76
|
+
readonly digest: string;
|
|
77
|
+
readonly storage: BundleContentStorage;
|
|
78
|
+
};
|
|
79
|
+
readonly grounding: {
|
|
80
|
+
readonly part: "grounding";
|
|
81
|
+
readonly mediaType: "application/vnd.cue.omni-grounding+json; version=1";
|
|
82
|
+
readonly resultBytes: number;
|
|
83
|
+
readonly digest: string;
|
|
84
|
+
readonly storage: BundleGroundingStorage;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
export interface BundlePartReadChunk {
|
|
89
|
+
readonly resultId: string;
|
|
90
|
+
readonly part: BundlePartName;
|
|
91
|
+
readonly mediaType: "text/markdown; charset=utf-8" | "application/vnd.cue.omni-grounding+json; version=1";
|
|
92
|
+
readonly resultBytes: number;
|
|
93
|
+
readonly offset: number;
|
|
94
|
+
readonly decodedBytes: number;
|
|
95
|
+
readonly text: string;
|
|
96
|
+
readonly nextCursor?: string;
|
|
97
|
+
readonly expiresAt: string;
|
|
98
|
+
}
|
|
44
99
|
interface ArtifactFinalizeInput extends ReleasedMetadata {
|
|
45
100
|
readonly resultId: string;
|
|
46
101
|
}
|
|
@@ -54,10 +109,12 @@ export declare class ArtifactStore {
|
|
|
54
109
|
get rootDirectory(): string;
|
|
55
110
|
createRetention(): LocalResultRetention;
|
|
56
111
|
read(resultId: string, cursor?: string, maxBytes?: number): Promise<ArtifactReadResult>;
|
|
112
|
+
readBundlePart(resultId: string, cursor: string, maxBytes?: number): Promise<BundlePartReadChunk>;
|
|
57
113
|
discard(resultId: string): Promise<boolean>;
|
|
58
114
|
cleanupExpired(): Promise<number>;
|
|
59
115
|
close(): Promise<void>;
|
|
60
116
|
_finalizeArtifact(temporaryPath: string, metadata: ArtifactFinalizeInput): Promise<ArtifactResult>;
|
|
117
|
+
_finalizeBundle(resultId: string, verified: VerifiedBundle, metadata: ReleasedMetadata): Promise<BundleLocalResult>;
|
|
61
118
|
_newTemporaryArtifact(): Promise<{
|
|
62
119
|
resultId: string;
|
|
63
120
|
temporaryPath: string;
|
|
@@ -72,6 +129,7 @@ export declare class LocalResultRetention implements ResultRetentionSink {
|
|
|
72
129
|
write(chunk: Uint8Array): Promise<void>;
|
|
73
130
|
complete(metadata: ReleasedMetadata): Promise<void>;
|
|
74
131
|
result(): LocalResult;
|
|
132
|
+
bundleResult(): BundleLocalResult;
|
|
75
133
|
abort(): Promise<void>;
|
|
76
134
|
}
|
|
77
135
|
export {};
|