@modootoday/datalab-extension-mcp 1.13.0 → 1.14.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-C6TR4AD5.js → chunk-6JNPGDU7.js} +389 -12
- package/dist/cli.js +2 -2
- package/dist/{dist-ME5TF3Z7.js → dist-5AJOOWYN.js} +5 -5
- 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.14.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 231 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.14.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.14.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.14.0 install
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
영어 글자가 여러 줄 올라오는 건 정상이에요. 이 명령은 연결 프로그램을 설치하고 AI 앱 설정에 우리 항목만 더할 뿐, 다른 건 건드리지 않아요. npm 전역 설치 권한이 없으면 예전처럼 AI 앱이 시작할 때마다 내려받아 실행하도록 연결해요(시작이 조금 느려요).
|
|
@@ -202,7 +202,7 @@ MCP 를 켜 두었지만 **네이버 페이지가 한 곳도 열려 있지 않
|
|
|
202
202
|
|
|
203
203
|
정상이에요. **일부러 그렇게 보냅니다.**
|
|
204
204
|
|
|
205
|
-
전체 도구는
|
|
205
|
+
전체 도구는 231개인데, 그걸 전부 목록으로 보내면 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.14.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.14.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-B3HIVE6W.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",
|
|
@@ -20469,6 +20539,45 @@ ${BRIDGE_AGENT_HINT.connectorStuck}`;
|
|
|
20469
20539
|
|
|
20470
20540
|
${BRIDGE_AGENT_HINT.notConnected}`;
|
|
20471
20541
|
}
|
|
20542
|
+
var MCP_IMAGES_KEY = "__mcpImages";
|
|
20543
|
+
var MCP_IMAGES_MAX = 4;
|
|
20544
|
+
var IMAGE_MIME = /* @__PURE__ */ new Set(["image/jpeg", "image/png", "image/webp"]);
|
|
20545
|
+
var BASE64 = /^[A-Za-z0-9+/]+={0,2}$/;
|
|
20546
|
+
var SEARCH_DEPTH = 4;
|
|
20547
|
+
function asImage(value) {
|
|
20548
|
+
if (typeof value !== "object" || value === null) return null;
|
|
20549
|
+
const { mimeType, data } = value;
|
|
20550
|
+
if (typeof mimeType !== "string" || !IMAGE_MIME.has(mimeType)) return null;
|
|
20551
|
+
if (typeof data !== "string" || data.length === 0 || !BASE64.test(data)) {
|
|
20552
|
+
return null;
|
|
20553
|
+
}
|
|
20554
|
+
return { type: "image", data, mimeType };
|
|
20555
|
+
}
|
|
20556
|
+
function strip(value, depth, images) {
|
|
20557
|
+
if (depth > SEARCH_DEPTH) return value;
|
|
20558
|
+
if (Array.isArray(value)) {
|
|
20559
|
+
return value.map((item) => strip(item, depth + 1, images));
|
|
20560
|
+
}
|
|
20561
|
+
if (typeof value !== "object" || value === null) return value;
|
|
20562
|
+
const out = {};
|
|
20563
|
+
for (const [key, item] of Object.entries(value)) {
|
|
20564
|
+
if (key !== MCP_IMAGES_KEY) {
|
|
20565
|
+
out[key] = strip(item, depth + 1, images);
|
|
20566
|
+
continue;
|
|
20567
|
+
}
|
|
20568
|
+
if (!Array.isArray(item)) continue;
|
|
20569
|
+
for (const entry of item) {
|
|
20570
|
+
const image = asImage(entry);
|
|
20571
|
+
if (image && images.length < MCP_IMAGES_MAX) images.push(image);
|
|
20572
|
+
}
|
|
20573
|
+
}
|
|
20574
|
+
return out;
|
|
20575
|
+
}
|
|
20576
|
+
function splitResultImages(result) {
|
|
20577
|
+
const images = [];
|
|
20578
|
+
const rest = strip(result, 0, images);
|
|
20579
|
+
return { result: rest, images };
|
|
20580
|
+
}
|
|
20472
20581
|
var MCP_SERVER_HEALTH_NAME = "datalab-extension-mcp-server";
|
|
20473
20582
|
function randomPrefix() {
|
|
20474
20583
|
return Math.floor(Math.random() * 16777215).toString(36).padStart(4, "0");
|
|
@@ -20571,6 +20680,23 @@ function digestToken(token) {
|
|
|
20571
20680
|
return createHash("sha256").update(token, "utf8").digest("hex");
|
|
20572
20681
|
}
|
|
20573
20682
|
var DEFAULT_RATE_LIMIT = BRIDGE_LIMITS;
|
|
20683
|
+
var FILE_TOOLS = /* @__PURE__ */ new Set([
|
|
20684
|
+
"editor_insert_image",
|
|
20685
|
+
"gallery_image_add",
|
|
20686
|
+
"gallery_export_save"
|
|
20687
|
+
]);
|
|
20688
|
+
var ARTIFACT_TOOLS = /* @__PURE__ */ new Set([
|
|
20689
|
+
"gallery_export_save"
|
|
20690
|
+
]);
|
|
20691
|
+
function isFileTool(name) {
|
|
20692
|
+
return typeof name === "string" && FILE_TOOLS.has(name);
|
|
20693
|
+
}
|
|
20694
|
+
function stagedHandle(tool, handle) {
|
|
20695
|
+
return tool === "gallery_image_add" && typeof handle === "string" && /^stage:[0-9a-f]{32}$/.test(handle) ? handle : void 0;
|
|
20696
|
+
}
|
|
20697
|
+
function artifactPath(job) {
|
|
20698
|
+
return typeof job === "string" && job.length > 0 ? `artifact:${job}` : void 0;
|
|
20699
|
+
}
|
|
20574
20700
|
function daemonIdTag() {
|
|
20575
20701
|
return Math.floor(Math.random() * 16777215).toString(36).padStart(4, "0");
|
|
20576
20702
|
}
|
|
@@ -21211,9 +21337,10 @@ var Bridge = class {
|
|
|
21211
21337
|
} : void 0;
|
|
21212
21338
|
const delegatedTool = req.method === "tools/call" && req.name === CALL_TOOL ? req.args["tool"] : void 0;
|
|
21213
21339
|
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
|
|
21340
|
+
const named = req.method === "tools/call" ? req.name : void 0;
|
|
21341
|
+
const fileTool = isFileTool(named) ? named : isFileTool(delegatedTool) ? delegatedTool : null;
|
|
21215
21342
|
const fileArgs = delegatedArgs ?? (req.method === "tools/call" ? req.args : null);
|
|
21216
|
-
const path = fileArgs?.["path"];
|
|
21343
|
+
const path = fileTool !== null && ARTIFACT_TOOLS.has(fileTool) ? artifactPath(fileArgs?.["job"]) : fileArgs?.["path"] ?? stagedHandle(fileTool, fileArgs?.["handle"]);
|
|
21217
21344
|
if (entry.fileRequestBound && fileTool !== null && typeof path === "string" && path.length > 0) {
|
|
21218
21345
|
entry.filePermits.set(id, {
|
|
21219
21346
|
expiresAt: (this.#deps.now ?? Date.now)() + (this.#deps.timeoutMs ?? DEFAULT_TIMEOUT_MS),
|
|
@@ -21786,9 +21913,10 @@ async function handleMcpRequest(bridge, body, accept, stage) {
|
|
|
21786
21913
|
}
|
|
21787
21914
|
try {
|
|
21788
21915
|
const call = browser === void 0 ? await bridge.callTool(params.name, args) : await bridge.callTool(params.name, args, browser);
|
|
21916
|
+
const { result, images } = splitResultImages(call.result);
|
|
21789
21917
|
return frameMcpResponse(
|
|
21790
21918
|
rpcResult(id, {
|
|
21791
|
-
content: [{ type: "text", text: JSON.stringify(
|
|
21919
|
+
content: [{ type: "text", text: JSON.stringify(result) }, ...images],
|
|
21792
21920
|
...timingMeta(call)
|
|
21793
21921
|
}),
|
|
21794
21922
|
accept
|
|
@@ -21931,11 +22059,55 @@ async function openLocalImage(path) {
|
|
|
21931
22059
|
};
|
|
21932
22060
|
}
|
|
21933
22061
|
}
|
|
22062
|
+
async function openStagedImage(stage, handle) {
|
|
22063
|
+
if (!stage || !/^stage:[0-9a-f]{32}$/.test(handle)) {
|
|
22064
|
+
return {
|
|
22065
|
+
ok: false,
|
|
22066
|
+
reason: "not_found",
|
|
22067
|
+
message: "\uADF8 \uD578\uB4E4\uC758 \uD30C\uC77C\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC5B4\uC694."
|
|
22068
|
+
};
|
|
22069
|
+
}
|
|
22070
|
+
let bytes;
|
|
22071
|
+
try {
|
|
22072
|
+
bytes = await stage.readSealed(handle);
|
|
22073
|
+
} catch {
|
|
22074
|
+
return {
|
|
22075
|
+
ok: false,
|
|
22076
|
+
reason: "not_found",
|
|
22077
|
+
message: "\uADF8 \uD578\uB4E4\uC758 \uD30C\uC77C\uC744 \uCC3E\uC9C0 \uBABB\uD588\uC5B4\uC694."
|
|
22078
|
+
};
|
|
22079
|
+
}
|
|
22080
|
+
if (bytes.length === 0)
|
|
22081
|
+
return { ok: false, reason: "empty", message: "\uBE48 \uD30C\uC77C\uC774\uC5D0\uC694." };
|
|
22082
|
+
if (bytes.length > MAX_FILE_BYTES) {
|
|
22083
|
+
return {
|
|
22084
|
+
ok: false,
|
|
22085
|
+
reason: "too_large",
|
|
22086
|
+
message: `\uC0AC\uC9C4\uC774 \uB108\uBB34 \uCEE4\uC694(\uCD5C\uB300 ${String(MAX_FILE_BYTES / 1024 / 1024)}MB).`
|
|
22087
|
+
};
|
|
22088
|
+
}
|
|
22089
|
+
const contentType = sniff(bytes.subarray(0, 16));
|
|
22090
|
+
if (!contentType) {
|
|
22091
|
+
return {
|
|
22092
|
+
ok: false,
|
|
22093
|
+
reason: "not_an_image",
|
|
22094
|
+
message: "\uC774\uBBF8\uC9C0 \uD30C\uC77C\uC774 \uC544\uB2C8\uC5D0\uC694(PNG\xB7JPEG\xB7GIF\xB7WebP\uB9CC \uB123\uC744 \uC218 \uC788\uC5B4\uC694)."
|
|
22095
|
+
};
|
|
22096
|
+
}
|
|
22097
|
+
return {
|
|
22098
|
+
ok: true,
|
|
22099
|
+
stream: Readable.from([bytes]),
|
|
22100
|
+
contentType,
|
|
22101
|
+
byteLength: bytes.length,
|
|
22102
|
+
fileName: `${handle.slice(6, 14)}.${contentType.slice(6)}`
|
|
22103
|
+
};
|
|
22104
|
+
}
|
|
21934
22105
|
var MCP_SERVER_HEALTH_SCHEMA = "datalab-extension-mcp-health-v1";
|
|
21935
22106
|
var MAX_BODY_BYTES = 64 * 1024;
|
|
21936
22107
|
var DEFAULT_TOOLS_CHANGED_DEBOUNCE_MS = 600;
|
|
21937
22108
|
var MAX_MCP_BODY_BYTES2 = 256 * 1024;
|
|
21938
22109
|
var MAX_RESULT_BODY_BYTES = 4 * 1024 * 1024;
|
|
22110
|
+
var MAX_ARTIFACT_BODY_BYTES = 2 * 1024 * 1024;
|
|
21939
22111
|
function isFirstOrDecade(n) {
|
|
21940
22112
|
if (n === 1) return true;
|
|
21941
22113
|
let at = 10;
|
|
@@ -22203,7 +22375,8 @@ function createHttpBridge(opts) {
|
|
|
22203
22375
|
const hasRequestId = b !== null && Object.hasOwn(b, "requestId");
|
|
22204
22376
|
const invalidSessionId = hasSessionId && (typeof b?.sessionId !== "string" || b.sessionId.length === 0);
|
|
22205
22377
|
const invalidRequestId = hasRequestId && (typeof b?.requestId !== "string" || b.requestId.length === 0);
|
|
22206
|
-
if (!hasSessionId || !hasRequestId || invalidSessionId || invalidRequestId
|
|
22378
|
+
if (!hasSessionId || !hasRequestId || invalidSessionId || invalidRequestId || // An export-save permit names a job, never a file to read.
|
|
22379
|
+
typeof b?.tool === "string" && ARTIFACT_TOOLS.has(b.tool)) {
|
|
22207
22380
|
json2(res, 403, {
|
|
22208
22381
|
error: "unauthorized",
|
|
22209
22382
|
message: "\uC0AC\uC9C4 \uC694\uCCAD\uC758 \uC5F0\uACB0 \uC815\uBCF4\uB97C \uD655\uC778\uD558\uC9C0 \uBABB\uD588\uC5B4\uC694."
|
|
@@ -22251,7 +22424,7 @@ function createHttpBridge(opts) {
|
|
|
22251
22424
|
req.once("aborted", stop);
|
|
22252
22425
|
res.once("close", stop);
|
|
22253
22426
|
try {
|
|
22254
|
-
const out = await (opts.openLocalImage ?? openLocalImage)(path);
|
|
22427
|
+
const out = path.startsWith("stage:") ? await openStagedImage(opts.mediaStage, path) : await (opts.openLocalImage ?? openLocalImage)(path);
|
|
22255
22428
|
if (!out.ok) {
|
|
22256
22429
|
if (!peerClosed) {
|
|
22257
22430
|
json2(res, 400, { error: out.reason, message: out.message });
|
|
@@ -22291,6 +22464,51 @@ function createHttpBridge(opts) {
|
|
|
22291
22464
|
}).catch(() => json2(res, 400, { error: "bad request" }));
|
|
22292
22465
|
return;
|
|
22293
22466
|
}
|
|
22467
|
+
if (req.method === "POST" && url22.pathname === "/bridge/artifact") {
|
|
22468
|
+
const store = opts.artifactStore;
|
|
22469
|
+
if (!store) {
|
|
22470
|
+
json2(res, 404, { error: "not found" });
|
|
22471
|
+
return;
|
|
22472
|
+
}
|
|
22473
|
+
void readJson(req, MAX_ARTIFACT_BODY_BYTES).then(async (body) => {
|
|
22474
|
+
const b = body ?? {};
|
|
22475
|
+
const str = (k) => typeof b[k] === "string" ? b[k] : "";
|
|
22476
|
+
const tool = str("tool");
|
|
22477
|
+
const path = artifactPath(b["job"]);
|
|
22478
|
+
if (!str("sessionId") || !str("requestId") || !ARTIFACT_TOOLS.has(tool) || path === void 0) {
|
|
22479
|
+
json2(res, 403, { error: "unauthorized" });
|
|
22480
|
+
return;
|
|
22481
|
+
}
|
|
22482
|
+
const auth = opts.bridge.authorizeFileRequest({
|
|
22483
|
+
sessionId: str("sessionId"),
|
|
22484
|
+
requestId: str("requestId"),
|
|
22485
|
+
token: str("token"),
|
|
22486
|
+
path,
|
|
22487
|
+
tool
|
|
22488
|
+
});
|
|
22489
|
+
if (!auth.ok) {
|
|
22490
|
+
opts.log?.(`artifact refused: reason=${auth.reason}`);
|
|
22491
|
+
json2(res, 403, { error: "unauthorized" });
|
|
22492
|
+
return;
|
|
22493
|
+
}
|
|
22494
|
+
const offset = b["offset"];
|
|
22495
|
+
if (typeof offset !== "number" || !Number.isInteger(offset)) {
|
|
22496
|
+
json2(res, 400, { error: "bad_offset" });
|
|
22497
|
+
return;
|
|
22498
|
+
}
|
|
22499
|
+
const out = await store.write({
|
|
22500
|
+
key: `${str("sessionId")}:${str("requestId")}:${str("name")}`,
|
|
22501
|
+
name: str("name"),
|
|
22502
|
+
offset,
|
|
22503
|
+
data: str("data"),
|
|
22504
|
+
final: b["final"] === true,
|
|
22505
|
+
...typeof b["bytes"] === "number" ? { bytes: b["bytes"] } : {},
|
|
22506
|
+
...str("sha256") ? { sha256: str("sha256") } : {}
|
|
22507
|
+
});
|
|
22508
|
+
json2(res, out.ok ? 200 : 400, out);
|
|
22509
|
+
}).catch(() => json2(res, 400, { error: "bad request" }));
|
|
22510
|
+
return;
|
|
22511
|
+
}
|
|
22294
22512
|
if (req.method === "POST" && url22.pathname === "/bridge/file/cancel") {
|
|
22295
22513
|
void readJson(req, MAX_BODY_BYTES).then((body) => {
|
|
22296
22514
|
const b = body;
|
|
@@ -22665,6 +22883,95 @@ function readTakeoverSecret(home = homedir2()) {
|
|
|
22665
22883
|
return null;
|
|
22666
22884
|
}
|
|
22667
22885
|
}
|
|
22886
|
+
var MAX_ARTIFACT_BYTES = 1024 * 1024 * 1024;
|
|
22887
|
+
var OPEN_TTL_MS = 30 * 60 * 1e3;
|
|
22888
|
+
var BASE642 = /^[A-Za-z0-9+/]*={0,2}$/;
|
|
22889
|
+
function safeArtifactName(name) {
|
|
22890
|
+
const printable = [...name].filter((c) => c.charCodeAt(0) >= 32).join("");
|
|
22891
|
+
const cleaned = printable.replace(/[\\/:*?"<>|]/g, "").replace(/^\.+/, "").trim().slice(0, 120);
|
|
22892
|
+
return cleaned || "export.bin";
|
|
22893
|
+
}
|
|
22894
|
+
function day(now) {
|
|
22895
|
+
return new Date(now).toISOString().slice(0, 10).replace(/-/g, "");
|
|
22896
|
+
}
|
|
22897
|
+
function refuse2(reason, message) {
|
|
22898
|
+
return { ok: false, reason, message };
|
|
22899
|
+
}
|
|
22900
|
+
function createArtifactStore(opts) {
|
|
22901
|
+
const now = opts.now ?? Date.now;
|
|
22902
|
+
const open32 = /* @__PURE__ */ new Map();
|
|
22903
|
+
async function drop(key, entry) {
|
|
22904
|
+
open32.delete(key);
|
|
22905
|
+
await rm2(entry.partPath, { force: true });
|
|
22906
|
+
}
|
|
22907
|
+
async function expire() {
|
|
22908
|
+
const t = now();
|
|
22909
|
+
for (const [key, entry] of open32) {
|
|
22910
|
+
if (t - entry.openedAt > OPEN_TTL_MS) await drop(key, entry);
|
|
22911
|
+
}
|
|
22912
|
+
}
|
|
22913
|
+
async function write(chunk) {
|
|
22914
|
+
await expire();
|
|
22915
|
+
if (!BASE642.test(chunk.data)) {
|
|
22916
|
+
return refuse2("bad_chunk", "\uB0B4\uBCF4\uB0B8 \uD30C\uC77C \uC870\uAC01\uC744 \uC77D\uC9C0 \uBABB\uD588\uC5B4\uC694.");
|
|
22917
|
+
}
|
|
22918
|
+
let entry = open32.get(chunk.key);
|
|
22919
|
+
if (!entry) {
|
|
22920
|
+
if (chunk.offset !== 0) {
|
|
22921
|
+
return refuse2("bad_offset", "\uB0B4\uBCF4\uB0B8 \uD30C\uC77C\uC744 \uCC98\uC74C\uBD80\uD130 \uB2E4\uC2DC \uBCF4\uB0B4 \uC8FC\uC138\uC694.");
|
|
22922
|
+
}
|
|
22923
|
+
const dir = join4(opts.root, day(now()));
|
|
22924
|
+
await mkdir2(dir, { recursive: true });
|
|
22925
|
+
const finalPath = join4(
|
|
22926
|
+
dir,
|
|
22927
|
+
`${randomUUID2().slice(0, 8)}-${safeArtifactName(chunk.name)}`
|
|
22928
|
+
);
|
|
22929
|
+
entry = {
|
|
22930
|
+
partPath: `${finalPath}.part`,
|
|
22931
|
+
finalPath,
|
|
22932
|
+
received: 0,
|
|
22933
|
+
hash: createHash3("sha256"),
|
|
22934
|
+
openedAt: now()
|
|
22935
|
+
};
|
|
22936
|
+
open32.set(chunk.key, entry);
|
|
22937
|
+
}
|
|
22938
|
+
if (chunk.offset !== entry.received) {
|
|
22939
|
+
await drop(chunk.key, entry);
|
|
22940
|
+
return refuse2("bad_offset", "\uB0B4\uBCF4\uB0B8 \uD30C\uC77C \uC870\uAC01\uC758 \uC21C\uC11C\uAC00 \uB9DE\uC9C0 \uC54A\uC544\uC694.");
|
|
22941
|
+
}
|
|
22942
|
+
const bytes = Buffer.from(chunk.data, "base64");
|
|
22943
|
+
if (entry.received + bytes.length > MAX_ARTIFACT_BYTES) {
|
|
22944
|
+
await drop(chunk.key, entry);
|
|
22945
|
+
return refuse2("too_large", "\uB0B4\uBCF4\uB0B8 \uD30C\uC77C\uC774 \uB108\uBB34 \uCEE4\uC694(\uCD5C\uB300 1GB).");
|
|
22946
|
+
}
|
|
22947
|
+
await appendFile(entry.partPath, bytes);
|
|
22948
|
+
entry.hash.update(bytes);
|
|
22949
|
+
entry.received += bytes.length;
|
|
22950
|
+
if (!chunk.final) {
|
|
22951
|
+
return { ok: true, state: "open", received: entry.received };
|
|
22952
|
+
}
|
|
22953
|
+
const sha256 = entry.hash.digest("hex");
|
|
22954
|
+
if (chunk.bytes !== void 0 && chunk.bytes !== entry.received || chunk.sha256 !== void 0 && chunk.sha256 !== sha256) {
|
|
22955
|
+
await drop(chunk.key, entry);
|
|
22956
|
+
return refuse2(
|
|
22957
|
+
"mismatch",
|
|
22958
|
+
"\uBC1B\uC740 \uD30C\uC77C\uC774 \uB0B4\uBCF4\uB0B8 \uD30C\uC77C\uACFC \uB2EC\uB77C\uC694. \uB2E4\uC2DC \uC2DC\uB3C4\uD574 \uC8FC\uC138\uC694."
|
|
22959
|
+
);
|
|
22960
|
+
}
|
|
22961
|
+
if (entry.received === 0) await appendFile(entry.partPath, Buffer.alloc(0));
|
|
22962
|
+
await rename(entry.partPath, entry.finalPath);
|
|
22963
|
+
open32.delete(chunk.key);
|
|
22964
|
+
const size = (await stat(entry.finalPath)).size;
|
|
22965
|
+
return {
|
|
22966
|
+
ok: true,
|
|
22967
|
+
state: "saved",
|
|
22968
|
+
path: entry.finalPath,
|
|
22969
|
+
bytes: size,
|
|
22970
|
+
sha256
|
|
22971
|
+
};
|
|
22972
|
+
}
|
|
22973
|
+
return { write };
|
|
22974
|
+
}
|
|
22668
22975
|
var NAME = MCP_SERVER_HEALTH_NAME;
|
|
22669
22976
|
function readVersion() {
|
|
22670
22977
|
return createRequire(import.meta.url)("../package.json").version;
|
|
@@ -22698,12 +23005,16 @@ function runDaemon(env, deps = {}) {
|
|
|
22698
23005
|
log
|
|
22699
23006
|
});
|
|
22700
23007
|
const stateDir = logDir(deps.home);
|
|
22701
|
-
const mediaStage = createMediaStage({ root:
|
|
23008
|
+
const mediaStage = createMediaStage({ root: join5(stateDir, "media") });
|
|
23009
|
+
const artifactStore = createArtifactStore({
|
|
23010
|
+
root: join5(stateDir, "exports")
|
|
23011
|
+
});
|
|
22702
23012
|
const http = createHttpBridge({
|
|
22703
23013
|
bridge,
|
|
22704
23014
|
port,
|
|
22705
23015
|
host,
|
|
22706
23016
|
mediaStage,
|
|
23017
|
+
artifactStore,
|
|
22707
23018
|
heartbeatMs: deps.heartbeatMs,
|
|
22708
23019
|
identity: { name: NAME, version: version22 },
|
|
22709
23020
|
log,
|
|
@@ -22814,7 +23125,7 @@ function killPortOwner(port, platform = process.platform) {
|
|
|
22814
23125
|
}
|
|
22815
23126
|
|
|
22816
23127
|
// src/adapter.ts
|
|
22817
|
-
import { randomUUID as
|
|
23128
|
+
import { randomUUID as randomUUID3 } from "crypto";
|
|
22818
23129
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
22819
23130
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
22820
23131
|
import {
|
|
@@ -23475,6 +23786,7 @@ __export(util_exports2, {
|
|
|
23475
23786
|
required: () => required2,
|
|
23476
23787
|
safeExtend: () => safeExtend2,
|
|
23477
23788
|
shallowClone: () => shallowClone2,
|
|
23789
|
+
sizeCaps: () => sizeCaps2,
|
|
23478
23790
|
slugify: () => slugify2,
|
|
23479
23791
|
stringifyPrimitive: () => stringifyPrimitive2,
|
|
23480
23792
|
toZod: () => toZod2,
|
|
@@ -23994,6 +24306,18 @@ function prefixIssues2(path, issues) {
|
|
|
23994
24306
|
function unwrapMessage2(message) {
|
|
23995
24307
|
return typeof message === "string" ? message : message?.message;
|
|
23996
24308
|
}
|
|
24309
|
+
function sizeCaps2(defChecks) {
|
|
24310
|
+
const caps = [];
|
|
24311
|
+
for (const ch of defChecks ?? []) {
|
|
24312
|
+
const d = ch._zod.def;
|
|
24313
|
+
if (!/_(length|size)$|_equals$/.test(d.check))
|
|
24314
|
+
break;
|
|
24315
|
+
const max = d.maximum ?? d.length ?? d.size;
|
|
24316
|
+
if (max >= 0)
|
|
24317
|
+
caps.push([max, ch]);
|
|
24318
|
+
}
|
|
24319
|
+
return caps;
|
|
24320
|
+
}
|
|
23997
24321
|
function attachSchema2(issues, start, inst) {
|
|
23998
24322
|
var _a5;
|
|
23999
24323
|
for (let i = start; i < issues.length; i++) {
|
|
@@ -25414,7 +25738,7 @@ ${content.join("\n")}
|
|
|
25414
25738
|
var version2 = {
|
|
25415
25739
|
major: 4,
|
|
25416
25740
|
minor: 6,
|
|
25417
|
-
patch:
|
|
25741
|
+
patch: 7
|
|
25418
25742
|
};
|
|
25419
25743
|
|
|
25420
25744
|
// ../node_modules/zod/v4/core/schemas.js
|
|
@@ -26170,6 +26494,31 @@ var $ZodDate2 = /* @__PURE__ */ $constructor2("$ZodDate", (inst, def) => {
|
|
|
26170
26494
|
return payload;
|
|
26171
26495
|
};
|
|
26172
26496
|
});
|
|
26497
|
+
function capSize2(inst, size) {
|
|
26498
|
+
const caps = sizeCaps2(inst._zod.def.checks);
|
|
26499
|
+
if (!caps.length)
|
|
26500
|
+
return;
|
|
26501
|
+
const cap = Math.min(...caps.map((c) => c[0]));
|
|
26502
|
+
const parse5 = inst._zod.parse;
|
|
26503
|
+
inst._zod.parse = (payload, ctx) => {
|
|
26504
|
+
const n = size(payload.value);
|
|
26505
|
+
if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
|
|
26506
|
+
for (const [max, ch] of sizeCaps2(inst._zod.def.checks)) {
|
|
26507
|
+
if (n > max && ch._zod.def.when(payload)) {
|
|
26508
|
+
const start = payload.issues.length;
|
|
26509
|
+
ch._zod.check(payload);
|
|
26510
|
+
payload.issues[start].continue = false;
|
|
26511
|
+
attachSchema2(payload.issues, start, inst);
|
|
26512
|
+
return payload;
|
|
26513
|
+
}
|
|
26514
|
+
}
|
|
26515
|
+
}
|
|
26516
|
+
return parse5(payload, ctx);
|
|
26517
|
+
};
|
|
26518
|
+
}
|
|
26519
|
+
var arraySize2 = (input3) => Array.isArray(input3) ? input3.length : -1;
|
|
26520
|
+
var mapSize2 = (input3) => input3 instanceof Map ? input3.size : -1;
|
|
26521
|
+
var setSize2 = (input3) => input3 instanceof Set ? input3.size : -1;
|
|
26173
26522
|
function handleArrayResult2(result, final, index) {
|
|
26174
26523
|
if (result.issues.length) {
|
|
26175
26524
|
final.issues.push(...prefixIssues2(index, result.issues));
|
|
@@ -26213,6 +26562,7 @@ var $ZodArray2 = /* @__PURE__ */ $constructor2("$ZodArray", (inst, def) => {
|
|
|
26213
26562
|
}
|
|
26214
26563
|
return payload;
|
|
26215
26564
|
};
|
|
26565
|
+
capSize2(inst, arraySize2);
|
|
26216
26566
|
});
|
|
26217
26567
|
function handlePropertyResult2(result, final, key, input3, optin, optout) {
|
|
26218
26568
|
const isPresent = key in input3;
|
|
@@ -27169,6 +27519,7 @@ var $ZodMap2 = /* @__PURE__ */ $constructor2("$ZodMap", (inst, def) => {
|
|
|
27169
27519
|
return Promise.all(proms).then(() => payload);
|
|
27170
27520
|
return payload;
|
|
27171
27521
|
};
|
|
27522
|
+
capSize2(inst, mapSize2);
|
|
27172
27523
|
});
|
|
27173
27524
|
function handleMapResult2(keyResult, valueResult, final, key, input3, inst, ctx) {
|
|
27174
27525
|
if (keyResult.issues.length) {
|
|
@@ -27235,6 +27586,7 @@ var $ZodSet2 = /* @__PURE__ */ $constructor2("$ZodSet", (inst, def) => {
|
|
|
27235
27586
|
return Promise.all(proms).then(() => payload);
|
|
27236
27587
|
return payload;
|
|
27237
27588
|
};
|
|
27589
|
+
capSize2(inst, setSize2);
|
|
27238
27590
|
});
|
|
27239
27591
|
function handleSetResult2(result, final) {
|
|
27240
27592
|
if (result.issues.length) {
|
|
@@ -36765,9 +37117,15 @@ function generateNullableCheck2(doc, ctx, schema2, accessor, buildsValue = true)
|
|
|
36765
37117
|
doc.write(`}`);
|
|
36766
37118
|
return outputVar;
|
|
36767
37119
|
}
|
|
37120
|
+
function generateSizeGate2(doc, schema2, size) {
|
|
37121
|
+
for (const [max, check3] of sizeCaps2(schema2._zod.def.checks)) {
|
|
37122
|
+
doc.write(`if (${size} > ${numericOperand2(max, check3._zod.def.check)}) return INVALID;`);
|
|
37123
|
+
}
|
|
37124
|
+
}
|
|
36768
37125
|
function generateArrayCheck2(doc, ctx, schema2, accessor, buildsValue = true) {
|
|
36769
37126
|
const def = schema2._zod.def;
|
|
36770
37127
|
doc.write(`if (!Array.isArray(${accessor})) return INVALID;`);
|
|
37128
|
+
generateSizeGate2(doc, schema2, `${accessor}.length`);
|
|
36771
37129
|
const outputVar = buildsValue ? newVar2(ctx) : null;
|
|
36772
37130
|
const iVar = newVar2(ctx);
|
|
36773
37131
|
const elemVar = newVar2(ctx);
|
|
@@ -37167,6 +37525,7 @@ function literalPropertyKey2(ctx, key) {
|
|
|
37167
37525
|
function generateMapCheck2(doc, ctx, schema2, accessor) {
|
|
37168
37526
|
const def = schema2._zod.def;
|
|
37169
37527
|
doc.write(`if (!(${accessor} instanceof Map)) return INVALID;`);
|
|
37528
|
+
generateSizeGate2(doc, schema2, `${accessor}.size`);
|
|
37170
37529
|
const outputVar = newVar2(ctx);
|
|
37171
37530
|
const kVar = newVar2(ctx);
|
|
37172
37531
|
const valVar = newVar2(ctx);
|
|
@@ -37183,6 +37542,7 @@ function generateMapCheck2(doc, ctx, schema2, accessor) {
|
|
|
37183
37542
|
function generateSetCheck2(doc, ctx, schema2, accessor) {
|
|
37184
37543
|
const def = schema2._zod.def;
|
|
37185
37544
|
doc.write(`if (!(${accessor} instanceof Set)) return INVALID;`);
|
|
37545
|
+
generateSizeGate2(doc, schema2, `${accessor}.size`);
|
|
37186
37546
|
const outputVar = newVar2(ctx);
|
|
37187
37547
|
const valVar = newVar2(ctx);
|
|
37188
37548
|
doc.write(`const ${outputVar} = new Set();`);
|
|
@@ -42876,11 +43236,22 @@ var TOOL_TIERS2 = Object.freeze({
|
|
|
42876
43236
|
photo_node_remove: "destructive",
|
|
42877
43237
|
photo_page_remove: "destructive",
|
|
42878
43238
|
photo_template_apply: "destructive",
|
|
43239
|
+
// One confirm for the whole batch, at the grade of the worst op it may hold.
|
|
43240
|
+
photo_apply: "destructive",
|
|
43241
|
+
photo_history_undo: "write",
|
|
43242
|
+
photo_history_redo: "write",
|
|
43243
|
+
photo_preview: "read",
|
|
43244
|
+
// Rendering into memory changes nothing; saving the file is the asked step.
|
|
43245
|
+
photo_export: "read",
|
|
43246
|
+
photo_job_status: "read",
|
|
42879
43247
|
// ── Gallery: the free way in ────────────────────────────────────
|
|
42880
43248
|
//
|
|
42881
43249
|
// Destructive because it reads a path off the user's disk, the same
|
|
42882
43250
|
// capability editor_insert_image carries, and the confirm names that read.
|
|
42883
43251
|
gallery_image_add: "destructive",
|
|
43252
|
+
// Writes one finished editor export to the connector's own folder (MCP) or
|
|
43253
|
+
// to Downloads (panel). It names the file, so it is asked every time.
|
|
43254
|
+
gallery_export_save: "write",
|
|
42884
43255
|
// ── Video editor (our own surface) ──────────────────────────────
|
|
42885
43256
|
video_project_get: "read",
|
|
42886
43257
|
video_project_new: "destructive",
|
|
@@ -42911,6 +43282,12 @@ var TOOL_TIERS2 = Object.freeze({
|
|
|
42911
43282
|
video_node_remove: "destructive",
|
|
42912
43283
|
video_scene_remove: "destructive",
|
|
42913
43284
|
video_narration_generate: "paid",
|
|
43285
|
+
video_apply: "destructive",
|
|
43286
|
+
video_history_undo: "write",
|
|
43287
|
+
video_history_redo: "write",
|
|
43288
|
+
video_preview: "read",
|
|
43289
|
+
video_export: "read",
|
|
43290
|
+
video_job_status: "read",
|
|
42914
43291
|
// ── Post editor: reads ──────────────────────────────────────────
|
|
42915
43292
|
editor_read: "read",
|
|
42916
43293
|
editor_read_structure: "read",
|
|
@@ -43329,7 +43706,7 @@ function credentialHeader() {
|
|
|
43329
43706
|
const token = process.env["DATALAB_MCP_TOKEN"]?.trim();
|
|
43330
43707
|
return token ? { authorization: `Bearer ${token}` } : {};
|
|
43331
43708
|
}
|
|
43332
|
-
var CLIENT_ID =
|
|
43709
|
+
var CLIENT_ID = randomUUID3();
|
|
43333
43710
|
var CLIENT_ID_HEADER = "x-datalab-mcp-client";
|
|
43334
43711
|
async function postMcp(fetchImpl, url3, method, params) {
|
|
43335
43712
|
nextRpcId += 1;
|
|
@@ -43721,7 +44098,7 @@ async function updateInstalledCopy(selfVersion, log, deps = {}) {
|
|
|
43721
44098
|
return "migrated";
|
|
43722
44099
|
}
|
|
43723
44100
|
async function quietInstallerIo() {
|
|
43724
|
-
const installer = await import("./dist-
|
|
44101
|
+
const installer = await import("./dist-5AJOOWYN.js");
|
|
43725
44102
|
const io = installer.createNodeIo();
|
|
43726
44103
|
io.out = (line) => defaultLog(line);
|
|
43727
44104
|
return { installer, io };
|
package/dist/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
resolveConfig,
|
|
5
5
|
runAdapter,
|
|
6
6
|
runDaemon
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-6JNPGDU7.js";
|
|
8
8
|
import "./chunk-MLKGABMK.js";
|
|
9
9
|
|
|
10
10
|
// src/cli.ts
|
|
@@ -16,7 +16,7 @@ function log(message) {
|
|
|
16
16
|
`);
|
|
17
17
|
}
|
|
18
18
|
async function runInstaller(sub, argv) {
|
|
19
|
-
const { createNodeIo, runInstall, runUninstall } = await import("./dist-
|
|
19
|
+
const { createNodeIo, runInstall, runUninstall } = await import("./dist-5AJOOWYN.js");
|
|
20
20
|
const opts = { version: VERSION };
|
|
21
21
|
for (let i = 0; i < argv.length; i += 1) {
|
|
22
22
|
const flag = argv[i];
|
|
@@ -1063,7 +1063,7 @@ async function installGlobally(io, version, opts) {
|
|
|
1063
1063
|
if (code !== 0) return { ok: false, reason: "install-failed" };
|
|
1064
1064
|
return resolveGlobalLaunch(io, version);
|
|
1065
1065
|
}
|
|
1066
|
-
async function uninstallGlobally(io) {
|
|
1066
|
+
async function uninstallGlobally(io, opts) {
|
|
1067
1067
|
if (io.npmRootGlobal === void 0) return false;
|
|
1068
1068
|
const root = await io.npmRootGlobal();
|
|
1069
1069
|
if (root === "" || !await io.exists(globalPackageDir(io, root))) {
|
|
@@ -1072,7 +1072,7 @@ async function uninstallGlobally(io) {
|
|
|
1072
1072
|
try {
|
|
1073
1073
|
const result = await io.spawn("npm", ["uninstall", "-g", SERVER_PACKAGE], {
|
|
1074
1074
|
shell: io.platform === "win32",
|
|
1075
|
-
inheritStdio:
|
|
1075
|
+
inheritStdio: opts.inheritStdio
|
|
1076
1076
|
});
|
|
1077
1077
|
return result.code === 0;
|
|
1078
1078
|
} catch {
|
|
@@ -2402,8 +2402,9 @@ function methodOf(host, withCatalog) {
|
|
|
2402
2402
|
}
|
|
2403
2403
|
async function connect(opts, io, ui, hosts, entryOpts, withCatalog) {
|
|
2404
2404
|
const notices = [];
|
|
2405
|
+
const verbose = opts.verbose === true;
|
|
2405
2406
|
const installed = await installGlobally(io, entryOpts.version, {
|
|
2406
|
-
inheritStdio:
|
|
2407
|
+
inheritStdio: verbose
|
|
2407
2408
|
});
|
|
2408
2409
|
const launchOpts = installed.ok ? { ...entryOpts, launch: installed.launch } : entryOpts;
|
|
2409
2410
|
if (!installed.ok) {
|
|
@@ -2412,7 +2413,6 @@ async function connect(opts, io, ui, hosts, entryOpts, withCatalog) {
|
|
|
2412
2413
|
lines: GLOBAL_INSTALL_FALLBACK[installed.reason]
|
|
2413
2414
|
});
|
|
2414
2415
|
}
|
|
2415
|
-
const verbose = opts.verbose === true;
|
|
2416
2416
|
const reports = [];
|
|
2417
2417
|
for (const host of hosts) {
|
|
2418
2418
|
const outcomes = [
|
|
@@ -2522,7 +2522,7 @@ async function runUninstall(opts, io) {
|
|
|
2522
2522
|
}
|
|
2523
2523
|
printHostReports(ui, reports);
|
|
2524
2524
|
await cleanupLegacySkills(io, new Set(hosts.map((host) => host.id)));
|
|
2525
|
-
if (await uninstallGlobally(io)) {
|
|
2525
|
+
if (await uninstallGlobally(io, { inheritStdio: verbose })) {
|
|
2526
2526
|
ui.blank();
|
|
2527
2527
|
ui.notice("\uC815\uB9AC", [GLOBAL_UNINSTALLED]);
|
|
2528
2528
|
}
|
package/dist/index.js
CHANGED