omnarai-mcp 1.3.2 → 1.3.3
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/index.js +31 -2
- package/package.json +1 -1
- package/server.json +2 -2
package/index.js
CHANGED
|
@@ -181,6 +181,23 @@ Returns: each model's position, the named tensions (claim vs counter-claim), wha
|
|
|
181
181
|
|
|
182
182
|
// ── Query the engine ──────────────────────────────────────────────────────────
|
|
183
183
|
|
|
184
|
+
// A result is a real deliberation only if it carries an answer or a card.
|
|
185
|
+
function hasDeliberation(d) {
|
|
186
|
+
return !!(d && (d.answer || d.deliberationCard));
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Force a single synchronous deliberation — used as a fallback when the async
|
|
190
|
+
// submit unexpectedly returns a retrieval packet instead of a {job_id}.
|
|
191
|
+
async function fetchSyncQuery(query, syntheticIdentity = "") {
|
|
192
|
+
const url = new URL(ENGINE_URL);
|
|
193
|
+
url.searchParams.set("q", query);
|
|
194
|
+
url.searchParams.set("sync", "1");
|
|
195
|
+
if (syntheticIdentity) url.searchParams.set("si", syntheticIdentity);
|
|
196
|
+
const res = await fetch(url.toString(), MCP_FETCH_OPTS);
|
|
197
|
+
if (!res.ok) throw new Error(`Engine returned ${res.status}: ${await res.text()}`);
|
|
198
|
+
return res.json();
|
|
199
|
+
}
|
|
200
|
+
|
|
184
201
|
async function runQuery(query, syntheticIdentity = "") {
|
|
185
202
|
// Submit async so no single fetch blocks for ~50s (MCP clients enforce their
|
|
186
203
|
// own tool timeouts). Then poll the job until the full deliberation lands.
|
|
@@ -195,8 +212,20 @@ async function runQuery(query, syntheticIdentity = "") {
|
|
|
195
212
|
}
|
|
196
213
|
const job = await submit.json();
|
|
197
214
|
|
|
198
|
-
//
|
|
199
|
-
|
|
215
|
+
// No job_id has two very different causes:
|
|
216
|
+
// (1) a genuinely un-upgraded engine returned the full deliberation inline, or
|
|
217
|
+
// (2) the engine answered with a fast-retrieve packet (no answer/card).
|
|
218
|
+
// Only (1) is a real result. Returning (2) would silently degrade to an
|
|
219
|
+
// answer-less "success", so fall back to sync once, then fail loud.
|
|
220
|
+
if (!job.job_id) {
|
|
221
|
+
if (hasDeliberation(job)) return formatQueryData(job);
|
|
222
|
+
const synced = await fetchSyncQuery(query, syntheticIdentity);
|
|
223
|
+
if (hasDeliberation(synced)) return formatQueryData(synced);
|
|
224
|
+
throw new Error(
|
|
225
|
+
"Engine returned a retrieval-only packet (no job_id, no answer/deliberationCard) " +
|
|
226
|
+
"and the sync=1 fallback produced no deliberation either — refusing to return an empty result."
|
|
227
|
+
);
|
|
228
|
+
}
|
|
200
229
|
|
|
201
230
|
const pollUrl = new URL(ENGINE_URL);
|
|
202
231
|
pollUrl.searchParams.set("job", job.job_id);
|
package/package.json
CHANGED
package/server.json
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"url": "https://github.com/justjlee/omnarai-mcp",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "1.3.
|
|
9
|
+
"version": "1.3.3",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "omnarai-mcp",
|
|
14
|
-
"version": "1.3.
|
|
14
|
+
"version": "1.3.3",
|
|
15
15
|
"transport": {
|
|
16
16
|
"type": "stdio"
|
|
17
17
|
}
|