@pecot/visual-mcp 1.1.0 → 1.3.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/.claude-plugin/plugin.json +1 -1
- package/assets/slidev/deck-lint.config.js +2 -2
- package/assets/slidev/deck-lint.env.config.js +2 -2
- package/assets/slidev/package.json +7 -7
- package/assets/slidev/runtime/package.json +11 -11
- package/assets/slidev/scripts/eslint/_shared/dist/lib/drawio-geometry.js +10 -10
- package/assets/slidev/scripts/eslint/_shared/dist/lib/text-measurer.d.ts +2 -2
- package/assets/slidev/scripts/eslint/_shared/dist/lib/text-measurer.js +4 -4
- package/assets/slidev/scripts/eslint/_shared/dist/tsconfig.tsbuildinfo +1 -1
- package/assets/slidev/scripts/eslint/_shared/lib/drawio-geometry.ts +10 -10
- package/assets/slidev/scripts/eslint/_shared/lib/text-measurer.ts +4 -4
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-content-before-frontmatter.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-missing-marker-cell.js +4 -4
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-missing-page.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-numeric-asset-prefix.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-numeric-filename-prefix.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-scaled-drawio.js +3 -3
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-triple-hyphen-in-frontmatter.js +3 -3
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/no-unknown-props.js +3 -3
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/one-slide-per-file.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/require-matching-length.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/require-slides-entry.js +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/lib/rules/validate-clicks.js +7 -7
- package/assets/slidev/scripts/eslint/slidev-pages-lint/dist/tsconfig.tsbuildinfo +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-content-before-frontmatter.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-missing-marker-cell.ts +4 -4
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-missing-page.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-numeric-asset-prefix.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-numeric-filename-prefix.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-scaled-drawio.ts +3 -3
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-triple-hyphen-in-frontmatter.ts +3 -3
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/no-unknown-props.ts +3 -3
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/one-slide-per-file.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/require-matching-length.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/require-slides-entry.ts +1 -1
- package/assets/slidev/scripts/eslint/slidev-pages-lint/lib/rules/validate-clicks.ts +7 -7
- package/assets/slidev/scripts/eslint/slidev-pages-lint/package.json +1 -1
- package/assets/slidev/scripts/eslint/text-constraints/dist/lib/rules/max-chars.js +6 -6
- package/assets/slidev/scripts/eslint/text-constraints/dist/lib/rules/textlint-body.js +3 -3
- package/assets/slidev/scripts/eslint/text-constraints/dist/lib/rules/textlint.js +2 -2
- package/assets/slidev/scripts/eslint/text-constraints/dist/tsconfig.tsbuildinfo +1 -1
- package/assets/slidev/scripts/eslint/text-constraints/lib/rules/max-chars.ts +6 -6
- package/assets/slidev/scripts/eslint/text-constraints/lib/rules/textlint-body.ts +3 -3
- package/assets/slidev/scripts/eslint/text-constraints/lib/rules/textlint.ts +2 -2
- package/assets/slidev/scripts/eslint/text-constraints/package.json +1 -1
- package/assets/slidev/scripts/eslint/validate-references/dist/index.js +1 -1
- package/assets/slidev/scripts/eslint/validate-references/dist/lib/schema-validator.js +1 -1
- package/assets/slidev/scripts/eslint/validate-references/dist/lib/semantic-validator.js +12 -12
- package/assets/slidev/scripts/eslint/validate-references/dist/tsconfig.tsbuildinfo +1 -1
- package/assets/slidev/scripts/eslint/validate-references/index.ts +1 -1
- package/assets/slidev/scripts/eslint/validate-references/lib/schema-validator.ts +2 -2
- package/assets/slidev/scripts/eslint/validate-references/lib/semantic-validator.ts +12 -12
- package/assets/slidev/scripts/eslint/validate-references/package.json +1 -1
- package/cli/dist/cli.js +11 -10
- package/cli/dist/commands/chromium/host-dependencies.js +14 -7
- package/cli/dist/commands/drawio/export.js +27 -24
- package/cli/dist/commands/drawio/theme.js +8 -8
- package/cli/dist/commands/drawio/url.js +40 -32
- package/cli/dist/commands/evidence-xlsx/create.js +19 -18
- package/cli/dist/commands/pptx-ooxml/preview.js +26 -30
- package/cli/dist/commands/slidev-project/create.js +27 -26
- package/cli/dist/commands/slidev-project/linked-theme.js +5 -5
- package/cli/dist/commands/slidev-project/lint.js +29 -27
- package/cli/dist/commands/slidev-project/sync.js +35 -34
- package/cli/dist/commands/slidev-project/theme.js +19 -18
- package/cli/dist/commands/slidev-to-pptx/convert.d.ts +4 -0
- package/cli/dist/commands/slidev-to-pptx/convert.js +88 -75
- package/cli/dist/diagnostics.d.ts +38 -0
- package/cli/dist/diagnostics.js +46 -0
- package/cli/dist/domain/_shared/ports.d.ts +0 -1
- package/cli/dist/domain/_shared/text-check.js +2 -2
- package/cli/dist/domain/drawio/export.js +4 -4
- package/cli/dist/domain/drawio/label-text.js +1 -1
- package/cli/dist/domain/drawio/url.d.ts +11 -7
- package/cli/dist/domain/drawio/url.js +67 -45
- package/cli/dist/domain/evidence-xlsx/image-dimensions.js +14 -14
- package/cli/dist/domain/evidence-xlsx/spec-schema.js +26 -26
- package/cli/dist/domain/pptx-ooxml/merge.js +3 -3
- package/cli/dist/domain/pptx-ooxml/prerender-replace.d.ts +1 -0
- package/cli/dist/domain/pptx-ooxml/prerender-replace.js +3 -3
- package/cli/dist/domain/slidev-project/generated-files.d.ts +1 -1
- package/cli/dist/domain/slidev-project/generated-files.js +36 -36
- package/cli/dist/domain/slidev-project/initial-pages.js +4 -4
- package/cli/dist/domain/slidev-project/lint.js +11 -11
- package/cli/dist/domain/slidev-project/sync.js +13 -13
- package/cli/dist/domain/slidev-project/warnings.js +4 -4
- package/cli/dist/domain/slidev-theme/declaration.js +9 -9
- package/cli/dist/domain/slidev-theme/references.js +10 -10
- package/cli/dist/domain/slidev-theme/store-layout.js +6 -6
- package/cli/dist/domain/slidev-theme/talk-theme.js +13 -13
- package/cli/dist/domain/slidev-theme/theme-spec.js +5 -5
- package/cli/dist/domain/slidev-to-pptx/errors.js +3 -3
- package/cli/dist/infra/_shared/dependency-root.js +4 -4
- package/cli/dist/infra/_shared/patch-apply.js +6 -5
- package/cli/dist/infra/_shared/runtime-install.d.ts +12 -84
- package/cli/dist/infra/_shared/runtime-install.js +74 -108
- package/cli/dist/infra/_shared/slidev-bin.js +1 -1
- package/cli/dist/infra/drawio/icons.js +3 -3
- package/cli/dist/infra/drawio/pdf.js +1 -1
- package/cli/dist/infra/drawio/screenshot.js +10 -9
- package/cli/dist/infra/evidence-xlsx/workbook-writer.js +2 -2
- package/cli/dist/infra/playwright/chromium.js +4 -3
- package/cli/dist/infra/playwright/host-dependencies.js +8 -8
- package/cli/dist/infra/playwright/launch.js +5 -5
- package/cli/dist/infra/pptx-ooxml/soffice.js +2 -2
- package/cli/dist/infra/slidev-project/eslint-runner.js +10 -9
- package/cli/dist/infra/slidev-project/fs.js +6 -6
- package/cli/dist/infra/slidev-theme/store.js +18 -15
- package/cli/dist/infra/slidev-to-pptx/cache-store.js +6 -6
- package/cli/dist/infra/slidev-to-pptx/console-logger.d.ts +5 -5
- package/cli/dist/infra/slidev-to-pptx/console-logger.js +19 -20
- package/cli/dist/infra/slidev-to-pptx/dom-converter.d.ts +1 -1
- package/cli/dist/infra/slidev-to-pptx/dom-converter.js +12 -12
- package/cli/dist/infra/slidev-to-pptx/index.js +1 -9
- package/cli/dist/infra/slidev-to-pptx/pipeline.d.ts +2 -2
- package/cli/dist/infra/slidev-to-pptx/pipeline.js +56 -56
- package/cli/dist/infra/slidev-to-pptx/prerender-capture.js +14 -14
- package/cli/dist/infra/slidev-to-pptx/prerender.js +10 -10
- package/cli/dist/infra/slidev-to-pptx/runner.js +1 -0
- package/cli/dist/infra/slidev-to-pptx/scanner.js +10 -10
- package/cli/dist/infra/slidev-to-pptx/server.d.ts +2 -1
- package/cli/dist/infra/slidev-to-pptx/server.js +3 -3
- package/cli/dist/infra/slidev-to-pptx/single-pass-worker.js +39 -39
- package/cli/dist/infra/slidev-to-pptx/slide-worker.js +3 -3
- package/cli/dist/infra/slidev-to-pptx/visibility-helpers.js +8 -8
- package/cli/dist/mcp/dev-server-registry.js +10 -9
- package/cli/dist/mcp/queue.js +1 -1
- package/cli/dist/mcp/result.js +4 -4
- package/cli/dist/mcp/serve.js +5 -3
- package/cli/dist/mcp/server.js +2 -2
- package/cli/dist/mcp/tools/_shared.d.ts +1 -1
- package/cli/dist/mcp/tools/_shared.js +47 -38
- package/cli/dist/mcp/tools/drawio.js +23 -22
- package/cli/dist/mcp/tools/evidence.js +8 -8
- package/cli/dist/mcp/tools/setup.js +26 -26
- package/cli/dist/mcp/tools/slide-dev.js +20 -20
- package/cli/dist/mcp/tools/slide-page.js +39 -37
- package/cli/dist/mcp/tools/slide-theme.js +6 -6
- package/cli/dist/mcp/tools/slide.js +52 -50
- package/cli/dist/mcp/windows-path.js +8 -7
- package/cli/dist/node-runtime.d.ts +6 -1
- package/cli/dist/node-runtime.js +16 -8
- package/npm-shrinkwrap.json +46 -52
- package/package.json +6 -6
- package/vendor/text-rules/dist/source-hash +1 -1
|
@@ -24,9 +24,9 @@ function logNavigationStall(logger, hasNext, stepCount) {
|
|
|
24
24
|
if (!logger)
|
|
25
25
|
return;
|
|
26
26
|
const reason = hasNext === null
|
|
27
|
-
? 'hasNext
|
|
28
|
-
: 'hasNext
|
|
29
|
-
logger.verbose(` ${stepCount.toString()}
|
|
27
|
+
? 'cannot read hasNext and the URL did not change before timeout'
|
|
28
|
+
: 'hasNext is true but the URL did not change before timeout (e.g. a deck with navViaArrowKeys disabled, or delayed nav state)';
|
|
29
|
+
logger.verbose(` ended at ${stepCount.toString()} steps: ${reason}`);
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
32
|
ArrowRight を 1 回押して次のステップの URL を返す。終端なら null を返す。
|
|
@@ -43,7 +43,7 @@ page, logger, stepCount) {
|
|
|
43
43
|
const hasNext = await readSlidevHasNext(page);
|
|
44
44
|
if (hasNext === false) {
|
|
45
45
|
if (logger)
|
|
46
|
-
logger.verbose(` ${stepCount.toString()}
|
|
46
|
+
logger.verbose(` ended at ${stepCount.toString()} steps: hasNext=false`);
|
|
47
47
|
return null;
|
|
48
48
|
}
|
|
49
49
|
const previousUrl = page.url();
|
|
@@ -71,17 +71,17 @@ export async function scanSlideSteps(
|
|
|
71
71
|
page, maxSteps, logger, onProgress) {
|
|
72
72
|
const steps = [];
|
|
73
73
|
steps.push(parseSlideUrl(page.url()));
|
|
74
|
-
onProgress?.('
|
|
74
|
+
onProgress?.('scan: step 1 detected');
|
|
75
75
|
for (let i = 1; i < maxSteps; i++) {
|
|
76
76
|
const currentUrl = await advanceToNextStep(page, logger, steps.length);
|
|
77
77
|
if (currentUrl === null)
|
|
78
78
|
break;
|
|
79
79
|
const parsed = parseSlideUrl(currentUrl);
|
|
80
|
-
logger.verbose(`
|
|
80
|
+
logger.verbose(` step ${(steps.length + 1).toString()}: slide ${parsed.slideNumber.toString()}, click ${parsed.clickStep === null ? '-' : parsed.clickStep.toString()}`);
|
|
81
81
|
steps.push(parsed);
|
|
82
|
-
onProgress?.(
|
|
82
|
+
onProgress?.(`scan: step ${steps.length.toString()} detected`);
|
|
83
83
|
}
|
|
84
|
-
logger.info(
|
|
84
|
+
logger.info(`scanned ${steps.length.toString()} steps`);
|
|
85
85
|
return steps;
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
@@ -121,14 +121,14 @@ export async function buildOnlySteps(onlySpec, baseUrl, format, page = null, log
|
|
|
121
121
|
if (parsed.slideNumber !== slide)
|
|
122
122
|
break;
|
|
123
123
|
if (logger)
|
|
124
|
-
logger.verbose(` click ${parsed.clickStep === null ? '-' : parsed.clickStep.toString()}
|
|
124
|
+
logger.verbose(` click ${parsed.clickStep === null ? '-' : parsed.clickStep.toString()} detected`);
|
|
125
125
|
steps.push(parsed);
|
|
126
126
|
}
|
|
127
127
|
if (steps.length === 0) {
|
|
128
128
|
throw new Error(`No steps found for slide ${slide.toString()}. The slide may not exist.`);
|
|
129
129
|
}
|
|
130
130
|
if (logger) {
|
|
131
|
-
logger.info(
|
|
131
|
+
logger.info(`scanned ${steps.length.toString()} steps of slide ${slide.toString()}`);
|
|
132
132
|
}
|
|
133
133
|
return steps;
|
|
134
134
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Server } from 'node:http';
|
|
2
|
+
import type { Logger } from '../../domain/slidev-to-pptx/logger.js';
|
|
2
3
|
export declare const LOOPBACK_HOST = "127.0.0.1";
|
|
3
4
|
/**
|
|
4
5
|
dist 配信サーバが実際に bind したポートを解決する。
|
|
@@ -14,5 +15,5 @@ routerMode: history のデッキではスライド URL がパス (/2, /5/3 等)
|
|
|
14
15
|
そのため拡張子を持たないパスは、index.html を返してクライアントサイドルータに委譲する。
|
|
15
16
|
routerMode: hash のデッキはスライド番号がフラグメントに載り、サーバーには常に / だけが要求される。
|
|
16
17
|
*/
|
|
17
|
-
export declare function startServer(distDir: string, port: number): Promise<Server>;
|
|
18
|
+
export declare function startServer(distDir: string, port: number, logger: Pick<Logger, 'error'>): Promise<Server>;
|
|
18
19
|
//# sourceMappingURL=server.d.ts.map
|
|
@@ -20,7 +20,7 @@ export function resolveBoundPort(server, fallbackPort) {
|
|
|
20
20
|
if (address !== null && typeof address === 'object')
|
|
21
21
|
return address.port;
|
|
22
22
|
if (fallbackPort === 0) {
|
|
23
|
-
throw new Error('
|
|
23
|
+
throw new Error('cannot resolve the bind port of the dist server (address() did not return AddressInfo and the requested port is 0 (ephemeral))');
|
|
24
24
|
}
|
|
25
25
|
return fallbackPort;
|
|
26
26
|
}
|
|
@@ -30,7 +30,7 @@ routerMode: history のデッキではスライド URL がパス (/2, /5/3 等)
|
|
|
30
30
|
そのため拡張子を持たないパスは、index.html を返してクライアントサイドルータに委譲する。
|
|
31
31
|
routerMode: hash のデッキはスライド番号がフラグメントに載り、サーバーには常に / だけが要求される。
|
|
32
32
|
*/
|
|
33
|
-
export function startServer(distDir, port) {
|
|
33
|
+
export function startServer(distDir, port, logger) {
|
|
34
34
|
return new Promise((resolve, reject) => {
|
|
35
35
|
const server = createServer((request, res) => {
|
|
36
36
|
void (async () => {
|
|
@@ -81,7 +81,7 @@ export function startServer(distDir, port) {
|
|
|
81
81
|
// 以後のサーバエラー (配信中の socket error 等) は通知なしで捨てず、変換ログから観測できるようにする。
|
|
82
82
|
server.removeListener('error', reject);
|
|
83
83
|
server.on('error', (error) => {
|
|
84
|
-
|
|
84
|
+
logger.error(`dist server error: ${error.message}`);
|
|
85
85
|
});
|
|
86
86
|
// 起動ログは呼び出し元 (pipeline.ts) が logger 経由で出す。ここで console.log すると
|
|
87
87
|
// `slide convert --json` の stdout (JSON 行専用) に混在する。
|
|
@@ -232,7 +232,7 @@ async function waitForGroupRendered(page, groupScope) {
|
|
|
232
232
|
}
|
|
233
233
|
catch (error) {
|
|
234
234
|
// 時間切れのほか、ページの close / crash もここに来る。原因を理由に残す。
|
|
235
|
-
return
|
|
235
|
+
return `slide did not finish loading within ${(timeouts.slideVisibility / 1000).toString()} s: ${errorMessage(error)}`;
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
238
|
/**
|
|
@@ -251,11 +251,11 @@ async function detectPrintRoute(page) {
|
|
|
251
251
|
catch {
|
|
252
252
|
return {
|
|
253
253
|
kind: 'undetermined',
|
|
254
|
-
reason: `print
|
|
254
|
+
reason: `cannot detect the print route; ${PRINT_ROUTE_PROBE_SELECTOR} did not appear within ${(CONTAINER_APPEAR_TIMEOUT_MS / 1000).toString()} s`,
|
|
255
255
|
};
|
|
256
256
|
}
|
|
257
257
|
const isPresent = await page.evaluate((selector) => globalThis.document.querySelector(selector) !== null, PRINT_ROOT_SELECTOR);
|
|
258
|
-
return isPresent ? { kind: 'present' } : { kind: 'missing', reason: '
|
|
258
|
+
return isPresent ? { kind: 'present' } : { kind: 'missing', reason: 'the deck build has no print route' };
|
|
259
259
|
}
|
|
260
260
|
/**
|
|
261
261
|
print コンテナが期待どおり揃うまで待つ。揃わなければ退避理由を返す。
|
|
@@ -266,7 +266,7 @@ async function waitForContainers(page, totalSteps, groupIds) {
|
|
|
266
266
|
await page.waitForFunction((selector) => document.querySelectorAll(selector).length > 0, PRINT_CONTAINER_SELECTOR, { timeout: CONTAINER_APPEAR_TIMEOUT_MS });
|
|
267
267
|
}
|
|
268
268
|
catch {
|
|
269
|
-
return `print
|
|
269
|
+
return `print container did not appear within ${(CONTAINER_APPEAR_TIMEOUT_MS / 1000).toString()} s`;
|
|
270
270
|
}
|
|
271
271
|
try {
|
|
272
272
|
// コンテナは Vue の描画に合わせて段階的に増えるため、期待数に届くまで待つ。
|
|
@@ -277,11 +277,11 @@ async function waitForContainers(page, totalSteps, groupIds) {
|
|
|
277
277
|
}
|
|
278
278
|
const ids = await page.evaluate((selector) => [...globalThis.document.querySelectorAll(selector)].map(element => element.id), PRINT_CONTAINER_SELECTOR);
|
|
279
279
|
if (ids.length !== totalSteps) {
|
|
280
|
-
return `print
|
|
280
|
+
return `print container count does not match the step count of the full scan: ${ids.length.toString()} containers, ${totalSteps.toString()} steps`;
|
|
281
281
|
}
|
|
282
282
|
const present = new Set(ids);
|
|
283
283
|
const missing = groupIds.filter(id => !present.has(id));
|
|
284
|
-
return missing.length > 0 ?
|
|
284
|
+
return missing.length > 0 ? `print container not found for steps: ${missing.slice(0, 5).join(', ')}` : undefined;
|
|
285
285
|
}
|
|
286
286
|
/**
|
|
287
287
|
print ページで変換・撮影の前提が揃うまで待つ。
|
|
@@ -368,7 +368,7 @@ async function waitSelectorGroupsInContainer(page, groups, containerId, timeoutC
|
|
|
368
368
|
});
|
|
369
369
|
}
|
|
370
370
|
catch (error) {
|
|
371
|
-
unresolved.push(`${group.targetSelector}
|
|
371
|
+
unresolved.push(`${group.targetSelector}: ${group.strategySelector} did not disappear within ${(timeout / 1000).toString()} s: ${errorMessage(error)}`);
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
374
|
return unresolved;
|
|
@@ -400,9 +400,9 @@ async function warmupPageB(page, groupIds, targets, config, logger) {
|
|
|
400
400
|
if (unresolved.length > 0)
|
|
401
401
|
timedOut.push(containerId);
|
|
402
402
|
for (const description of unresolved)
|
|
403
|
-
logger.warn(`
|
|
403
|
+
logger.warn(` container ${containerId}: render wait timed out: ${description}`);
|
|
404
404
|
if (unresolved.length === 0)
|
|
405
|
-
logger.info(`
|
|
405
|
+
logger.info(` container ${containerId}: render completion detected: ${groups.map(group => group.targetSelector).join(', ')}`);
|
|
406
406
|
});
|
|
407
407
|
waitMs += waited;
|
|
408
408
|
}
|
|
@@ -428,12 +428,12 @@ async function openPageB(request, config, prepared, targets) {
|
|
|
428
428
|
const [, gotoB] = await timed(async () => pageB.goto(prepared.url, { waitUntil: 'load' }));
|
|
429
429
|
const notReadyB = await awaitPrintPageReady(pageB, request.totalSteps, prepared.groupIds, prepared.groupScope, logger);
|
|
430
430
|
if (notReadyB !== undefined)
|
|
431
|
-
return { reason:
|
|
431
|
+
return { reason: `hiRes page: ${notReadyB}` };
|
|
432
432
|
const warmup = await warmupPageB(pageB, prepared.groupIds, targets, config, logger);
|
|
433
433
|
for (const containerId of warmup.timedOut)
|
|
434
434
|
prepared.warmupTimedOut.add(containerId);
|
|
435
|
-
logger.info(`
|
|
436
|
-
request.onProgress?.('
|
|
435
|
+
logger.info(`single-pass: hiRes page prepared; prerender targets: ${targets.map(target => target.selector).join(', ')}`);
|
|
436
|
+
request.onProgress?.('single-pass: hiRes page prepared');
|
|
437
437
|
prepared.pageB = pageB;
|
|
438
438
|
prepared.pageBTiming = { goto: gotoB, wait: warmup.waitMs, scrollWarmup: warmup.scrollMs };
|
|
439
439
|
return { page: pageB };
|
|
@@ -452,10 +452,10 @@ async function tryOpenPageB(request, config, prepared, targets) {
|
|
|
452
452
|
reason = openedB.reason;
|
|
453
453
|
}
|
|
454
454
|
catch (error) {
|
|
455
|
-
reason =
|
|
455
|
+
reason = `cannot prepare the hiRes page: ${errorMessage(error)}`;
|
|
456
456
|
}
|
|
457
457
|
prepared.pageBFailure = reason;
|
|
458
|
-
request.logger.warn(`
|
|
458
|
+
request.logger.warn(`single-pass: ${reason}; steps with prerender targets are converted with the current method`);
|
|
459
459
|
return { reason };
|
|
460
460
|
}
|
|
461
461
|
/**
|
|
@@ -488,8 +488,8 @@ async function preparePages(request, steps, config, contexts, opened) {
|
|
|
488
488
|
const [, cssSettleA] = await timed(async () => waitForCssAnimations(pageA, timeouts.cssAnimationSettle, logger));
|
|
489
489
|
const [, iframeLoadA] = await timed(async () => waitForIframeLoad(pageA, '.artifact-iframe', timeouts.iframeLoad, logger));
|
|
490
490
|
const [, injectA] = await timed(async () => injectDomToPptx(pageA, request.workerConfig.libPath));
|
|
491
|
-
logger.info(`
|
|
492
|
-
request.onProgress?.('
|
|
491
|
+
logger.info(`single-pass: conversion page prepared for ${steps.length.toString()} steps`);
|
|
492
|
+
request.onProgress?.('single-pass: conversion page prepared');
|
|
493
493
|
const prepared = {
|
|
494
494
|
kind: 'ready',
|
|
495
495
|
contexts,
|
|
@@ -523,7 +523,7 @@ async function ensurePageB(request, config, prepared, containerId) {
|
|
|
523
523
|
return prepared.pageB;
|
|
524
524
|
if (prepared.pageBFailure !== undefined)
|
|
525
525
|
throw new Error(prepared.pageBFailure);
|
|
526
|
-
request.logger.warn(`
|
|
526
|
+
request.logger.warn(`single-pass: container ${containerId} has prerender targets, so opening the hiRes page (not detected at preparation)`);
|
|
527
527
|
const groupTargets = await findPresentTargets(prepared.pageA, config.targets, prepared.groupScope);
|
|
528
528
|
const openedB = await tryOpenPageB(request, config, prepared, groupTargets);
|
|
529
529
|
if ('reason' in openedB)
|
|
@@ -540,7 +540,7 @@ async function containerOrigin(page, containerId) {
|
|
|
540
540
|
return rect === undefined ? undefined : { x: rect.x, y: rect.y };
|
|
541
541
|
}, containerScopeSelector(containerId));
|
|
542
542
|
if (origin === undefined)
|
|
543
|
-
throw new Error(
|
|
543
|
+
throw new Error(`print container not found for step: ${containerId}`);
|
|
544
544
|
return origin;
|
|
545
545
|
}
|
|
546
546
|
/**
|
|
@@ -558,7 +558,7 @@ async function prerenderInContainer(request) {
|
|
|
558
558
|
let hiResElements = [];
|
|
559
559
|
// ページ A / B はグループ全体で使い続けるため、ターゲットごとにハンドルを解放する
|
|
560
560
|
try {
|
|
561
|
-
logger.verbose(` ${target.selector}: ${elements.length.toString()}
|
|
561
|
+
logger.verbose(` ${target.selector}: ${elements.length.toString()} found`);
|
|
562
562
|
if (elements.length === 0)
|
|
563
563
|
continue;
|
|
564
564
|
origin ??= await containerOrigin(pageA, containerId);
|
|
@@ -578,13 +578,13 @@ async function prerenderInContainer(request) {
|
|
|
578
578
|
const recheckCap = warmupTimedOut.has(containerId) ? PRE_CAPTURE_RECHECK_TIMEOUT_MS : undefined;
|
|
579
579
|
const unresolved = await waitSelectorGroupsInContainer(pageB, selectorWaitGroups(targets, config), containerId, recheckCap);
|
|
580
580
|
if (unresolved.length > 0) {
|
|
581
|
-
throw new Error(
|
|
581
|
+
throw new Error(`prerender targets did not finish loading on the hiRes page: container ${containerId}: ${unresolved.join(' / ')}`);
|
|
582
582
|
}
|
|
583
583
|
}
|
|
584
584
|
hiResElements = await locateTargetsInVisibleSlides(pageB, target.selector, scope);
|
|
585
|
-
logger.verbose(` ${target.selector}: ${hiResElements.length.toString()}
|
|
585
|
+
logger.verbose(` ${target.selector}: ${hiResElements.length.toString()} found (hiRes)`);
|
|
586
586
|
if (elements.length !== hiResElements.length) {
|
|
587
|
-
logger.warn(`
|
|
587
|
+
logger.warn(` ${target.selector}: detected count mismatch (page: ${elements.length.toString()}, hiRes: ${hiResElements.length.toString()})`);
|
|
588
588
|
}
|
|
589
589
|
const capture = await captureAndReplaceElements({
|
|
590
590
|
hiResPage: pageB,
|
|
@@ -601,10 +601,10 @@ async function prerenderInContainer(request) {
|
|
|
601
601
|
results.push(...capture.results);
|
|
602
602
|
globalIndex += capture.processedCount;
|
|
603
603
|
if (capture.count > 0) {
|
|
604
|
-
logger.info(`
|
|
604
|
+
logger.info(` prerender: ${target.selector} → ${capture.count.toString()} rendered to images (${config.deviceScaleFactor.toString()}x)`);
|
|
605
605
|
}
|
|
606
606
|
if (capture.errors.length > 0) {
|
|
607
|
-
logger.warn(`
|
|
607
|
+
logger.warn(` ${target.selector}: ${capture.errors.length.toString()} errors`);
|
|
608
608
|
for (const error of capture.errors)
|
|
609
609
|
logger.warn(` - ${error}`);
|
|
610
610
|
}
|
|
@@ -639,7 +639,7 @@ async function cleanupBestEffort(logger, label, cleanup) {
|
|
|
639
639
|
await cleanup();
|
|
640
640
|
}
|
|
641
641
|
catch (error) {
|
|
642
|
-
logger.warn(`
|
|
642
|
+
logger.warn(`single-pass: ${label} failed: ${errorMessage(error)}`);
|
|
643
643
|
}
|
|
644
644
|
}
|
|
645
645
|
/**
|
|
@@ -651,7 +651,7 @@ async function convertStepInPrintPage(prepared, step, request, config) {
|
|
|
651
651
|
const containerId = printContainerId(step);
|
|
652
652
|
const scope = containerScopeSelector(containerId);
|
|
653
653
|
const stepIndex = stepIndexOf(step);
|
|
654
|
-
logger.info(`\
|
|
654
|
+
logger.info(`\nconverting slide #${stepKeyOf(step)} (single-pass, container ${containerId})...`);
|
|
655
655
|
let prerenderMs;
|
|
656
656
|
let convertMs;
|
|
657
657
|
let restoreMs;
|
|
@@ -685,8 +685,8 @@ async function convertStepInPrintPage(prepared, step, request, config) {
|
|
|
685
685
|
// 2 つの後始末は互いに独立させ、失敗しても try 内の元の例外を優先する
|
|
686
686
|
;
|
|
687
687
|
[, restoreMs] = await timed(async () => {
|
|
688
|
-
await cleanupBestEffort(logger,
|
|
689
|
-
await cleanupBestEffort(logger, `prerender
|
|
688
|
+
await cleanupBestEffort(logger, `clearing exclusion marks (container ${containerId})`, async () => setIgnoredMarks(prepared.pageA));
|
|
689
|
+
await cleanupBestEffort(logger, `restoring prerender replacements (container ${containerId})`, async () => restorePrerenderElements(prepared.pageA, logger, scope));
|
|
690
690
|
});
|
|
691
691
|
}
|
|
692
692
|
const phases = {
|
|
@@ -737,11 +737,11 @@ async function runFallbackSteps(request, failed, settled) {
|
|
|
737
737
|
try {
|
|
738
738
|
const value = await request.fallbackRunner(request.browser, step, request.workerConfig, request.slidesDir, request.logger);
|
|
739
739
|
settled.set(index, { status: 'fulfilled', value });
|
|
740
|
-
request.onProgress?.(
|
|
740
|
+
request.onProgress?.(`slide #${stepKeyOf(step)} converted`);
|
|
741
741
|
}
|
|
742
742
|
catch (error) {
|
|
743
743
|
settled.set(index, { status: 'rejected', reason: error });
|
|
744
|
-
request.onProgress?.(
|
|
744
|
+
request.onProgress?.(`slide #${stepKeyOf(step)} conversion failed`);
|
|
745
745
|
}
|
|
746
746
|
request.onStepDone?.(step);
|
|
747
747
|
}
|
|
@@ -752,7 +752,7 @@ settled を steps の順に並べる。全ステップは、1 パス変換の結
|
|
|
752
752
|
function orderedSettled(steps, settled) {
|
|
753
753
|
return steps.map((step, index) => settled.get(index)
|
|
754
754
|
/* c8 ignore next -- 全ステップは 1 パス変換か現行 worker の結果を必ず持つ。防御網 */
|
|
755
|
-
?? { status: 'rejected', reason: new Error(
|
|
755
|
+
?? { status: 'rejected', reason: new Error(`slide #${stepKeyOf(step)} was not converted`) });
|
|
756
756
|
}
|
|
757
757
|
/**
|
|
758
758
|
1 グループを 1 ペアのページで変換する。
|
|
@@ -778,7 +778,7 @@ async function convertGroup(request, steps, config, contexts) {
|
|
|
778
778
|
prepared = await preparePages(request, steps, config, contexts, opened);
|
|
779
779
|
}
|
|
780
780
|
catch (error) {
|
|
781
|
-
prepared = { kind: 'notReady', reason: `print
|
|
781
|
+
prepared = { kind: 'notReady', reason: `cannot prepare the print page: ${errorMessage(error)}` };
|
|
782
782
|
}
|
|
783
783
|
if (prepared.kind === 'printRouteMissing') {
|
|
784
784
|
printRouteMissing = prepared.reason;
|
|
@@ -796,14 +796,14 @@ async function convertGroup(request, steps, config, contexts) {
|
|
|
796
796
|
try {
|
|
797
797
|
const value = await convertStepInPrintPage(prepared, step, request, config);
|
|
798
798
|
settled.set(index, { status: 'fulfilled', value });
|
|
799
|
-
request.onProgress?.(
|
|
799
|
+
request.onProgress?.(`slide #${stepKeyOf(step)} converted`);
|
|
800
800
|
request.onStepDone?.(step);
|
|
801
801
|
}
|
|
802
802
|
catch (error) {
|
|
803
|
-
logger.warn(`
|
|
803
|
+
logger.warn(`single-pass: slide #${stepKeyOf(step)} conversion failed, so converting again with the current method: ${errorMessage(error)}`);
|
|
804
804
|
failed.push({ index, step });
|
|
805
|
-
stepFallbacks.push(
|
|
806
|
-
request.onProgress?.(
|
|
805
|
+
stepFallbacks.push(`slide #${stepKeyOf(step)}: ${errorMessage(error)}`);
|
|
806
|
+
request.onProgress?.(`slide #${stepKeyOf(step)} single-pass conversion failed`);
|
|
807
807
|
}
|
|
808
808
|
}
|
|
809
809
|
// 高解像度ページはステップ処理中に開くことがあるため、ループの後で載せる
|
|
@@ -855,7 +855,7 @@ export async function convertStepsSinglePass(request) {
|
|
|
855
855
|
const startedAt = performance.now();
|
|
856
856
|
const config = request.prerenderConfig ?? defaultPrerenderConfig;
|
|
857
857
|
const groups = partitionStepsBySlide(request.steps, request.concurrency);
|
|
858
|
-
request.logger.info(`
|
|
858
|
+
request.logger.info(`single-pass: converting ${request.steps.length.toString()} steps in ${groups.length.toString()} groups`);
|
|
859
859
|
const contexts = createRunContexts(request.browser, config);
|
|
860
860
|
let settledGroups;
|
|
861
861
|
// 全グループの settle までの経過時間。print ルートの不在で退避する run の detectMs に使う
|
|
@@ -901,12 +901,12 @@ export async function convertStepsSinglePass(request) {
|
|
|
901
901
|
for (const step of fallbackSteps)
|
|
902
902
|
fallbackStepSet.add(step);
|
|
903
903
|
if (timing.fallback !== undefined)
|
|
904
|
-
fallbacks.push(
|
|
904
|
+
fallbacks.push(`slide ${timing.slides.join(',')}: ${timing.fallback}`);
|
|
905
905
|
fallbacks.push(...stepFallbacks);
|
|
906
906
|
}
|
|
907
907
|
const results = request.steps.map((step) => resultOf.get(step)
|
|
908
908
|
/* c8 ignore next -- 各ステップはちょうど 1 つのグループに属し結果を持つ。防御網 */
|
|
909
|
-
?? { status: 'rejected', reason: new Error(
|
|
909
|
+
?? { status: 'rejected', reason: new Error(`slide #${stepKeyOf(step)} was not converted`) });
|
|
910
910
|
return {
|
|
911
911
|
kind: 'converted',
|
|
912
912
|
results,
|
|
@@ -27,7 +27,7 @@ export async function timed(fn) {
|
|
|
27
27
|
}
|
|
28
28
|
async function convertSingleSlide(browser, step, config, slidesDir, logger) {
|
|
29
29
|
const slideStart = performance.now();
|
|
30
|
-
logger.info(`\
|
|
30
|
+
logger.info(`\nconverting slide #${stepKeyOf(step)}...`);
|
|
31
31
|
// step.url は scanner と buildSlideUrl のどちらの処理でも、baseUrl 込みの絶対 URL。
|
|
32
32
|
const slideUrl = step.url;
|
|
33
33
|
const [page, newPageMs] = await timed(async () => browser.newPage());
|
|
@@ -83,8 +83,8 @@ export async function convertSingleSlideWithRetry(browser, step, config, slidesD
|
|
|
83
83
|
catch (error) {
|
|
84
84
|
lastError = error;
|
|
85
85
|
if (attempt < maxRetries) {
|
|
86
|
-
logger.warn(
|
|
87
|
-
logger.warn(` ${timeouts.slideRetryDelay.toString()}ms
|
|
86
|
+
logger.warn(`slide #${stepKeyOf(step)} conversion failed (attempt ${(attempt + 1).toString()}/${(maxRetries + 1).toString()}): ${errorMessage(error)}`);
|
|
87
|
+
logger.warn(` retrying in ${timeouts.slideRetryDelay.toString()}ms...`);
|
|
88
88
|
await new Promise(resolve => setTimeout(() => { resolve(); }, timeouts.slideRetryDelay));
|
|
89
89
|
}
|
|
90
90
|
else {
|
|
@@ -90,8 +90,8 @@ export async function waitForCssAnimations(page, timeout, logger) {
|
|
|
90
90
|
new Promise(resolve => setTimeout(() => { resolve({ waited: -1, skipped: -1, timedOut: true }); }, timeout)),
|
|
91
91
|
]);
|
|
92
92
|
logger.verbose(result.timedOut
|
|
93
|
-
? ` CSS
|
|
94
|
-
: ` CSS
|
|
93
|
+
? ` CSS animation wait: timed out (${timeout.toString()}ms)`
|
|
94
|
+
: ` CSS animation wait: ${result.waited.toString()} done, ${result.skipped.toString()} skipped (infinite)`);
|
|
95
95
|
return result;
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
@@ -159,28 +159,28 @@ export async function waitForDataWaitfor(page, scopeSelector, timeoutMs, logger)
|
|
|
159
159
|
return { count: state.count, ready: state.waiting === 0 };
|
|
160
160
|
}, { visibleFn: slideVisibleFunctionSource, scopeSel: scopeSelector, ms: timeoutMs });
|
|
161
161
|
if (result.ready) {
|
|
162
|
-
logger.verbose(` data-waitfor
|
|
162
|
+
logger.verbose(` data-waitfor wait: ${String(result.count)} done (${(Date.now() - startedAt).toString()}ms)`);
|
|
163
163
|
}
|
|
164
164
|
else {
|
|
165
|
-
logger.warn(` data-waitfor
|
|
165
|
+
logger.warn(` data-waitfor wait: timed out (${timeoutMs.toString()}ms); continuing without confirming render completion`);
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
export async function waitForIframeLoad(page, selector, timeout, logger) {
|
|
169
169
|
const count = await page.evaluate((sel) => globalThis.document.querySelectorAll(sel).length, selector);
|
|
170
170
|
if (count === 0) {
|
|
171
|
-
logger.verbose(` iframe
|
|
171
|
+
logger.verbose(` iframe wait: ${selector}: none found, skipped`);
|
|
172
172
|
return;
|
|
173
173
|
}
|
|
174
|
-
logger.verbose(` iframe
|
|
174
|
+
logger.verbose(` iframe wait: ${selector}: waiting for ${count.toString()} to finish loading`);
|
|
175
175
|
try {
|
|
176
176
|
await page.waitForFunction((sel) => {
|
|
177
177
|
const iframes = document.querySelectorAll(sel);
|
|
178
178
|
return [...iframes].every(iframe => iframe.contentDocument?.readyState === 'complete');
|
|
179
179
|
}, selector, { timeout });
|
|
180
|
-
logger.verbose(` iframe
|
|
180
|
+
logger.verbose(` iframe wait: ${selector}: loaded`);
|
|
181
181
|
}
|
|
182
182
|
catch {
|
|
183
|
-
logger.verbose(` iframe
|
|
183
|
+
logger.verbose(` iframe wait: ${selector}: timed out (${timeout.toString()}ms)`);
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
/* eslint-enable unicorn/name-replacements, no-restricted-syntax */
|
|
@@ -184,7 +184,7 @@ export function createDevServerRegistry(dependencies = devServerDefaultDependenc
|
|
|
184
184
|
failure: {
|
|
185
185
|
ok: false,
|
|
186
186
|
reason: 'dev-server-spawn-failed',
|
|
187
|
-
detail: `Slidev dev
|
|
187
|
+
detail: `could not start the Slidev dev server: ${detail}`,
|
|
188
188
|
stdout: '',
|
|
189
189
|
stderr: '',
|
|
190
190
|
},
|
|
@@ -296,10 +296,10 @@ function portInUseFailure(port, defaultPorts, raced) {
|
|
|
296
296
|
// 無断で止めたり、ホストへ転送していないポートを自分で選んで開けない URL を返したりし得る。
|
|
297
297
|
// どのポートが使用中かという事実だけ述べ、判断は利用者に確認してから動くよう案内する。
|
|
298
298
|
const detail = port === undefined
|
|
299
|
-
?
|
|
300
|
-
+ '
|
|
301
|
-
:
|
|
302
|
-
+
|
|
299
|
+
? `cannot start the Slidev dev server: ports ${defaultPorts.join(' / ')} are all in use`
|
|
300
|
+
+ '; ask the user whether any preview may be stopped, or which port to use, then call again'
|
|
301
|
+
: `cannot start the Slidev dev server: port ${String(port)} is in use`
|
|
302
|
+
+ `; tell the user that port ${String(port)} is in use, ask which port to use, then call again`;
|
|
303
303
|
return {
|
|
304
304
|
ok: false,
|
|
305
305
|
reason: 'dev-server-port-in-use',
|
|
@@ -314,7 +314,7 @@ function portInUseFailure(port, defaultPorts, raced) {
|
|
|
314
314
|
attemptStart 経由 (子を起こした後に signal を見る failureDetailOf) と、start が子を起こす前に signal を見るルートがある。
|
|
315
315
|
両方から使うため、文言をここで 1 箇所にまとめる。
|
|
316
316
|
*/
|
|
317
|
-
const CANCELLED_DETAIL = '
|
|
317
|
+
const CANCELLED_DETAIL = 'Slidev dev server start aborted because the call was cancelled';
|
|
318
318
|
/**
|
|
319
319
|
spawn する前に中断済みと分かったときの失敗。子を起こしていないので stdout / stderr は空。
|
|
320
320
|
*/
|
|
@@ -343,11 +343,11 @@ function failureReasonOf(outcome) {
|
|
|
343
343
|
function failureDetailOf(outcome, port, timeoutMs) {
|
|
344
344
|
switch (outcome) {
|
|
345
345
|
case 'exited': {
|
|
346
|
-
return `Slidev dev
|
|
346
|
+
return `Slidev dev server on port ${String(port)} exited right after starting (see stderr for the reason)`;
|
|
347
347
|
}
|
|
348
348
|
case 'timeout': {
|
|
349
|
-
return `Slidev dev
|
|
350
|
-
+ `${String(timeoutMs)}ms
|
|
349
|
+
return `Slidev dev server on port ${String(port)} did not become reachable within `
|
|
350
|
+
+ `${String(timeoutMs)}ms`;
|
|
351
351
|
}
|
|
352
352
|
case 'cancelled': {
|
|
353
353
|
return CANCELLED_DETAIL;
|
|
@@ -367,6 +367,7 @@ export function devServerDefaultDependencies() {
|
|
|
367
367
|
spawn: (options) => {
|
|
368
368
|
const spawnOptions = {
|
|
369
369
|
cwd: options.directory,
|
|
370
|
+
// interface-env: none
|
|
370
371
|
env: process.env,
|
|
371
372
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
372
373
|
shell: false,
|
package/cli/dist/mcp/queue.js
CHANGED
|
@@ -14,7 +14,7 @@ import { AsyncLocalStorage } from 'node:async_hooks';
|
|
|
14
14
|
*/
|
|
15
15
|
export class ReentrantEnqueueError extends Error {
|
|
16
16
|
constructor() {
|
|
17
|
-
super('
|
|
17
|
+
super('enqueue cannot be called from a running task (the queue would deadlock waiting for itself)');
|
|
18
18
|
this.name = 'ReentrantEnqueueError';
|
|
19
19
|
}
|
|
20
20
|
}
|
package/cli/dist/mcp/result.js
CHANGED
|
@@ -21,7 +21,7 @@ const OUTPUT_CAPTURE_LIMIT_BYTES = 64 * 1024;
|
|
|
21
21
|
/**
|
|
22
22
|
切り詰めが起きたことを text() の先頭に 1 行で明示するマーカー。
|
|
23
23
|
*/
|
|
24
|
-
const TRUNCATION_MARKER = `[pecotv]
|
|
24
|
+
const TRUNCATION_MARKER = `[pecotv] output exceeded the ${String(OUTPUT_CAPTURE_LIMIT_BYTES)}-byte limit; the beginning was truncated\n`;
|
|
25
25
|
/**
|
|
26
26
|
ToolResult を MCP の CallToolResult へ変換する。
|
|
27
27
|
|
|
@@ -110,8 +110,8 @@ schema, arguments_, keys) {
|
|
|
110
110
|
const invalidPaths = [...unsupportedPaths, ...relativePaths];
|
|
111
111
|
if (invalidPaths.length > 0) {
|
|
112
112
|
const messages = [
|
|
113
|
-
...(unsupportedDetails.length > 0 ? [`Windows
|
|
114
|
-
...(relativePaths.length > 0 ? [
|
|
113
|
+
...(unsupportedDetails.length > 0 ? [`cannot resolve Windows-style path: ${unsupportedDetails.join(' / ')}`] : []),
|
|
114
|
+
...(relativePaths.length > 0 ? [`must be an absolute path: ${relativePaths.join(', ')}`] : []),
|
|
115
115
|
];
|
|
116
116
|
return {
|
|
117
117
|
rejected: {
|
|
@@ -119,7 +119,7 @@ schema, arguments_, keys) {
|
|
|
119
119
|
exitCode: USAGE_ERROR_EXIT_CODE,
|
|
120
120
|
artifacts: [],
|
|
121
121
|
data: { invalidPaths, ...convertedPart },
|
|
122
|
-
message: messages.join('
|
|
122
|
+
message: messages.join('; '),
|
|
123
123
|
},
|
|
124
124
|
};
|
|
125
125
|
}
|
package/cli/dist/mcp/serve.js
CHANGED
|
@@ -13,6 +13,7 @@ import { serveStdio, StdioServerTransport } from '@modelcontextprotocol/server/s
|
|
|
13
13
|
import { devServerRegistry } from './dev-server-registry.js';
|
|
14
14
|
import { createMcpServer } from './server.js';
|
|
15
15
|
import { allTools } from './tools/index.js';
|
|
16
|
+
import { createDiagnostics } from '../diagnostics.js';
|
|
16
17
|
import { ignoreRejection } from '../domain/_shared/ignore-rejection.js';
|
|
17
18
|
/**
|
|
18
19
|
SIGTERM / SIGINT を受けたときの終了コード (シェルの慣習どおり 128 + シグナル番号)。
|
|
@@ -46,6 +47,7 @@ export function installStdoutGuard(stdout, stderr) {
|
|
|
46
47
|
// ここで扱うのは console 系が書く utf8 文字列か Buffer に限られる。encoding を
|
|
47
48
|
// 引き回すと BufferEncoding への narrowing のために型アサーションが必要になる。
|
|
48
49
|
const done = typeof encodingOrCallback === 'function' ? encodingOrCallback : callback;
|
|
50
|
+
// eslint-disable-next-line no-restricted-syntax -- console 系が stdout へ書いた生のチャンクを、そのまま stderr へ逃がす
|
|
49
51
|
const isWritten = stderr.write(chunk);
|
|
50
52
|
done?.();
|
|
51
53
|
return isWritten;
|
|
@@ -65,7 +67,7 @@ export function installStdoutGuard(stdout, stderr) {
|
|
|
65
67
|
// stdout の相手が消えた後の書き込み (EPIPE) は Writable の 'error' として上がる。
|
|
66
68
|
// 拾わないと uncaught 例外でスタックトレースごと落ちるため、1 行報告して終了コードを立てる。
|
|
67
69
|
protocolStdout.on('error', (error) => {
|
|
68
|
-
stderr.
|
|
70
|
+
createDiagnostics(stderr).error(`stdout write failed: ${error.message}`);
|
|
69
71
|
process.exitCode = 1;
|
|
70
72
|
});
|
|
71
73
|
installedGuards.set(stdout, protocolStdout);
|
|
@@ -122,7 +124,7 @@ export function runMcpServe(dependencies) {
|
|
|
122
124
|
if (reported.has(error))
|
|
123
125
|
return;
|
|
124
126
|
reported.add(error);
|
|
125
|
-
dependencies.stderr.
|
|
127
|
+
createDiagnostics(dependencies.stderr).error(error.message);
|
|
126
128
|
};
|
|
127
129
|
const handle = serveStdio(() => {
|
|
128
130
|
// factory に持たせる副作用は、インスタンスの生成と onerror の設定だけにする。
|
|
@@ -163,7 +165,7 @@ export function executeMcpServe(buildDependencies) {
|
|
|
163
165
|
runMcpServe(dependencies);
|
|
164
166
|
}
|
|
165
167
|
catch (error) {
|
|
166
|
-
dependencies.stderr.
|
|
168
|
+
createDiagnostics(dependencies.stderr).error(formatError(error));
|
|
167
169
|
process.exitCode = 1;
|
|
168
170
|
}
|
|
169
171
|
}
|
package/cli/dist/mcp/server.js
CHANGED
|
@@ -44,7 +44,7 @@ function startProgressHeartbeat(toolName, context, intervalMs) {
|
|
|
44
44
|
return undefined;
|
|
45
45
|
const { signal } = context.mcpReq;
|
|
46
46
|
let progress = 0;
|
|
47
|
-
let phase = '
|
|
47
|
+
let phase = 'waiting in queue';
|
|
48
48
|
let isStopped = false;
|
|
49
49
|
// 周期送出と reportProgress のどちらも通る関門。停止後・キャンセル後は何も送らない。
|
|
50
50
|
const send = () => {
|
|
@@ -72,7 +72,7 @@ function startProgressHeartbeat(toolName, context, intervalMs) {
|
|
|
72
72
|
signal.addEventListener('abort', stop, { once: true });
|
|
73
73
|
}
|
|
74
74
|
return {
|
|
75
|
-
markRunning: () => { phase = '
|
|
75
|
+
markRunning: () => { phase = 'running'; },
|
|
76
76
|
report: (message) => {
|
|
77
77
|
phase = message;
|
|
78
78
|
send();
|
|
@@ -75,7 +75,7 @@ export declare const RUNTIME_UNAVAILABLE_EXIT_CODE = 1;
|
|
|
75
75
|
/**
|
|
76
76
|
永続層の場所を特定できないときに利用者向けの応答へ載せる既定の表記。
|
|
77
77
|
*/
|
|
78
|
-
export declare const RUNTIME_ROOT_PLACEHOLDER = "
|
|
78
|
+
export declare const RUNTIME_ROOT_PLACEHOLDER = "<data-dir>/mcp-dist";
|
|
79
79
|
/**
|
|
80
80
|
chromium の取得状態を扱う依存。既定は infra/playwright/chromium.ts の実装。
|
|
81
81
|
|