@modootoday/datalab-extension-mcp 1.13.1 → 1.15.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.en.md +4 -4
- package/README.md +4 -4
- package/dist/{chunk-4QBQE6BT.js → chunk-FP4B5RSI.js} +396 -11
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -61,7 +61,7 @@ One command finds **every** AI app on your computer and connects them automatica
|
|
|
61
61
|
2. **Paste this command and press Enter.** The helper installs this version of the connector on your computer (`npm install -g`) and registers that installed copy with your AI apps, so an app does not download the connector again each time it starts. Once connected, the connector checks the canonical release and installs a newer version for the next start. Diagnostic environments can opt out with `--no-self-update`.
|
|
62
62
|
|
|
63
63
|
```
|
|
64
|
-
npx -y @modootoday/datalab-extension-mcp@1.
|
|
64
|
+
npx -y @modootoday/datalab-extension-mcp@1.15.0 install
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
Lines of English scrolling by is normal. This installs the connector and adds only our entry to your AI apps' settings — it touches nothing else. Without permission for global npm installs, it falls back to having each app download and run the connector at start (a slower start).
|
|
@@ -231,7 +231,7 @@ Exactly what it says. Open Chrome, keep the DataLab Tools side panel open, and i
|
|
|
231
231
|
|
|
232
232
|
That's expected — **it's deliberate.**
|
|
233
233
|
|
|
234
|
-
There are
|
|
234
|
+
There are 233 tools. Sending all of them as a list runs into the cap each AI app
|
|
235
235
|
sets: some quietly drop whatever doesn't fit, some refuse the connection outright.
|
|
236
236
|
So only the discovery tools go in the list, and **the rest are selected from the
|
|
237
237
|
user's intent and handed over as an answer.**
|
|
@@ -262,7 +262,7 @@ Start it again after a full quit and it picks the tools up. If they still aren't
|
|
|
262
262
|
- **When the connection disappears** — run the very command you used at the start once more; it safely re-registers. (Some AI apps clean up their settings file and drop the connection.)
|
|
263
263
|
|
|
264
264
|
```
|
|
265
|
-
npx -y @modootoday/datalab-extension-mcp@1.
|
|
265
|
+
npx -y @modootoday/datalab-extension-mcp@1.15.0 install
|
|
266
266
|
```
|
|
267
267
|
|
|
268
268
|
- **`'npx' is not recognized...`** — Node.js isn't installed. Follow "No Node.js?" in Step 2, then run the command again.
|
|
@@ -292,7 +292,7 @@ Start it again after a full quit and it picks the tools up. If they still aren't
|
|
|
292
292
|
1. Run this in a terminal (it removes the entries registered in your AI apps).
|
|
293
293
|
|
|
294
294
|
```
|
|
295
|
-
npx -y @modootoday/datalab-extension-mcp@1.
|
|
295
|
+
npx -y @modootoday/datalab-extension-mcp@1.15.0 uninstall
|
|
296
296
|
```
|
|
297
297
|
|
|
298
298
|
2. Turn **MCP 연결** off in the extension settings. The panel is the bridge, so with it off a leftover config line can look nothing up.
|
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ Claude 같은 AI 앱을 데이터랩툴즈에 연결해 주는 작은 무료 프
|
|
|
55
55
|
2. **아래 명령을 붙여넣고 Enter를 눌러요.** 도우미는 이 버전의 연결 프로그램을 이 컴퓨터에 설치(`npm install -g`)하고, AI 앱이 그 설치본을 바로 실행하도록 등록해요. 그래서 AI 앱이 시작할 때 연결 프로그램을 다시 내려받지 않아요. 연결이 열린 뒤 정본 릴리스를 확인해 새 버전이 있으면 설치해 두고, 다음 시작부터 그 버전을 써요. 진단 환경에서는 `--no-self-update`로 이 업데이트를 끌 수 있어요.
|
|
56
56
|
|
|
57
57
|
```
|
|
58
|
-
npx -y @modootoday/datalab-extension-mcp@1.
|
|
58
|
+
npx -y @modootoday/datalab-extension-mcp@1.15.0 install
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
영어 글자가 여러 줄 올라오는 건 정상이에요. 이 명령은 연결 프로그램을 설치하고 AI 앱 설정에 우리 항목만 더할 뿐, 다른 건 건드리지 않아요. npm 전역 설치 권한이 없으면 예전처럼 AI 앱이 시작할 때마다 내려받아 실행하도록 연결해요(시작이 조금 느려요).
|
|
@@ -202,7 +202,7 @@ MCP 를 켜 두었지만 **네이버 페이지가 한 곳도 열려 있지 않
|
|
|
202
202
|
|
|
203
203
|
정상이에요. **일부러 그렇게 보냅니다.**
|
|
204
204
|
|
|
205
|
-
전체 도구는
|
|
205
|
+
전체 도구는 233개인데, 그걸 전부 목록으로 보내면 AI 앱마다 정해 둔 상한에 걸려요.
|
|
206
206
|
어떤 앱은 넘치는 만큼 조용히 잘라내고, 어떤 앱은 아예 연결을 거부해요. 그래서 자주 쓰는
|
|
207
207
|
탐색 도구만 목록에 올리고, 나머지는 **AI가 요청 의도를 찾아 답으로 건네받습니다.**
|
|
208
208
|
|
|
@@ -230,7 +230,7 @@ AI가 "그런 기능은 없다" 고 답하면, **"숨은 도구를 찾아보고
|
|
|
230
230
|
- **연결이 사라졌을 때** — 처음 실행했던 그 명령을 한 번 더 실행하면 안전하게 다시 등록돼요. (일부 AI 앱이 설정 파일을 정리하며 연결을 지우기도 해요.)
|
|
231
231
|
|
|
232
232
|
```
|
|
233
|
-
npx -y @modootoday/datalab-extension-mcp@1.
|
|
233
|
+
npx -y @modootoday/datalab-extension-mcp@1.15.0 install
|
|
234
234
|
```
|
|
235
235
|
|
|
236
236
|
- **`'npx'을(는) 내부 또는 외부 명령...`** — Node.js가 없는 거예요. 위 2단계의 "Node.js가 없다면"을 따라 설치한 뒤 다시 실행해요.
|
|
@@ -260,7 +260,7 @@ AI가 "그런 기능은 없다" 고 답하면, **"숨은 도구를 찾아보고
|
|
|
260
260
|
1. 터미널에서 아래 명령을 실행해요(AI 앱에 등록된 설정을 지워 줘요).
|
|
261
261
|
|
|
262
262
|
```
|
|
263
|
-
npx -y @modootoday/datalab-extension-mcp@1.
|
|
263
|
+
npx -y @modootoday/datalab-extension-mcp@1.15.0 uninstall
|
|
264
264
|
```
|
|
265
265
|
|
|
266
266
|
2. 확장 설정에서 **MCP 연결을 꺼요.** 패널이 브릿지라, 꺼 두면 어딘가 설정 줄이 남아 있어도 AI 앱이 아무것도 조회할 수 없어요.
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
__export
|
|
3
3
|
} from "./chunk-MLKGABMK.js";
|
|
4
4
|
|
|
5
|
-
// ../mcp-server/dist/chunk-
|
|
5
|
+
// ../mcp-server/dist/chunk-ITPADZIB.js
|
|
6
6
|
import { createHash } from "crypto";
|
|
7
7
|
import { createHash as createHash2, randomUUID } from "crypto";
|
|
8
8
|
import { mkdir, readFile, readdir, rm, writeFile } from "fs/promises";
|
|
@@ -14,6 +14,7 @@ import { pipeline } from "stream/promises";
|
|
|
14
14
|
import { constants } from "fs";
|
|
15
15
|
import { lstat, open as open2 } from "fs/promises";
|
|
16
16
|
import { basename, isAbsolute } from "path";
|
|
17
|
+
import { Readable } from "stream";
|
|
17
18
|
import {
|
|
18
19
|
appendFileSync,
|
|
19
20
|
mkdirSync,
|
|
@@ -32,6 +33,9 @@ import { homedir as homedir2 } from "os";
|
|
|
32
33
|
import { join as join3 } from "path";
|
|
33
34
|
import { timingSafeEqual as timingSafeEqual2 } from "crypto";
|
|
34
35
|
import { createRequire } from "module";
|
|
36
|
+
import { join as join5 } from "path";
|
|
37
|
+
import { createHash as createHash3, randomUUID as randomUUID2 } from "crypto";
|
|
38
|
+
import { appendFile, mkdir as mkdir2, rename, rm as rm2, stat } from "fs/promises";
|
|
35
39
|
import { join as join4 } from "path";
|
|
36
40
|
var __defProp = Object.defineProperty;
|
|
37
41
|
var __export2 = (target, all) => {
|
|
@@ -684,6 +688,7 @@ __export2(util_exports, {
|
|
|
684
688
|
required: () => required,
|
|
685
689
|
safeExtend: () => safeExtend,
|
|
686
690
|
shallowClone: () => shallowClone,
|
|
691
|
+
sizeCaps: () => sizeCaps,
|
|
687
692
|
slugify: () => slugify,
|
|
688
693
|
stringifyPrimitive: () => stringifyPrimitive,
|
|
689
694
|
toZod: () => toZod,
|
|
@@ -1203,6 +1208,18 @@ function prefixIssues(path, issues) {
|
|
|
1203
1208
|
function unwrapMessage(message) {
|
|
1204
1209
|
return typeof message === "string" ? message : message?.message;
|
|
1205
1210
|
}
|
|
1211
|
+
function sizeCaps(defChecks) {
|
|
1212
|
+
const caps = [];
|
|
1213
|
+
for (const ch of defChecks ?? []) {
|
|
1214
|
+
const d = ch._zod.def;
|
|
1215
|
+
if (!/_(length|size)$|_equals$/.test(d.check))
|
|
1216
|
+
break;
|
|
1217
|
+
const max = d.maximum ?? d.length ?? d.size;
|
|
1218
|
+
if (max >= 0)
|
|
1219
|
+
caps.push([max, ch]);
|
|
1220
|
+
}
|
|
1221
|
+
return caps;
|
|
1222
|
+
}
|
|
1206
1223
|
function attachSchema(issues, start, inst) {
|
|
1207
1224
|
var _a32;
|
|
1208
1225
|
for (let i = start; i < issues.length; i++) {
|
|
@@ -2609,7 +2626,7 @@ ${content.join("\n")}
|
|
|
2609
2626
|
var version = {
|
|
2610
2627
|
major: 4,
|
|
2611
2628
|
minor: 6,
|
|
2612
|
-
patch:
|
|
2629
|
+
patch: 7
|
|
2613
2630
|
};
|
|
2614
2631
|
var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
2615
2632
|
var _a32;
|
|
@@ -3363,6 +3380,31 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
|
|
|
3363
3380
|
return payload;
|
|
3364
3381
|
};
|
|
3365
3382
|
});
|
|
3383
|
+
function capSize(inst, size) {
|
|
3384
|
+
const caps = sizeCaps(inst._zod.def.checks);
|
|
3385
|
+
if (!caps.length)
|
|
3386
|
+
return;
|
|
3387
|
+
const cap = Math.min(...caps.map((c) => c[0]));
|
|
3388
|
+
const parse32 = inst._zod.parse;
|
|
3389
|
+
inst._zod.parse = (payload, ctx) => {
|
|
3390
|
+
const n = size(payload.value);
|
|
3391
|
+
if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
|
|
3392
|
+
for (const [max, ch] of sizeCaps(inst._zod.def.checks)) {
|
|
3393
|
+
if (n > max && ch._zod.def.when(payload)) {
|
|
3394
|
+
const start = payload.issues.length;
|
|
3395
|
+
ch._zod.check(payload);
|
|
3396
|
+
payload.issues[start].continue = false;
|
|
3397
|
+
attachSchema(payload.issues, start, inst);
|
|
3398
|
+
return payload;
|
|
3399
|
+
}
|
|
3400
|
+
}
|
|
3401
|
+
}
|
|
3402
|
+
return parse32(payload, ctx);
|
|
3403
|
+
};
|
|
3404
|
+
}
|
|
3405
|
+
var arraySize = (input22) => Array.isArray(input22) ? input22.length : -1;
|
|
3406
|
+
var mapSize = (input22) => input22 instanceof Map ? input22.size : -1;
|
|
3407
|
+
var setSize = (input22) => input22 instanceof Set ? input22.size : -1;
|
|
3366
3408
|
function handleArrayResult(result, final, index) {
|
|
3367
3409
|
if (result.issues.length) {
|
|
3368
3410
|
final.issues.push(...prefixIssues(index, result.issues));
|
|
@@ -3406,6 +3448,7 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
3406
3448
|
}
|
|
3407
3449
|
return payload;
|
|
3408
3450
|
};
|
|
3451
|
+
capSize(inst, arraySize);
|
|
3409
3452
|
});
|
|
3410
3453
|
function handlePropertyResult(result, final, key, input22, optin, optout) {
|
|
3411
3454
|
const isPresent = key in input22;
|
|
@@ -4362,6 +4405,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
|
|
|
4362
4405
|
return Promise.all(proms).then(() => payload);
|
|
4363
4406
|
return payload;
|
|
4364
4407
|
};
|
|
4408
|
+
capSize(inst, mapSize);
|
|
4365
4409
|
});
|
|
4366
4410
|
function handleMapResult(keyResult, valueResult, final, key, input22, inst, ctx) {
|
|
4367
4411
|
if (keyResult.issues.length) {
|
|
@@ -4428,6 +4472,7 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
|
|
|
4428
4472
|
return Promise.all(proms).then(() => payload);
|
|
4429
4473
|
return payload;
|
|
4430
4474
|
};
|
|
4475
|
+
capSize(inst, setSize);
|
|
4431
4476
|
});
|
|
4432
4477
|
function handleSetResult(result, final) {
|
|
4433
4478
|
if (result.issues.length) {
|
|
@@ -13824,9 +13869,15 @@ function generateNullableCheck(doc, ctx, schema2, accessor, buildsValue = true)
|
|
|
13824
13869
|
doc.write(`}`);
|
|
13825
13870
|
return outputVar;
|
|
13826
13871
|
}
|
|
13872
|
+
function generateSizeGate(doc, schema2, size) {
|
|
13873
|
+
for (const [max, check22] of sizeCaps(schema2._zod.def.checks)) {
|
|
13874
|
+
doc.write(`if (${size} > ${numericOperand(max, check22._zod.def.check)}) return INVALID;`);
|
|
13875
|
+
}
|
|
13876
|
+
}
|
|
13827
13877
|
function generateArrayCheck(doc, ctx, schema2, accessor, buildsValue = true) {
|
|
13828
13878
|
const def = schema2._zod.def;
|
|
13829
13879
|
doc.write(`if (!Array.isArray(${accessor})) return INVALID;`);
|
|
13880
|
+
generateSizeGate(doc, schema2, `${accessor}.length`);
|
|
13830
13881
|
const outputVar = buildsValue ? newVar(ctx) : null;
|
|
13831
13882
|
const iVar = newVar(ctx);
|
|
13832
13883
|
const elemVar = newVar(ctx);
|
|
@@ -14226,6 +14277,7 @@ function literalPropertyKey(ctx, key) {
|
|
|
14226
14277
|
function generateMapCheck(doc, ctx, schema2, accessor) {
|
|
14227
14278
|
const def = schema2._zod.def;
|
|
14228
14279
|
doc.write(`if (!(${accessor} instanceof Map)) return INVALID;`);
|
|
14280
|
+
generateSizeGate(doc, schema2, `${accessor}.size`);
|
|
14229
14281
|
const outputVar = newVar(ctx);
|
|
14230
14282
|
const kVar = newVar(ctx);
|
|
14231
14283
|
const valVar = newVar(ctx);
|
|
@@ -14242,6 +14294,7 @@ function generateMapCheck(doc, ctx, schema2, accessor) {
|
|
|
14242
14294
|
function generateSetCheck(doc, ctx, schema2, accessor) {
|
|
14243
14295
|
const def = schema2._zod.def;
|
|
14244
14296
|
doc.write(`if (!(${accessor} instanceof Set)) return INVALID;`);
|
|
14297
|
+
generateSizeGate(doc, schema2, `${accessor}.size`);
|
|
14245
14298
|
const outputVar = newVar(ctx);
|
|
14246
14299
|
const valVar = newVar(ctx);
|
|
14247
14300
|
doc.write(`const ${outputVar} = new Set();`);
|
|
@@ -20036,11 +20089,22 @@ var TOOL_TIERS = Object.freeze({
|
|
|
20036
20089
|
photo_node_remove: "destructive",
|
|
20037
20090
|
photo_page_remove: "destructive",
|
|
20038
20091
|
photo_template_apply: "destructive",
|
|
20092
|
+
// One confirm for the whole batch, at the grade of the worst op it may hold.
|
|
20093
|
+
photo_apply: "destructive",
|
|
20094
|
+
photo_history_undo: "write",
|
|
20095
|
+
photo_history_redo: "write",
|
|
20096
|
+
photo_preview: "read",
|
|
20097
|
+
// Rendering into memory changes nothing; saving the file is the asked step.
|
|
20098
|
+
photo_export: "read",
|
|
20099
|
+
photo_job_status: "read",
|
|
20039
20100
|
// ── Gallery: the free way in ────────────────────────────────────
|
|
20040
20101
|
//
|
|
20041
20102
|
// Destructive because it reads a path off the user's disk, the same
|
|
20042
20103
|
// capability editor_insert_image carries, and the confirm names that read.
|
|
20043
20104
|
gallery_image_add: "destructive",
|
|
20105
|
+
// Writes one finished editor export to the connector's own folder (MCP) or
|
|
20106
|
+
// to Downloads (panel). It names the file, so it is asked every time.
|
|
20107
|
+
gallery_export_save: "write",
|
|
20044
20108
|
// ── Video editor (our own surface) ──────────────────────────────
|
|
20045
20109
|
video_project_get: "read",
|
|
20046
20110
|
video_project_new: "destructive",
|
|
@@ -20071,6 +20135,12 @@ var TOOL_TIERS = Object.freeze({
|
|
|
20071
20135
|
video_node_remove: "destructive",
|
|
20072
20136
|
video_scene_remove: "destructive",
|
|
20073
20137
|
video_narration_generate: "paid",
|
|
20138
|
+
video_apply: "destructive",
|
|
20139
|
+
video_history_undo: "write",
|
|
20140
|
+
video_history_redo: "write",
|
|
20141
|
+
video_preview: "read",
|
|
20142
|
+
video_export: "read",
|
|
20143
|
+
video_job_status: "read",
|
|
20074
20144
|
// ── Post editor: reads ──────────────────────────────────────────
|
|
20075
20145
|
editor_read: "read",
|
|
20076
20146
|
editor_read_structure: "read",
|
|
@@ -20094,6 +20164,10 @@ var TOOL_TIERS = Object.freeze({
|
|
|
20094
20164
|
editor_open_saved_draft: "write",
|
|
20095
20165
|
// Restyles existing text; the words stay as they are.
|
|
20096
20166
|
editor_apply_styles: "write",
|
|
20167
|
+
// Adds or removes empty text components only; removal refuses any component
|
|
20168
|
+
// that holds text, and both read the list back before answering.
|
|
20169
|
+
editor_insert_blank_paragraph: "write",
|
|
20170
|
+
editor_remove_blank_paragraph: "write",
|
|
20097
20171
|
// `write`, and it stays that way because it REFUSES an occupied body rather
|
|
20098
20172
|
// than overwriting it. A replace fallback would make it destructive while its
|
|
20099
20173
|
// confirm still reads as an append, so that fallback is a review-block.
|
|
@@ -20469,6 +20543,45 @@ ${BRIDGE_AGENT_HINT.connectorStuck}`;
|
|
|
20469
20543
|
|
|
20470
20544
|
${BRIDGE_AGENT_HINT.notConnected}`;
|
|
20471
20545
|
}
|
|
20546
|
+
var MCP_IMAGES_KEY = "__mcpImages";
|
|
20547
|
+
var MCP_IMAGES_MAX = 4;
|
|
20548
|
+
var IMAGE_MIME = /* @__PURE__ */ new Set(["image/jpeg", "image/png", "image/webp"]);
|
|
20549
|
+
var BASE64 = /^[A-Za-z0-9+/]+={0,2}$/;
|
|
20550
|
+
var SEARCH_DEPTH = 4;
|
|
20551
|
+
function asImage(value) {
|
|
20552
|
+
if (typeof value !== "object" || value === null) return null;
|
|
20553
|
+
const { mimeType, data } = value;
|
|
20554
|
+
if (typeof mimeType !== "string" || !IMAGE_MIME.has(mimeType)) return null;
|
|
20555
|
+
if (typeof data !== "string" || data.length === 0 || !BASE64.test(data)) {
|
|
20556
|
+
return null;
|
|
20557
|
+
}
|
|
20558
|
+
return { type: "image", data, mimeType };
|
|
20559
|
+
}
|
|
20560
|
+
function strip(value, depth, images) {
|
|
20561
|
+
if (depth > SEARCH_DEPTH) return value;
|
|
20562
|
+
if (Array.isArray(value)) {
|
|
20563
|
+
return value.map((item) => strip(item, depth + 1, images));
|
|
20564
|
+
}
|
|
20565
|
+
if (typeof value !== "object" || value === null) return value;
|
|
20566
|
+
const out = {};
|
|
20567
|
+
for (const [key, item] of Object.entries(value)) {
|
|
20568
|
+
if (key !== MCP_IMAGES_KEY) {
|
|
20569
|
+
out[key] = strip(item, depth + 1, images);
|
|
20570
|
+
continue;
|
|
20571
|
+
}
|
|
20572
|
+
if (!Array.isArray(item)) continue;
|
|
20573
|
+
for (const entry of item) {
|
|
20574
|
+
const image = asImage(entry);
|
|
20575
|
+
if (image && images.length < MCP_IMAGES_MAX) images.push(image);
|
|
20576
|
+
}
|
|
20577
|
+
}
|
|
20578
|
+
return out;
|
|
20579
|
+
}
|
|
20580
|
+
function splitResultImages(result) {
|
|
20581
|
+
const images = [];
|
|
20582
|
+
const rest = strip(result, 0, images);
|
|
20583
|
+
return { result: rest, images };
|
|
20584
|
+
}
|
|
20472
20585
|
var MCP_SERVER_HEALTH_NAME = "datalab-extension-mcp-server";
|
|
20473
20586
|
function randomPrefix() {
|
|
20474
20587
|
return Math.floor(Math.random() * 16777215).toString(36).padStart(4, "0");
|
|
@@ -20571,6 +20684,23 @@ function digestToken(token) {
|
|
|
20571
20684
|
return createHash("sha256").update(token, "utf8").digest("hex");
|
|
20572
20685
|
}
|
|
20573
20686
|
var DEFAULT_RATE_LIMIT = BRIDGE_LIMITS;
|
|
20687
|
+
var FILE_TOOLS = /* @__PURE__ */ new Set([
|
|
20688
|
+
"editor_insert_image",
|
|
20689
|
+
"gallery_image_add",
|
|
20690
|
+
"gallery_export_save"
|
|
20691
|
+
]);
|
|
20692
|
+
var ARTIFACT_TOOLS = /* @__PURE__ */ new Set([
|
|
20693
|
+
"gallery_export_save"
|
|
20694
|
+
]);
|
|
20695
|
+
function isFileTool(name) {
|
|
20696
|
+
return typeof name === "string" && FILE_TOOLS.has(name);
|
|
20697
|
+
}
|
|
20698
|
+
function stagedHandle(tool, handle) {
|
|
20699
|
+
return tool === "gallery_image_add" && typeof handle === "string" && /^stage:[0-9a-f]{32}$/.test(handle) ? handle : void 0;
|
|
20700
|
+
}
|
|
20701
|
+
function artifactPath(job) {
|
|
20702
|
+
return typeof job === "string" && job.length > 0 ? `artifact:${job}` : void 0;
|
|
20703
|
+
}
|
|
20574
20704
|
function daemonIdTag() {
|
|
20575
20705
|
return Math.floor(Math.random() * 16777215).toString(36).padStart(4, "0");
|
|
20576
20706
|
}
|
|
@@ -21211,9 +21341,10 @@ var Bridge = class {
|
|
|
21211
21341
|
} : void 0;
|
|
21212
21342
|
const delegatedTool = req.method === "tools/call" && req.name === CALL_TOOL ? req.args["tool"] : void 0;
|
|
21213
21343
|
const delegatedArgs = req.method === "tools/call" && typeof req.args["args"] === "object" && req.args["args"] !== null && !Array.isArray(req.args["args"]) ? req.args["args"] : null;
|
|
21214
|
-
const
|
|
21344
|
+
const named = req.method === "tools/call" ? req.name : void 0;
|
|
21345
|
+
const fileTool = isFileTool(named) ? named : isFileTool(delegatedTool) ? delegatedTool : null;
|
|
21215
21346
|
const fileArgs = delegatedArgs ?? (req.method === "tools/call" ? req.args : null);
|
|
21216
|
-
const path = fileArgs?.["path"];
|
|
21347
|
+
const path = fileTool !== null && ARTIFACT_TOOLS.has(fileTool) ? artifactPath(fileArgs?.["job"]) : fileArgs?.["path"] ?? stagedHandle(fileTool, fileArgs?.["handle"]);
|
|
21217
21348
|
if (entry.fileRequestBound && fileTool !== null && typeof path === "string" && path.length > 0) {
|
|
21218
21349
|
entry.filePermits.set(id, {
|
|
21219
21350
|
expiresAt: (this.#deps.now ?? Date.now)() + (this.#deps.timeoutMs ?? DEFAULT_TIMEOUT_MS),
|
|
@@ -21786,9 +21917,10 @@ async function handleMcpRequest(bridge, body, accept, stage) {
|
|
|
21786
21917
|
}
|
|
21787
21918
|
try {
|
|
21788
21919
|
const call = browser === void 0 ? await bridge.callTool(params.name, args) : await bridge.callTool(params.name, args, browser);
|
|
21920
|
+
const { result, images } = splitResultImages(call.result);
|
|
21789
21921
|
return frameMcpResponse(
|
|
21790
21922
|
rpcResult(id, {
|
|
21791
|
-
content: [{ type: "text", text: JSON.stringify(
|
|
21923
|
+
content: [{ type: "text", text: JSON.stringify(result) }, ...images],
|
|
21792
21924
|
...timingMeta(call)
|
|
21793
21925
|
}),
|
|
21794
21926
|
accept
|
|
@@ -21931,11 +22063,55 @@ async function openLocalImage(path) {
|
|
|
21931
22063
|
};
|
|
21932
22064
|
}
|
|
21933
22065
|
}
|
|
22066
|
+
async function openStagedImage(stage, handle) {
|
|
22067
|
+
if (!stage || !/^stage:[0-9a-f]{32}$/.test(handle)) {
|
|
22068
|
+
return {
|
|
22069
|
+
ok: false,
|
|
22070
|
+
reason: "not_found",
|
|
22071
|
+
message: "\uADF8 \uD578\uB4E4\uC758 \uD30C\uC77C\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC5B4\uC694."
|
|
22072
|
+
};
|
|
22073
|
+
}
|
|
22074
|
+
let bytes;
|
|
22075
|
+
try {
|
|
22076
|
+
bytes = await stage.readSealed(handle);
|
|
22077
|
+
} catch {
|
|
22078
|
+
return {
|
|
22079
|
+
ok: false,
|
|
22080
|
+
reason: "not_found",
|
|
22081
|
+
message: "\uADF8 \uD578\uB4E4\uC758 \uD30C\uC77C\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC5B4\uC694."
|
|
22082
|
+
};
|
|
22083
|
+
}
|
|
22084
|
+
if (bytes.length === 0)
|
|
22085
|
+
return { ok: false, reason: "empty", message: "\uBE48 \uD30C\uC77C\uC774\uC5D0\uC694." };
|
|
22086
|
+
if (bytes.length > MAX_FILE_BYTES) {
|
|
22087
|
+
return {
|
|
22088
|
+
ok: false,
|
|
22089
|
+
reason: "too_large",
|
|
22090
|
+
message: `\uC0AC\uC9C4\uC774 \uB108\uBB34 \uCEE4\uC694(\uCD5C\uB300 ${String(MAX_FILE_BYTES / 1024 / 1024)}MB).`
|
|
22091
|
+
};
|
|
22092
|
+
}
|
|
22093
|
+
const contentType = sniff(bytes.subarray(0, 16));
|
|
22094
|
+
if (!contentType) {
|
|
22095
|
+
return {
|
|
22096
|
+
ok: false,
|
|
22097
|
+
reason: "not_an_image",
|
|
22098
|
+
message: "\uC774\uBBF8\uC9C0 \uD30C\uC77C\uC774 \uC544\uB2C8\uC5D0\uC694(PNG\xB7JPEG\xB7GIF\xB7WebP\uB9CC \uB123\uC744 \uC218 \uC788\uC5B4\uC694)."
|
|
22099
|
+
};
|
|
22100
|
+
}
|
|
22101
|
+
return {
|
|
22102
|
+
ok: true,
|
|
22103
|
+
stream: Readable.from([bytes]),
|
|
22104
|
+
contentType,
|
|
22105
|
+
byteLength: bytes.length,
|
|
22106
|
+
fileName: `${handle.slice(6, 14)}.${contentType.slice(6)}`
|
|
22107
|
+
};
|
|
22108
|
+
}
|
|
21934
22109
|
var MCP_SERVER_HEALTH_SCHEMA = "datalab-extension-mcp-health-v1";
|
|
21935
22110
|
var MAX_BODY_BYTES = 64 * 1024;
|
|
21936
22111
|
var DEFAULT_TOOLS_CHANGED_DEBOUNCE_MS = 600;
|
|
21937
22112
|
var MAX_MCP_BODY_BYTES2 = 256 * 1024;
|
|
21938
22113
|
var MAX_RESULT_BODY_BYTES = 4 * 1024 * 1024;
|
|
22114
|
+
var MAX_ARTIFACT_BODY_BYTES = 2 * 1024 * 1024;
|
|
21939
22115
|
function isFirstOrDecade(n) {
|
|
21940
22116
|
if (n === 1) return true;
|
|
21941
22117
|
let at = 10;
|
|
@@ -22203,7 +22379,8 @@ function createHttpBridge(opts) {
|
|
|
22203
22379
|
const hasRequestId = b !== null && Object.hasOwn(b, "requestId");
|
|
22204
22380
|
const invalidSessionId = hasSessionId && (typeof b?.sessionId !== "string" || b.sessionId.length === 0);
|
|
22205
22381
|
const invalidRequestId = hasRequestId && (typeof b?.requestId !== "string" || b.requestId.length === 0);
|
|
22206
|
-
if (!hasSessionId || !hasRequestId || invalidSessionId || invalidRequestId
|
|
22382
|
+
if (!hasSessionId || !hasRequestId || invalidSessionId || invalidRequestId || // An export-save permit names a job, never a file to read.
|
|
22383
|
+
typeof b?.tool === "string" && ARTIFACT_TOOLS.has(b.tool)) {
|
|
22207
22384
|
json2(res, 403, {
|
|
22208
22385
|
error: "unauthorized",
|
|
22209
22386
|
message: "\uC0AC\uC9C4 \uC694\uCCAD\uC758 \uC5F0\uACB0 \uC815\uBCF4\uB97C \uD655\uC778\uD558\uC9C0 \uBABB\uD588\uC5B4\uC694."
|
|
@@ -22251,7 +22428,7 @@ function createHttpBridge(opts) {
|
|
|
22251
22428
|
req.once("aborted", stop);
|
|
22252
22429
|
res.once("close", stop);
|
|
22253
22430
|
try {
|
|
22254
|
-
const out = await (opts.openLocalImage ?? openLocalImage)(path);
|
|
22431
|
+
const out = path.startsWith("stage:") ? await openStagedImage(opts.mediaStage, path) : await (opts.openLocalImage ?? openLocalImage)(path);
|
|
22255
22432
|
if (!out.ok) {
|
|
22256
22433
|
if (!peerClosed) {
|
|
22257
22434
|
json2(res, 400, { error: out.reason, message: out.message });
|
|
@@ -22291,6 +22468,51 @@ function createHttpBridge(opts) {
|
|
|
22291
22468
|
}).catch(() => json2(res, 400, { error: "bad request" }));
|
|
22292
22469
|
return;
|
|
22293
22470
|
}
|
|
22471
|
+
if (req.method === "POST" && url22.pathname === "/bridge/artifact") {
|
|
22472
|
+
const store = opts.artifactStore;
|
|
22473
|
+
if (!store) {
|
|
22474
|
+
json2(res, 404, { error: "not found" });
|
|
22475
|
+
return;
|
|
22476
|
+
}
|
|
22477
|
+
void readJson(req, MAX_ARTIFACT_BODY_BYTES).then(async (body) => {
|
|
22478
|
+
const b = body ?? {};
|
|
22479
|
+
const str = (k) => typeof b[k] === "string" ? b[k] : "";
|
|
22480
|
+
const tool = str("tool");
|
|
22481
|
+
const path = artifactPath(b["job"]);
|
|
22482
|
+
if (!str("sessionId") || !str("requestId") || !ARTIFACT_TOOLS.has(tool) || path === void 0) {
|
|
22483
|
+
json2(res, 403, { error: "unauthorized" });
|
|
22484
|
+
return;
|
|
22485
|
+
}
|
|
22486
|
+
const auth = opts.bridge.authorizeFileRequest({
|
|
22487
|
+
sessionId: str("sessionId"),
|
|
22488
|
+
requestId: str("requestId"),
|
|
22489
|
+
token: str("token"),
|
|
22490
|
+
path,
|
|
22491
|
+
tool
|
|
22492
|
+
});
|
|
22493
|
+
if (!auth.ok) {
|
|
22494
|
+
opts.log?.(`artifact refused: reason=${auth.reason}`);
|
|
22495
|
+
json2(res, 403, { error: "unauthorized" });
|
|
22496
|
+
return;
|
|
22497
|
+
}
|
|
22498
|
+
const offset = b["offset"];
|
|
22499
|
+
if (typeof offset !== "number" || !Number.isInteger(offset)) {
|
|
22500
|
+
json2(res, 400, { error: "bad_offset" });
|
|
22501
|
+
return;
|
|
22502
|
+
}
|
|
22503
|
+
const out = await store.write({
|
|
22504
|
+
key: `${str("sessionId")}:${str("requestId")}:${str("name")}`,
|
|
22505
|
+
name: str("name"),
|
|
22506
|
+
offset,
|
|
22507
|
+
data: str("data"),
|
|
22508
|
+
final: b["final"] === true,
|
|
22509
|
+
...typeof b["bytes"] === "number" ? { bytes: b["bytes"] } : {},
|
|
22510
|
+
...str("sha256") ? { sha256: str("sha256") } : {}
|
|
22511
|
+
});
|
|
22512
|
+
json2(res, out.ok ? 200 : 400, out);
|
|
22513
|
+
}).catch(() => json2(res, 400, { error: "bad request" }));
|
|
22514
|
+
return;
|
|
22515
|
+
}
|
|
22294
22516
|
if (req.method === "POST" && url22.pathname === "/bridge/file/cancel") {
|
|
22295
22517
|
void readJson(req, MAX_BODY_BYTES).then((body) => {
|
|
22296
22518
|
const b = body;
|
|
@@ -22665,6 +22887,95 @@ function readTakeoverSecret(home = homedir2()) {
|
|
|
22665
22887
|
return null;
|
|
22666
22888
|
}
|
|
22667
22889
|
}
|
|
22890
|
+
var MAX_ARTIFACT_BYTES = 1024 * 1024 * 1024;
|
|
22891
|
+
var OPEN_TTL_MS = 30 * 60 * 1e3;
|
|
22892
|
+
var BASE642 = /^[A-Za-z0-9+/]*={0,2}$/;
|
|
22893
|
+
function safeArtifactName(name) {
|
|
22894
|
+
const printable = [...name].filter((c) => c.charCodeAt(0) >= 32).join("");
|
|
22895
|
+
const cleaned = printable.replace(/[\\/:*?"<>|]/g, "").replace(/^\.+/, "").trim().slice(0, 120);
|
|
22896
|
+
return cleaned || "export.bin";
|
|
22897
|
+
}
|
|
22898
|
+
function day(now) {
|
|
22899
|
+
return new Date(now).toISOString().slice(0, 10).replace(/-/g, "");
|
|
22900
|
+
}
|
|
22901
|
+
function refuse2(reason, message) {
|
|
22902
|
+
return { ok: false, reason, message };
|
|
22903
|
+
}
|
|
22904
|
+
function createArtifactStore(opts) {
|
|
22905
|
+
const now = opts.now ?? Date.now;
|
|
22906
|
+
const open32 = /* @__PURE__ */ new Map();
|
|
22907
|
+
async function drop(key, entry) {
|
|
22908
|
+
open32.delete(key);
|
|
22909
|
+
await rm2(entry.partPath, { force: true });
|
|
22910
|
+
}
|
|
22911
|
+
async function expire() {
|
|
22912
|
+
const t = now();
|
|
22913
|
+
for (const [key, entry] of open32) {
|
|
22914
|
+
if (t - entry.openedAt > OPEN_TTL_MS) await drop(key, entry);
|
|
22915
|
+
}
|
|
22916
|
+
}
|
|
22917
|
+
async function write(chunk) {
|
|
22918
|
+
await expire();
|
|
22919
|
+
if (!BASE642.test(chunk.data)) {
|
|
22920
|
+
return refuse2("bad_chunk", "\uB0B4\uBCF4\uB0B8 \uD30C\uC77C \uC870\uAC01\uC744 \uC77D\uC9C0 \uBABB\uD588\uC5B4\uC694.");
|
|
22921
|
+
}
|
|
22922
|
+
let entry = open32.get(chunk.key);
|
|
22923
|
+
if (!entry) {
|
|
22924
|
+
if (chunk.offset !== 0) {
|
|
22925
|
+
return refuse2("bad_offset", "\uB0B4\uBCF4\uB0B8 \uD30C\uC77C\uC744 \uCC98\uC74C\uBD80\uD130 \uB2E4\uC2DC \uBCF4\uB0B4 \uC8FC\uC138\uC694.");
|
|
22926
|
+
}
|
|
22927
|
+
const dir = join4(opts.root, day(now()));
|
|
22928
|
+
await mkdir2(dir, { recursive: true });
|
|
22929
|
+
const finalPath = join4(
|
|
22930
|
+
dir,
|
|
22931
|
+
`${randomUUID2().slice(0, 8)}-${safeArtifactName(chunk.name)}`
|
|
22932
|
+
);
|
|
22933
|
+
entry = {
|
|
22934
|
+
partPath: `${finalPath}.part`,
|
|
22935
|
+
finalPath,
|
|
22936
|
+
received: 0,
|
|
22937
|
+
hash: createHash3("sha256"),
|
|
22938
|
+
openedAt: now()
|
|
22939
|
+
};
|
|
22940
|
+
open32.set(chunk.key, entry);
|
|
22941
|
+
}
|
|
22942
|
+
if (chunk.offset !== entry.received) {
|
|
22943
|
+
await drop(chunk.key, entry);
|
|
22944
|
+
return refuse2("bad_offset", "\uB0B4\uBCF4\uB0B8 \uD30C\uC77C \uC870\uAC01\uC758 \uC21C\uC11C\uAC00 \uB9DE\uC9C0 \uC54A\uC544\uC694.");
|
|
22945
|
+
}
|
|
22946
|
+
const bytes = Buffer.from(chunk.data, "base64");
|
|
22947
|
+
if (entry.received + bytes.length > MAX_ARTIFACT_BYTES) {
|
|
22948
|
+
await drop(chunk.key, entry);
|
|
22949
|
+
return refuse2("too_large", "\uB0B4\uBCF4\uB0B8 \uD30C\uC77C\uC774 \uB108\uBB34 \uCEE4\uC694(\uCD5C\uB300 1GB).");
|
|
22950
|
+
}
|
|
22951
|
+
await appendFile(entry.partPath, bytes);
|
|
22952
|
+
entry.hash.update(bytes);
|
|
22953
|
+
entry.received += bytes.length;
|
|
22954
|
+
if (!chunk.final) {
|
|
22955
|
+
return { ok: true, state: "open", received: entry.received };
|
|
22956
|
+
}
|
|
22957
|
+
const sha256 = entry.hash.digest("hex");
|
|
22958
|
+
if (chunk.bytes !== void 0 && chunk.bytes !== entry.received || chunk.sha256 !== void 0 && chunk.sha256 !== sha256) {
|
|
22959
|
+
await drop(chunk.key, entry);
|
|
22960
|
+
return refuse2(
|
|
22961
|
+
"mismatch",
|
|
22962
|
+
"\uBC1B\uC740 \uD30C\uC77C\uC774 \uB0B4\uBCF4\uB0B8 \uD30C\uC77C\uACFC \uB2EC\uB77C\uC694. \uB2E4\uC2DC \uC2DC\uB3C4\uD574 \uC8FC\uC138\uC694."
|
|
22963
|
+
);
|
|
22964
|
+
}
|
|
22965
|
+
if (entry.received === 0) await appendFile(entry.partPath, Buffer.alloc(0));
|
|
22966
|
+
await rename(entry.partPath, entry.finalPath);
|
|
22967
|
+
open32.delete(chunk.key);
|
|
22968
|
+
const size = (await stat(entry.finalPath)).size;
|
|
22969
|
+
return {
|
|
22970
|
+
ok: true,
|
|
22971
|
+
state: "saved",
|
|
22972
|
+
path: entry.finalPath,
|
|
22973
|
+
bytes: size,
|
|
22974
|
+
sha256
|
|
22975
|
+
};
|
|
22976
|
+
}
|
|
22977
|
+
return { write };
|
|
22978
|
+
}
|
|
22668
22979
|
var NAME = MCP_SERVER_HEALTH_NAME;
|
|
22669
22980
|
function readVersion() {
|
|
22670
22981
|
return createRequire(import.meta.url)("../package.json").version;
|
|
@@ -22698,12 +23009,16 @@ function runDaemon(env, deps = {}) {
|
|
|
22698
23009
|
log
|
|
22699
23010
|
});
|
|
22700
23011
|
const stateDir = logDir(deps.home);
|
|
22701
|
-
const mediaStage = createMediaStage({ root:
|
|
23012
|
+
const mediaStage = createMediaStage({ root: join5(stateDir, "media") });
|
|
23013
|
+
const artifactStore = createArtifactStore({
|
|
23014
|
+
root: join5(stateDir, "exports")
|
|
23015
|
+
});
|
|
22702
23016
|
const http = createHttpBridge({
|
|
22703
23017
|
bridge,
|
|
22704
23018
|
port,
|
|
22705
23019
|
host,
|
|
22706
23020
|
mediaStage,
|
|
23021
|
+
artifactStore,
|
|
22707
23022
|
heartbeatMs: deps.heartbeatMs,
|
|
22708
23023
|
identity: { name: NAME, version: version22 },
|
|
22709
23024
|
log,
|
|
@@ -22814,7 +23129,7 @@ function killPortOwner(port, platform = process.platform) {
|
|
|
22814
23129
|
}
|
|
22815
23130
|
|
|
22816
23131
|
// src/adapter.ts
|
|
22817
|
-
import { randomUUID as
|
|
23132
|
+
import { randomUUID as randomUUID3 } from "crypto";
|
|
22818
23133
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
22819
23134
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
22820
23135
|
import {
|
|
@@ -23475,6 +23790,7 @@ __export(util_exports2, {
|
|
|
23475
23790
|
required: () => required2,
|
|
23476
23791
|
safeExtend: () => safeExtend2,
|
|
23477
23792
|
shallowClone: () => shallowClone2,
|
|
23793
|
+
sizeCaps: () => sizeCaps2,
|
|
23478
23794
|
slugify: () => slugify2,
|
|
23479
23795
|
stringifyPrimitive: () => stringifyPrimitive2,
|
|
23480
23796
|
toZod: () => toZod2,
|
|
@@ -23994,6 +24310,18 @@ function prefixIssues2(path, issues) {
|
|
|
23994
24310
|
function unwrapMessage2(message) {
|
|
23995
24311
|
return typeof message === "string" ? message : message?.message;
|
|
23996
24312
|
}
|
|
24313
|
+
function sizeCaps2(defChecks) {
|
|
24314
|
+
const caps = [];
|
|
24315
|
+
for (const ch of defChecks ?? []) {
|
|
24316
|
+
const d = ch._zod.def;
|
|
24317
|
+
if (!/_(length|size)$|_equals$/.test(d.check))
|
|
24318
|
+
break;
|
|
24319
|
+
const max = d.maximum ?? d.length ?? d.size;
|
|
24320
|
+
if (max >= 0)
|
|
24321
|
+
caps.push([max, ch]);
|
|
24322
|
+
}
|
|
24323
|
+
return caps;
|
|
24324
|
+
}
|
|
23997
24325
|
function attachSchema2(issues, start, inst) {
|
|
23998
24326
|
var _a5;
|
|
23999
24327
|
for (let i = start; i < issues.length; i++) {
|
|
@@ -25414,7 +25742,7 @@ ${content.join("\n")}
|
|
|
25414
25742
|
var version2 = {
|
|
25415
25743
|
major: 4,
|
|
25416
25744
|
minor: 6,
|
|
25417
|
-
patch:
|
|
25745
|
+
patch: 7
|
|
25418
25746
|
};
|
|
25419
25747
|
|
|
25420
25748
|
// ../node_modules/zod/v4/core/schemas.js
|
|
@@ -26170,6 +26498,31 @@ var $ZodDate2 = /* @__PURE__ */ $constructor2("$ZodDate", (inst, def) => {
|
|
|
26170
26498
|
return payload;
|
|
26171
26499
|
};
|
|
26172
26500
|
});
|
|
26501
|
+
function capSize2(inst, size) {
|
|
26502
|
+
const caps = sizeCaps2(inst._zod.def.checks);
|
|
26503
|
+
if (!caps.length)
|
|
26504
|
+
return;
|
|
26505
|
+
const cap = Math.min(...caps.map((c) => c[0]));
|
|
26506
|
+
const parse5 = inst._zod.parse;
|
|
26507
|
+
inst._zod.parse = (payload, ctx) => {
|
|
26508
|
+
const n = size(payload.value);
|
|
26509
|
+
if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
|
|
26510
|
+
for (const [max, ch] of sizeCaps2(inst._zod.def.checks)) {
|
|
26511
|
+
if (n > max && ch._zod.def.when(payload)) {
|
|
26512
|
+
const start = payload.issues.length;
|
|
26513
|
+
ch._zod.check(payload);
|
|
26514
|
+
payload.issues[start].continue = false;
|
|
26515
|
+
attachSchema2(payload.issues, start, inst);
|
|
26516
|
+
return payload;
|
|
26517
|
+
}
|
|
26518
|
+
}
|
|
26519
|
+
}
|
|
26520
|
+
return parse5(payload, ctx);
|
|
26521
|
+
};
|
|
26522
|
+
}
|
|
26523
|
+
var arraySize2 = (input3) => Array.isArray(input3) ? input3.length : -1;
|
|
26524
|
+
var mapSize2 = (input3) => input3 instanceof Map ? input3.size : -1;
|
|
26525
|
+
var setSize2 = (input3) => input3 instanceof Set ? input3.size : -1;
|
|
26173
26526
|
function handleArrayResult2(result, final, index) {
|
|
26174
26527
|
if (result.issues.length) {
|
|
26175
26528
|
final.issues.push(...prefixIssues2(index, result.issues));
|
|
@@ -26213,6 +26566,7 @@ var $ZodArray2 = /* @__PURE__ */ $constructor2("$ZodArray", (inst, def) => {
|
|
|
26213
26566
|
}
|
|
26214
26567
|
return payload;
|
|
26215
26568
|
};
|
|
26569
|
+
capSize2(inst, arraySize2);
|
|
26216
26570
|
});
|
|
26217
26571
|
function handlePropertyResult2(result, final, key, input3, optin, optout) {
|
|
26218
26572
|
const isPresent = key in input3;
|
|
@@ -27169,6 +27523,7 @@ var $ZodMap2 = /* @__PURE__ */ $constructor2("$ZodMap", (inst, def) => {
|
|
|
27169
27523
|
return Promise.all(proms).then(() => payload);
|
|
27170
27524
|
return payload;
|
|
27171
27525
|
};
|
|
27526
|
+
capSize2(inst, mapSize2);
|
|
27172
27527
|
});
|
|
27173
27528
|
function handleMapResult2(keyResult, valueResult, final, key, input3, inst, ctx) {
|
|
27174
27529
|
if (keyResult.issues.length) {
|
|
@@ -27235,6 +27590,7 @@ var $ZodSet2 = /* @__PURE__ */ $constructor2("$ZodSet", (inst, def) => {
|
|
|
27235
27590
|
return Promise.all(proms).then(() => payload);
|
|
27236
27591
|
return payload;
|
|
27237
27592
|
};
|
|
27593
|
+
capSize2(inst, setSize2);
|
|
27238
27594
|
});
|
|
27239
27595
|
function handleSetResult2(result, final) {
|
|
27240
27596
|
if (result.issues.length) {
|
|
@@ -36765,9 +37121,15 @@ function generateNullableCheck2(doc, ctx, schema2, accessor, buildsValue = true)
|
|
|
36765
37121
|
doc.write(`}`);
|
|
36766
37122
|
return outputVar;
|
|
36767
37123
|
}
|
|
37124
|
+
function generateSizeGate2(doc, schema2, size) {
|
|
37125
|
+
for (const [max, check3] of sizeCaps2(schema2._zod.def.checks)) {
|
|
37126
|
+
doc.write(`if (${size} > ${numericOperand2(max, check3._zod.def.check)}) return INVALID;`);
|
|
37127
|
+
}
|
|
37128
|
+
}
|
|
36768
37129
|
function generateArrayCheck2(doc, ctx, schema2, accessor, buildsValue = true) {
|
|
36769
37130
|
const def = schema2._zod.def;
|
|
36770
37131
|
doc.write(`if (!Array.isArray(${accessor})) return INVALID;`);
|
|
37132
|
+
generateSizeGate2(doc, schema2, `${accessor}.length`);
|
|
36771
37133
|
const outputVar = buildsValue ? newVar2(ctx) : null;
|
|
36772
37134
|
const iVar = newVar2(ctx);
|
|
36773
37135
|
const elemVar = newVar2(ctx);
|
|
@@ -37167,6 +37529,7 @@ function literalPropertyKey2(ctx, key) {
|
|
|
37167
37529
|
function generateMapCheck2(doc, ctx, schema2, accessor) {
|
|
37168
37530
|
const def = schema2._zod.def;
|
|
37169
37531
|
doc.write(`if (!(${accessor} instanceof Map)) return INVALID;`);
|
|
37532
|
+
generateSizeGate2(doc, schema2, `${accessor}.size`);
|
|
37170
37533
|
const outputVar = newVar2(ctx);
|
|
37171
37534
|
const kVar = newVar2(ctx);
|
|
37172
37535
|
const valVar = newVar2(ctx);
|
|
@@ -37183,6 +37546,7 @@ function generateMapCheck2(doc, ctx, schema2, accessor) {
|
|
|
37183
37546
|
function generateSetCheck2(doc, ctx, schema2, accessor) {
|
|
37184
37547
|
const def = schema2._zod.def;
|
|
37185
37548
|
doc.write(`if (!(${accessor} instanceof Set)) return INVALID;`);
|
|
37549
|
+
generateSizeGate2(doc, schema2, `${accessor}.size`);
|
|
37186
37550
|
const outputVar = newVar2(ctx);
|
|
37187
37551
|
const valVar = newVar2(ctx);
|
|
37188
37552
|
doc.write(`const ${outputVar} = new Set();`);
|
|
@@ -42876,11 +43240,22 @@ var TOOL_TIERS2 = Object.freeze({
|
|
|
42876
43240
|
photo_node_remove: "destructive",
|
|
42877
43241
|
photo_page_remove: "destructive",
|
|
42878
43242
|
photo_template_apply: "destructive",
|
|
43243
|
+
// One confirm for the whole batch, at the grade of the worst op it may hold.
|
|
43244
|
+
photo_apply: "destructive",
|
|
43245
|
+
photo_history_undo: "write",
|
|
43246
|
+
photo_history_redo: "write",
|
|
43247
|
+
photo_preview: "read",
|
|
43248
|
+
// Rendering into memory changes nothing; saving the file is the asked step.
|
|
43249
|
+
photo_export: "read",
|
|
43250
|
+
photo_job_status: "read",
|
|
42879
43251
|
// ── Gallery: the free way in ────────────────────────────────────
|
|
42880
43252
|
//
|
|
42881
43253
|
// Destructive because it reads a path off the user's disk, the same
|
|
42882
43254
|
// capability editor_insert_image carries, and the confirm names that read.
|
|
42883
43255
|
gallery_image_add: "destructive",
|
|
43256
|
+
// Writes one finished editor export to the connector's own folder (MCP) or
|
|
43257
|
+
// to Downloads (panel). It names the file, so it is asked every time.
|
|
43258
|
+
gallery_export_save: "write",
|
|
42884
43259
|
// ── Video editor (our own surface) ──────────────────────────────
|
|
42885
43260
|
video_project_get: "read",
|
|
42886
43261
|
video_project_new: "destructive",
|
|
@@ -42911,6 +43286,12 @@ var TOOL_TIERS2 = Object.freeze({
|
|
|
42911
43286
|
video_node_remove: "destructive",
|
|
42912
43287
|
video_scene_remove: "destructive",
|
|
42913
43288
|
video_narration_generate: "paid",
|
|
43289
|
+
video_apply: "destructive",
|
|
43290
|
+
video_history_undo: "write",
|
|
43291
|
+
video_history_redo: "write",
|
|
43292
|
+
video_preview: "read",
|
|
43293
|
+
video_export: "read",
|
|
43294
|
+
video_job_status: "read",
|
|
42914
43295
|
// ── Post editor: reads ──────────────────────────────────────────
|
|
42915
43296
|
editor_read: "read",
|
|
42916
43297
|
editor_read_structure: "read",
|
|
@@ -42934,6 +43315,10 @@ var TOOL_TIERS2 = Object.freeze({
|
|
|
42934
43315
|
editor_open_saved_draft: "write",
|
|
42935
43316
|
// Restyles existing text; the words stay as they are.
|
|
42936
43317
|
editor_apply_styles: "write",
|
|
43318
|
+
// Adds or removes empty text components only; removal refuses any component
|
|
43319
|
+
// that holds text, and both read the list back before answering.
|
|
43320
|
+
editor_insert_blank_paragraph: "write",
|
|
43321
|
+
editor_remove_blank_paragraph: "write",
|
|
42937
43322
|
// `write`, and it stays that way because it REFUSES an occupied body rather
|
|
42938
43323
|
// than overwriting it. A replace fallback would make it destructive while its
|
|
42939
43324
|
// confirm still reads as an append, so that fallback is a review-block.
|
|
@@ -43329,7 +43714,7 @@ function credentialHeader() {
|
|
|
43329
43714
|
const token = process.env["DATALAB_MCP_TOKEN"]?.trim();
|
|
43330
43715
|
return token ? { authorization: `Bearer ${token}` } : {};
|
|
43331
43716
|
}
|
|
43332
|
-
var CLIENT_ID =
|
|
43717
|
+
var CLIENT_ID = randomUUID3();
|
|
43333
43718
|
var CLIENT_ID_HEADER = "x-datalab-mcp-client";
|
|
43334
43719
|
async function postMcp(fetchImpl, url3, method, params) {
|
|
43335
43720
|
nextRpcId += 1;
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED