@pascal-app/mcp 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server.d.ts +2 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +1 -0
- package/dist/tools/author-scene.d.ts +3 -2
- package/dist/tools/author-scene.d.ts.map +1 -1
- package/dist/tools/author-scene.js +8 -6
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +3 -2
- package/dist/tools/shared-tools.d.ts +11 -1
- package/dist/tools/shared-tools.d.ts.map +1 -1
- package/dist/tools/shared-tools.js +22 -5
- package/package.json +4 -4
package/dist/server.d.ts
CHANGED
|
@@ -46,6 +46,8 @@ export type CreatePascalMcpServerOptions = {
|
|
|
46
46
|
sceneViews?: SceneViewHost;
|
|
47
47
|
/** Reads catalog items' pictures and surfaces before view_assets and paint. */
|
|
48
48
|
assetViews?: PlanReadingHosts['assetViews'];
|
|
49
|
+
/** A pause between the steps of a long call, for a host with a scene of its own per request. */
|
|
50
|
+
betweenSteps?: PlanReadingHosts['betweenSteps'];
|
|
49
51
|
/** Lines the host adds to what a client reads at connect (the person's own settings). */
|
|
50
52
|
instructions?: string;
|
|
51
53
|
};
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAKV,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAG7B,MAAM,mCAAmC,CAAA;AAE1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,cAAc,CAAA;AAG1E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB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,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,WAAW,CAAC,EAAE,qBAAqB,CAAA;IACnC;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,CAAA;IACtB,+FAA+F;IAC/F,eAAe,CAAC,EAAE,kBAAkB,CAAA;IACpC,kGAAkG;IAClG,YAAY,CAAC,EAAE,eAAe,CAAA;IAC9B,4FAA4F;IAC5F,QAAQ,CAAC,EAAE,qBAAqB,CAAA;IAChC,yFAAyF;IACzF,KAAK,CAAC,EAAE,uBAAuB,CAAA;IAC/B,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,iBAAiB,CAAA;IAC5B,4FAA4F;IAC5F,UAAU,CAAC,EAAE,aAAa,CAAA;IAC1B,+EAA+E;IAC/E,UAAU,CAAC,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAA;IAC3C,gGAAgG;IAChG,YAAY,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAA;IAC/C,yFAAyF;IACzF,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,4BAA4B,GAAG,SAAS,CA+BnF"}
|
package/dist/server.js
CHANGED
|
@@ -7,7 +7,8 @@ import { type GeometryScriptHost, type ObjectMakerHost } from './add-object.js';
|
|
|
7
7
|
* stored module and adapter, changed by edits, when left out), or the stored conversion again;
|
|
8
8
|
* items naming a piece written with its module, those still being made left for the host to write
|
|
9
9
|
* when they land; every module compiled and stored through the host, the operation applied,
|
|
10
|
-
* Pascal's checks run, and the gate report answered.
|
|
10
|
+
* Pascal's checks run, and the gate report answered. The checks take seconds on a large building:
|
|
11
|
+
* a host that gives `betweenSteps` is awaited between them, as in verify_scene.
|
|
11
12
|
*/
|
|
12
|
-
export declare function registerAuthorScene(server: McpServer, bridge: SceneOperations, host: GeometryScriptHost | undefined, makers?: ObjectMakerHost, readFile?: ProjectFileReader): void;
|
|
13
|
+
export declare function registerAuthorScene(server: McpServer, bridge: SceneOperations, host: GeometryScriptHost | undefined, makers?: ObjectMakerHost, readFile?: ProjectFileReader, betweenSteps?: () => Promise<void>): void;
|
|
13
14
|
//# sourceMappingURL=author-scene.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"author-scene.d.ts","sourceRoot":"","sources":["../../src/tools/author-scene.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAE7D,OAAO,
|
|
1
|
+
{"version":3,"file":"author-scene.d.ts","sourceRoot":"","sources":["../../src/tools/author-scene.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAE7D,OAAO,EAOL,KAAK,iBAAiB,EAGvB,MAAM,mCAAmC,CAAA;AAY1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,EAAmB,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAA;AAoC7F;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,kBAAkB,GAAG,SAAS,EACpC,MAAM,CAAC,EAAE,eAAe,EACxB,QAAQ,CAAC,EAAE,iBAAiB,EAC5B,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GACjC,IAAI,CAqMN"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { filterDerivedNodeWrites } from '@pascal-app/core';
|
|
2
|
-
import { achievedChanges, authorSceneChecks,
|
|
2
|
+
import { achievedChanges, authorSceneChecks, inOneGo, verifySceneSteps, } from '@pascal-app/core/agent-operations';
|
|
3
3
|
import { authorScenePayload, authorSceneTool, isAgentRefusal, refuse, surfaceDescription, } from '@pascal-app/core/agent-tools';
|
|
4
4
|
import { GEOMETRY_SCRIPT_MIME_TYPES } from '@pascal-app/core/schema';
|
|
5
5
|
import { compileAuthorScene } from '@pascal-app/geometry-script/author-scene';
|
|
@@ -8,7 +8,7 @@ import { compileAndStore } from './add-object.js';
|
|
|
8
8
|
import { DESTRUCTIVE_TOOL_ANNOTATIONS } from './annotations.js';
|
|
9
9
|
import { refusalResult, toolError } from './errors.js';
|
|
10
10
|
import { persistencePayload, publishLiveSceneSnapshot } from './live-sync.js';
|
|
11
|
-
import { toPatches } from './shared-tools.js';
|
|
11
|
+
import { pausedBetweenSteps, toPatches } from './shared-tools.js';
|
|
12
12
|
/** The largest payload file read: a house with its modules inline runs to a few MiB. */
|
|
13
13
|
const PAYLOAD_FILE_MAX_BYTES = 32 * 1024 * 1024;
|
|
14
14
|
/** Payload keys holding a module's text; stored as `<key>Script`, the script's hash. */
|
|
@@ -18,9 +18,10 @@ const CODE_KEYS = new Set(['code', 'floorCode', 'wallCode']);
|
|
|
18
18
|
* stored module and adapter, changed by edits, when left out), or the stored conversion again;
|
|
19
19
|
* items naming a piece written with its module, those still being made left for the host to write
|
|
20
20
|
* when they land; every module compiled and stored through the host, the operation applied,
|
|
21
|
-
* Pascal's checks run, and the gate report answered.
|
|
21
|
+
* Pascal's checks run, and the gate report answered. The checks take seconds on a large building:
|
|
22
|
+
* a host that gives `betweenSteps` is awaited between them, as in verify_scene.
|
|
22
23
|
*/
|
|
23
|
-
export function registerAuthorScene(server, bridge, host, makers, readFile) {
|
|
24
|
+
export function registerAuthorScene(server, bridge, host, makers, readFile, betweenSteps) {
|
|
24
25
|
server.registerTool(authorSceneTool.name, {
|
|
25
26
|
title: authorSceneTool.title,
|
|
26
27
|
description: surfaceDescription(authorSceneTool, 'mcp'),
|
|
@@ -141,9 +142,10 @@ export function registerAuthorScene(server, bridge, host, makers, readFile) {
|
|
|
141
142
|
const patches = toPatches(filterDerivedNodeWrites(bridge.getNodes(), outcome.changes));
|
|
142
143
|
if (patches.length)
|
|
143
144
|
bridge.applyPatch(patches);
|
|
144
|
-
const
|
|
145
|
+
const checking = verifySceneSteps(bridge.getNodes(), undefined, {
|
|
145
146
|
activeLevelId: null,
|
|
146
|
-
})
|
|
147
|
+
});
|
|
148
|
+
const verified = (betweenSteps ? await pausedBetweenSteps(checking, betweenSteps) : inOneGo(checking)).result;
|
|
147
149
|
const byType = new Map();
|
|
148
150
|
for (const issue of verified.issues)
|
|
149
151
|
byType.set(issue.type ?? 'unknown', (byType.get(issue.type ?? 'unknown') ?? 0) + 1);
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -23,5 +23,5 @@ export type ToolHosts = PlanReadingHosts & {
|
|
|
23
23
|
readFile?: ProjectFileReader;
|
|
24
24
|
sceneViews?: SceneViewHost;
|
|
25
25
|
};
|
|
26
|
-
export declare function registerTools(server: McpServer, operations: SceneOperations, { catalog, geometryScripts, objectMakers, readFile, sceneViews, assetViews }?: ToolHosts): void;
|
|
26
|
+
export declare function registerTools(server: McpServer, operations: SceneOperations, { catalog, geometryScripts, objectMakers, readFile, sceneViews, assetViews, betweenSteps, }?: ToolHosts): void;
|
|
27
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAA;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAEpD,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,eAAe,EAGrB,MAAM,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAcnD,OAAO,EAAE,KAAK,gBAAgB,EAAuB,MAAM,gBAAgB,CAAA;AAI3E,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,cAAc,CAAA;AAEpE;;;;;;;GAOG;AACH,gFAAgF;AACh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C3B,EACE,OAAO,EACP,eAAe,EACf,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,UAAU,EACV,YAAY,GACb,GAAE,SAAc,GAChB,IAAI,CA6BN"}
|
package/dist/tools/index.js
CHANGED
|
@@ -19,15 +19,16 @@ import { registerTemplateTools } from './templates/index.js';
|
|
|
19
19
|
import { registerUndo } from './undo.js';
|
|
20
20
|
import { registerVariantTools } from './variants/index.js';
|
|
21
21
|
import { registerViewScene } from './view-scene.js';
|
|
22
|
-
export function registerTools(server, operations, { catalog, geometryScripts, objectMakers, readFile, sceneViews, assetViews } = {}) {
|
|
22
|
+
export function registerTools(server, operations, { catalog, geometryScripts, objectMakers, readFile, sceneViews, assetViews, betweenSteps, } = {}) {
|
|
23
23
|
registerGetScene(server, operations);
|
|
24
24
|
registerSharedTools(server, operations, catalog, {
|
|
25
25
|
assetViews,
|
|
26
|
+
betweenSteps,
|
|
26
27
|
buildObject: (input) => compileObjectOnHost(geometryScripts, operations, input),
|
|
27
28
|
});
|
|
28
29
|
registerAddColumn(server, operations, geometryScripts);
|
|
29
30
|
registerAddObject(server, operations, geometryScripts, objectMakers);
|
|
30
|
-
registerAuthorScene(server, operations, geometryScripts, objectMakers, readFile);
|
|
31
|
+
registerAuthorScene(server, operations, geometryScripts, objectMakers, readFile, betweenSteps);
|
|
31
32
|
registerGetSource(server, operations, geometryScripts);
|
|
32
33
|
registerMeasure(server, operations);
|
|
33
34
|
registerViewScene(server, operations, sceneViews);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { McpServer } from '@modelcontextprotocol/server';
|
|
2
|
-
import { type AddObjectInput, type AgentHostRuntime, type AgentOperation, type AssetViewLoader, type SceneChanges } from '@pascal-app/core/agent-operations';
|
|
2
|
+
import { type AddObjectInput, type AgentHostRuntime, type AgentOperation, type AssetViewLoader, type SceneChanges, type Steps } from '@pascal-app/core/agent-operations';
|
|
3
3
|
import { type AgentToolAnnotations, type AgentToolContract, type DesignBrief } from '@pascal-app/core/agent-tools';
|
|
4
4
|
import { type CompiledGeometryScript } from '@pascal-app/core/schema';
|
|
5
5
|
import { z } from 'zod';
|
|
@@ -24,11 +24,21 @@ export type PlanReadingHosts = {
|
|
|
24
24
|
assetViews?: AssetViewLoader;
|
|
25
25
|
/** Compiles one add_object module for a batch before the synchronous operations run. */
|
|
26
26
|
buildObject?: (input: Omit<AddObjectInput, 'compiled'>) => Promise<CompiledGeometryScript>;
|
|
27
|
+
/**
|
|
28
|
+
* Awaited between the steps of a call that takes seconds on a large building (after each call of
|
|
29
|
+
* a run_batch, after each check of a verify_scene, author_scene's closing one included), so the
|
|
30
|
+
* host's timers and I/O run meanwhile. Only for a host whose scene no other call can reach then
|
|
31
|
+
* (a bridge of its own for each request): a batch is planned on the scene as its first call
|
|
32
|
+
* found it and applied after its last. Without it these calls run uninterrupted.
|
|
33
|
+
*/
|
|
34
|
+
betweenSteps?: () => Promise<void>;
|
|
27
35
|
};
|
|
28
36
|
export declare function toPatches(changes: SceneChanges): Patch[];
|
|
29
37
|
/** How an outcome reaches this bridge: its patches, its derived construction, its session record. */
|
|
30
38
|
export declare function agentRuntime(bridge: SceneOperations): AgentHostRuntime;
|
|
31
39
|
export declare function briefInForce(bridge: SceneOperations): DesignBrief | null | undefined;
|
|
40
|
+
/** Work one step at a time, the host's pause after each; `scope` is where each step runs. */
|
|
41
|
+
export declare function pausedBetweenSteps<Result>(steps: Steps<Result>, pause: () => Promise<void>, scope?: (step: () => IteratorResult<void, Result>) => IteratorResult<void, Result>): Promise<Result>;
|
|
32
42
|
export declare function registerSharedTools(server: McpServer, bridge: SceneOperations, catalog?: AssetCatalog, hosts?: PlanReadingHosts): void;
|
|
33
43
|
/**
|
|
34
44
|
* Registers one operation tool, as the shared tools are: a host adds a plugin's `'operation'`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-tools.d.ts","sourceRoot":"","sources":["../../src/tools/shared-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SA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UAAU,CAAC,KAAK,OAAO,CAAC,sBAAsB,CAAC,CAAA;IAC1F;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CACnC,CAAA;AAoeD,wBAAgB,SAAS,CAAC,OAAO,EAAE,YAAY,GAAG,KAAK,EAAE,CAmBxD;AAED,qGAAqG;AACrG,wBAAgB,YAAY,CAAC,MAAM,EAAE,eAAe,GAAG,gBAAgB,CAyBtE;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,eAAe,GAAG,WAAW,GAAG,IAAI,GAAG,SAAS,CAIpF;AAuDD,6FAA6F;AAC7F,wBAAsB,kBAAkB,CAAC,MAAM,EAC7C,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,EACpB,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,EAC1B,KAAK,GAAE,CAAC,IAAI,EAAE,MAAM,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,cAAc,CAAC,IAAI,EAAE,MAAM,CACxE,GACP,OAAO,CAAC,MAAM,CAAC,CAMjB;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,eAAe,EACvB,OAAO,GAAE,YAA6B,EACtC,KAAK,GAAE,gBAAqB,GAC3B,IAAI,CAGN;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,aAAa,EACnB,OAAO,GAAE,YAA6B,EACtC,KAAK,GAAE,gBAAqB,GAC3B,IAAI,CAmJN"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AGENT_OPERATIONS, achievedChanges, applyAgentOutcome, assetViewNeeds, buildBatchObjects, createAssetViewLoader, createFetchAssetViewIO, furnishingRefusal, readCatalog, startOfSession, writeCollections, } from '@pascal-app/core/agent-operations';
|
|
1
|
+
import { AGENT_OPERATION_STEPS, AGENT_OPERATIONS, achievedChanges, applyAgentOutcome, assetViewNeeds, buildBatchObjects, createAssetViewLoader, createFetchAssetViewIO, furnishingRefusal, readCatalog, startOfSession, writeCollections, } from '@pascal-app/core/agent-operations';
|
|
2
2
|
import { addCornerWindowTool, addFenceTool, addLevelTool, addObjectTool, addWallTool, createRoofTool, createRoomTool, createStairTool, createUnitTool, deleteNodeTool, designBriefTool, duplicateLevelTool, duplicateNodeOutput, duplicateNodeTool, findByTypeTool, fitStairTool, furnishRoomTool, getLevelSummaryTool, getNodeTool, getSiteTool, getWallsTool, getZonesTool, isAgentRefusal, listLevelsTool, listUnitsTool, measureStairTool, mergeWindowsTool, moveNodeOutput, moveNodeTool, moveRoofsToRoofLevelTool, paintTool, placeBuildingTool, placeDesignTool, placeInRoomTool, placeItemsTool, ROOM_TOOL_CONTRACTS, refuse, runBatchTool, searchAssetsTool, searchMaterialsTool, setCheckpointTool, setGroundLevelTool, setUnitMembersTool, setWallTypeTool, surfaceDescription, validateDesignTool, verifySceneModelResult, verifySceneTool, viewAssetsTool, } from '@pascal-app/core/agent-tools';
|
|
3
3
|
import { DesignValidationSchema } from '@pascal-app/core/procedural-items';
|
|
4
4
|
import { untracked } from '@pascal-app/core/runtime';
|
|
@@ -523,8 +523,9 @@ function writesScene(changes) {
|
|
|
523
523
|
(changes.collections && Object.keys(changes.collections).length)));
|
|
524
524
|
}
|
|
525
525
|
/**
|
|
526
|
-
* search_assets as the model reads it: each item's id, name and placement facts
|
|
527
|
-
*
|
|
526
|
+
* search_assets as the model reads it: each item's id, name and placement facts, and the params
|
|
527
|
+
* of one built from a script (add_object changes them once placed); the category and the floor's
|
|
528
|
+
* null attachTo stay in the structured result.
|
|
528
529
|
*/
|
|
529
530
|
function searchAssetsModelResult(output) {
|
|
530
531
|
const groups = output.groups;
|
|
@@ -532,11 +533,12 @@ function searchAssetsModelResult(output) {
|
|
|
532
533
|
...output,
|
|
533
534
|
groups: groups.map((group) => ({
|
|
534
535
|
...group,
|
|
535
|
-
results: group.results.map(({ id, name, dimensions, attachTo }) => ({
|
|
536
|
+
results: group.results.map(({ id, name, dimensions, attachTo, params }) => ({
|
|
536
537
|
id,
|
|
537
538
|
name,
|
|
538
539
|
dimensions,
|
|
539
540
|
...(attachTo && { attachTo }),
|
|
541
|
+
...(params && { params }),
|
|
540
542
|
})),
|
|
541
543
|
})),
|
|
542
544
|
};
|
|
@@ -553,6 +555,15 @@ function modelResult(name, output, input) {
|
|
|
553
555
|
return searchAssetsModelResult(output);
|
|
554
556
|
return output;
|
|
555
557
|
}
|
|
558
|
+
/** Work one step at a time, the host's pause after each; `scope` is where each step runs. */
|
|
559
|
+
export async function pausedBetweenSteps(steps, pause, scope = (step) => step()) {
|
|
560
|
+
for (;;) {
|
|
561
|
+
const step = scope(() => steps.next());
|
|
562
|
+
if (step.done)
|
|
563
|
+
return step.value;
|
|
564
|
+
await pause();
|
|
565
|
+
}
|
|
566
|
+
}
|
|
556
567
|
export function registerSharedTools(server, bridge, catalog = builtInCatalog, hosts = {}) {
|
|
557
568
|
for (const tool of SHARED_TOOLS)
|
|
558
569
|
registerOperationTool(server, bridge, tool, catalog, hosts);
|
|
@@ -627,7 +638,13 @@ export function registerOperationTool(server, bridge, tool, catalog = builtInCat
|
|
|
627
638
|
pictures: needs.pictures,
|
|
628
639
|
});
|
|
629
640
|
try {
|
|
630
|
-
|
|
641
|
+
const steps = hosts.betweenSteps && Object.hasOwn(AGENT_OPERATION_STEPS, tool.contract.name)
|
|
642
|
+
? AGENT_OPERATION_STEPS[tool.contract.name]
|
|
643
|
+
: undefined;
|
|
644
|
+
outcome =
|
|
645
|
+
steps && hosts.betweenSteps
|
|
646
|
+
? await pausedBetweenSteps(steps(nodes, input, context), hosts.betweenSteps, (step) => inScene(bridge, step))
|
|
647
|
+
: inScene(bridge, () => tool.operation(nodes, input, context));
|
|
631
648
|
}
|
|
632
649
|
catch (error) {
|
|
633
650
|
// A refusal can ask the session to remember what it refused (a catalog piece under an open source).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pascal-app/mcp",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Model Context Protocol server for Pascal 3D editor",
|
|
5
5
|
"mcpName": "app.pascal/editor",
|
|
6
6
|
"type": "module",
|
|
@@ -62,19 +62,19 @@
|
|
|
62
62
|
"prepublishOnly": "bun run build && bun test && bun run smoke:node"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@pascal-app/core": "^1.1.
|
|
65
|
+
"@pascal-app/core": "^1.1.2"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@hono/node-server": "^2.1.6",
|
|
69
69
|
"@modelcontextprotocol/node": "^2.1.2",
|
|
70
70
|
"@modelcontextprotocol/server": "^2.4.0",
|
|
71
|
-
"@pascal-app/geometry-script": "^1.1.
|
|
71
|
+
"@pascal-app/geometry-script": "^1.1.2",
|
|
72
72
|
"@pascal-app/lingo": "^0.5.0",
|
|
73
73
|
"zod": ">=4.6.7 <4.7"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@modelcontextprotocol/client": "^2.4.0",
|
|
77
|
-
"@pascal-app/core": "^1.1.
|
|
77
|
+
"@pascal-app/core": "^1.1.2",
|
|
78
78
|
"@pascal/typescript-config": "*",
|
|
79
79
|
"@types/node": "^26.6.6",
|
|
80
80
|
"typescript": "7.0.2"
|