@cueai/omni-reader-mcp 1.5.5 → 1.6.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 +70 -37
- package/dist/artifact-store.d.ts +2 -0
- package/dist/artifact-store.js +45 -10
- package/dist/cli/agent-config.js +2 -2
- package/dist/cli/arguments.d.ts +8 -4
- package/dist/cli/arguments.js +62 -7
- package/dist/cli/config-inspection.d.ts +59 -0
- package/dist/cli/config-inspection.js +307 -0
- package/dist/cli/doctor.d.ts +7 -0
- package/dist/cli/doctor.js +37 -2
- package/dist/cli/setup.js +13 -2
- package/dist/constants.d.ts +2 -1
- package/dist/constants.js +4 -3
- package/dist/cursor.d.ts +4 -0
- package/dist/cursor.js +11 -13
- package/dist/index.js +10 -1
- package/dist/operation-journal.d.ts +4 -1
- package/dist/operation-journal.js +85 -15
- package/dist/operation-manager.d.ts +6 -2
- package/dist/operation-manager.js +246 -63
- package/dist/path-normalization.d.ts +5 -0
- package/dist/path-normalization.js +25 -0
- package/dist/path-security.d.ts +2 -1
- package/dist/path-security.js +49 -28
- package/dist/protocol.d.ts +10 -2
- package/dist/protocol.js +19 -7
- package/dist/result-contract.d.ts +46 -6
- package/dist/result-contract.js +118 -3
- package/dist/task-runtime.d.ts +3 -2
- package/dist/task-runtime.js +2 -2
- package/dist/tools.d.ts +4 -0
- package/dist/tools.js +37 -16
- package/package.json +1 -1
package/dist/tools.js
CHANGED
|
@@ -7,7 +7,7 @@ import { hydrateInlineUrlResultSafely } from "./operation-manager.js";
|
|
|
7
7
|
import { openAllowedFile, } from "./path-security.js";
|
|
8
8
|
import { NOOP_PROGRESS } from "./progress.js";
|
|
9
9
|
import { MACHINE_INSTRUCTIONS, cancelParseSchema, discardResultSchema, getParseStatusSchema, normalizeParseArguments, normalizeRepresentation, parseSchema, parseSchemaShape, readOutlineSchema, readResultSchema, saveResultSchema, } from "./protocol.js";
|
|
10
|
-
import { discardResultOutputSchema, discardResultToolOutputSchema, localResultToResultField, parseResultSchema, parseToolOutputSchema, readOutlineOutputSchema, readOutlineToolOutputSchema, readResultOutputSchema, readResultToolOutputSchema, saveResultOutputSchema, saveResultToolOutputSchema, structuredResult, } from "./result-contract.js";
|
|
10
|
+
import { createFlatLocalResultCache, discardResultOutputSchema, discardResultToolOutputSchema, localResultToResultField, parseResultSchema, parseToolOutputSchema, presentRetainedResult, readOutlineOutputSchema, readOutlineToolOutputSchema, readResultOutputSchema, readResultToolOutputSchema, saveResultOutputSchema, saveResultToolOutputSchema, structuredResult, } from "./result-contract.js";
|
|
11
11
|
import { classifySource } from "./source.js";
|
|
12
12
|
import { TaskRuntime } from "./task-runtime.js";
|
|
13
13
|
function bridgeError(code, message, facts = {}) {
|
|
@@ -58,9 +58,11 @@ function completedLocalResult(local) {
|
|
|
58
58
|
operation_id: local.operationId,
|
|
59
59
|
result,
|
|
60
60
|
data_handling: dataHandling,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
:
|
|
61
|
+
local_result_cache: createFlatLocalResultCache({
|
|
62
|
+
resultId: local.resultId,
|
|
63
|
+
resultBytes: local.resultBytes,
|
|
64
|
+
expiresAt: local.expiresAt,
|
|
65
|
+
}),
|
|
64
66
|
};
|
|
65
67
|
}
|
|
66
68
|
async function parseLocal(args, clientRequestId, signal, progress, dependencies) {
|
|
@@ -151,6 +153,23 @@ async function preflightNonTextRepresentation(detail, sourceKind, signal, depend
|
|
|
151
153
|
});
|
|
152
154
|
}
|
|
153
155
|
}
|
|
156
|
+
async function preflightArtifactDelivery(args, dependencies) {
|
|
157
|
+
if (args.resultDelivery !== "artifact")
|
|
158
|
+
return;
|
|
159
|
+
if (dependencies.artifactStore.preflightWrite === undefined
|
|
160
|
+
|| dependencies.artifactStore.mintReadCursor === undefined) {
|
|
161
|
+
throw bridgeError("ARTIFACT_PREFLIGHT_FAILED", "The local result store cannot provide artifact delivery.");
|
|
162
|
+
}
|
|
163
|
+
await dependencies.artifactStore.preflightWrite();
|
|
164
|
+
}
|
|
165
|
+
async function presentParseResult(result, args, dependencies) {
|
|
166
|
+
return presentRetainedResult(result, args.resultDelivery, async (resultId, byteOffset) => {
|
|
167
|
+
if (dependencies.artifactStore.mintReadCursor === undefined) {
|
|
168
|
+
throw bridgeError("LOCAL_RESULT_INTEGRITY_FAILED", "The retained result cursor capability is unavailable.");
|
|
169
|
+
}
|
|
170
|
+
return dependencies.artifactStore.mintReadCursor(resultId, byteOffset);
|
|
171
|
+
});
|
|
172
|
+
}
|
|
154
173
|
async function parseValue(args, signal, progress, dependencies) {
|
|
155
174
|
try {
|
|
156
175
|
const source = classifySource(args.source);
|
|
@@ -198,19 +217,23 @@ async function parseValue(args, signal, progress, dependencies) {
|
|
|
198
217
|
},
|
|
199
218
|
clientRequestId,
|
|
200
219
|
signal,
|
|
220
|
+
resultDelivery: args.resultDelivery,
|
|
201
221
|
context: source.kind === "local"
|
|
202
222
|
? { source: source.source, progress }
|
|
203
223
|
: { source: source.source },
|
|
204
224
|
});
|
|
205
225
|
}
|
|
226
|
+
await preflightArtifactDelivery(args, dependencies);
|
|
206
227
|
if (source.kind === "url") {
|
|
207
228
|
if (dependencies.remoteClient === undefined) {
|
|
208
229
|
throw bridgeError("REMOTE_PARSE_UNAVAILABLE", "Remote URL parsing is not available in this Bridge build.", { retryable: true });
|
|
209
230
|
}
|
|
210
231
|
const remoteResult = await dependencies.remoteClient.parse(source.source, clientRequestId, signal);
|
|
211
|
-
|
|
232
|
+
const hydrated = await hydrateInlineUrlResultSafely(remoteResult, dependencies.artifactStore);
|
|
233
|
+
return presentParseResult(hydrated, args, dependencies);
|
|
212
234
|
}
|
|
213
|
-
|
|
235
|
+
const localResult = await parseLocal(args, clientRequestId, signal, progress, dependencies);
|
|
236
|
+
return presentParseResult(localResult, args, dependencies);
|
|
214
237
|
}
|
|
215
238
|
catch (error) {
|
|
216
239
|
return failed(error);
|
|
@@ -325,10 +348,14 @@ async function callReadResult(resultId, cursor, maxBytes, dependencies) {
|
|
|
325
348
|
}
|
|
326
349
|
async function callDiscardResult(resultId, dependencies) {
|
|
327
350
|
try {
|
|
351
|
+
const discarded = await dependencies.artifactStore.discard(resultId);
|
|
352
|
+
if (!discarded) {
|
|
353
|
+
throw bridgeError("RESULT_NOT_FOUND", "The requested local result was not found.");
|
|
354
|
+
}
|
|
328
355
|
return structuredResult(discardResultOutputSchema, {
|
|
329
356
|
status: "completed",
|
|
330
357
|
result_id: resultId,
|
|
331
|
-
discarded
|
|
358
|
+
discarded,
|
|
332
359
|
});
|
|
333
360
|
}
|
|
334
361
|
catch (error) {
|
|
@@ -361,13 +388,7 @@ async function callReadOutline(resultId, nodeId, dependencies) {
|
|
|
361
388
|
}
|
|
362
389
|
const node = outline.nodes.find((candidate) => candidate.id === nodeId);
|
|
363
390
|
if (node === undefined) {
|
|
364
|
-
throw bridgeError("OUTLINE_NODE_NOT_FOUND", "The requested outline node does not exist."
|
|
365
|
-
operationCreated: true,
|
|
366
|
-
fileUploaded: true,
|
|
367
|
-
parserStarted: true,
|
|
368
|
-
billed: true,
|
|
369
|
-
contentReleased: true,
|
|
370
|
-
});
|
|
391
|
+
throw bridgeError("OUTLINE_NODE_NOT_FOUND", "The requested outline node does not exist.");
|
|
371
392
|
}
|
|
372
393
|
const cursor = await dependencies.artifactStore.mintOutlineCursor(resultId, node.byteOffset);
|
|
373
394
|
return structuredResult(readOutlineOutputSchema, { status: "cursor", cursor });
|
|
@@ -455,7 +476,7 @@ async function dispatchTool(name, rawArguments, extra, dependencies) {
|
|
|
455
476
|
}
|
|
456
477
|
export function registerOmniTools(server, dependencies, taskStore) {
|
|
457
478
|
const taskRuntime = new TaskRuntime({
|
|
458
|
-
parse: (
|
|
479
|
+
parse: (args, signal) => parseValue(args, signal, NOOP_PROGRESS, dependencies),
|
|
459
480
|
status: (operationId, waitMs, signal) => statusValue(operationId, waitMs, signal, dependencies),
|
|
460
481
|
cancel: (operationId, signal) => cancelValue(operationId, signal, dependencies),
|
|
461
482
|
});
|
|
@@ -466,7 +487,7 @@ export function registerOmniTools(server, dependencies, taskStore) {
|
|
|
466
487
|
ttl: Math.min(600_000, Math.max(1_000, requestedTtl)),
|
|
467
488
|
pollInterval: 1_000,
|
|
468
489
|
});
|
|
469
|
-
void taskRuntime.start(task.taskId, normalized
|
|
490
|
+
void taskRuntime.start(task.taskId, normalized, extra.taskStore)
|
|
470
491
|
.catch(() => undefined);
|
|
471
492
|
return { task };
|
|
472
493
|
};
|