@barivia/barsom-mcp 0.23.8 → 0.23.9
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/dist/shared.js +1 -1
- package/dist/tools/datasets.js +10 -6
- package/package.json +1 -1
package/dist/shared.js
CHANGED
|
@@ -39,7 +39,7 @@ function newRequestId() {
|
|
|
39
39
|
* X-Barsom-Client-Version so the server can annotate tool guidance with the
|
|
40
40
|
* wrapper version each action requires. Keep in sync with package.json on bump.
|
|
41
41
|
*/
|
|
42
|
-
export const CLIENT_VERSION = "0.23.
|
|
42
|
+
export const CLIENT_VERSION = "0.23.9";
|
|
43
43
|
/** User-facing links; keep aligned with barivia.se / api.barivia.se. */
|
|
44
44
|
export const PUBLIC_SITE_ORIGIN = "https://barivia.se";
|
|
45
45
|
/** Self-serve account dashboard (manage plan, billing, and API keys). */
|
package/dist/tools/datasets.js
CHANGED
|
@@ -8,6 +8,10 @@ import { apiCall, getWorkspaceRootAsync, resolveFilePathForUpload, textResult, s
|
|
|
8
8
|
import { GZIP_UPLOAD_HINT } from "../job_status_format.js";
|
|
9
9
|
import { formatDatasetInventoryLine, formatTags } from "../inventory_format.js";
|
|
10
10
|
import { PERIODICITY_ROW_ORDER_NOTE, SMALL_N_SOFT, buildCpuScaleGuidanceLines, buildSmallNGuardrailLines, } from "../training_scale_guidance.js";
|
|
11
|
+
/** Percent-encode header values so Node fetch accepts Unicode (ByteString limit). */
|
|
12
|
+
function encodeHeaderValue(s) {
|
|
13
|
+
return encodeURIComponent(s);
|
|
14
|
+
}
|
|
11
15
|
/**
|
|
12
16
|
* Normalize a nullable string field from the API. Returns "" for absent values,
|
|
13
17
|
* empty strings, and the literal SQL/serialization sentinels "missing"/"null"
|
|
@@ -368,15 +372,15 @@ ESCALATION: If upload fails with column errors, open the file locally and verify
|
|
|
368
372
|
if (isGzipInput) {
|
|
369
373
|
const gzBytes = await fs.readFile(resolved);
|
|
370
374
|
const gzHeaders = {
|
|
371
|
-
"X-Dataset-Name": name,
|
|
375
|
+
"X-Dataset-Name": encodeHeaderValue(name),
|
|
372
376
|
"Content-Type": uploadContentType,
|
|
373
377
|
"Content-Encoding": "gzip",
|
|
374
378
|
"Idempotency-Key": createHash("sha256").update(`${name}\n`).update(gzBytes).digest("hex"),
|
|
375
379
|
};
|
|
376
380
|
if (description !== undefined)
|
|
377
|
-
gzHeaders["X-Dataset-Description"] = description;
|
|
381
|
+
gzHeaders["X-Dataset-Description"] = encodeHeaderValue(description);
|
|
378
382
|
if (tags !== undefined)
|
|
379
|
-
gzHeaders["X-Dataset-Tags"] = JSON.stringify(tags);
|
|
383
|
+
gzHeaders["X-Dataset-Tags"] = encodeHeaderValue(JSON.stringify(tags));
|
|
380
384
|
const data = await awaitDatasetStageIfNeeded((await apiCall("POST", "/v1/datasets", gzBytes, gzHeaders, UPLOAD_DATASET_TIMEOUT_MS)));
|
|
381
385
|
const gid = data.id ?? data.dataset_id;
|
|
382
386
|
if (gid != null)
|
|
@@ -395,16 +399,16 @@ ESCALATION: If upload fails with column errors, open the file locally and verify
|
|
|
395
399
|
// cap) small; the API transparently decompresses. Small bodies stay plain.
|
|
396
400
|
const GZIP_THRESHOLD = 1024 * 1024; // 1 MB
|
|
397
401
|
const uploadHeaders = {
|
|
398
|
-
"X-Dataset-Name": name,
|
|
402
|
+
"X-Dataset-Name": encodeHeaderValue(name),
|
|
399
403
|
"Content-Type": uploadContentType,
|
|
400
404
|
// Deterministic key so a timed-out retry of the SAME upload reconciles to
|
|
401
405
|
// the original dataset server-side instead of creating a duplicate.
|
|
402
406
|
"Idempotency-Key": createHash("sha256").update(`${name}\n`).update(body).digest("hex"),
|
|
403
407
|
};
|
|
404
408
|
if (description !== undefined)
|
|
405
|
-
uploadHeaders["X-Dataset-Description"] = description;
|
|
409
|
+
uploadHeaders["X-Dataset-Description"] = encodeHeaderValue(description);
|
|
406
410
|
if (tags !== undefined)
|
|
407
|
-
uploadHeaders["X-Dataset-Tags"] = JSON.stringify(tags);
|
|
411
|
+
uploadHeaders["X-Dataset-Tags"] = encodeHeaderValue(JSON.stringify(tags));
|
|
408
412
|
let uploadBody = body;
|
|
409
413
|
if (Buffer.byteLength(body, "utf-8") > GZIP_THRESHOLD) {
|
|
410
414
|
uploadBody = gzipSync(Buffer.from(body, "utf-8"));
|