@cplace/mcp-server 1.11.5 → 1.11.6
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.
|
@@ -3,7 +3,7 @@ import { z } from 'zod';
|
|
|
3
3
|
import { CplaceApiClient } from '../api.js';
|
|
4
4
|
export declare const PAGE_ACTION_SIMULATION_TOOL_DEFINITIONS: {
|
|
5
5
|
readonly cplace_simulate_page_action: {
|
|
6
|
-
readonly description: "Execute a page-action script under the production page-action engine context for pre-embed verification.\n\nThis tool
|
|
6
|
+
readonly description: "Execute a page-action script under the production page-action engine context for pre-embed verification.\n\nThis tool runs the real two-phase page-action lifecycle from the cplace platform\n(`ExecutePageActionHandler`). The bindings, allowed type classes, and posture come\nfrom the platform source row — see `script-context-cards/page-action.md` and\n`best-practices/low-code/script-contexts.md`.\n\n**Script shape**: `script` must evaluate to an action object that exposes at least a\n`call` method (optionally a `checkAccess` method), exactly like a saved page action:\n```js\nreturn {\n checkAccess: function() { return true; }, // optional; false denies and skips call()\n call: function() {\n // write-enabled — persisting actions commit here\n cplace.actions('<plugin>').createPage({ name: '...', space: '...', customType: '...' });\n return 'ok';\n }\n};\n```\n\n**Two-phase lifecycle**:\n1. **Load (module level)** runs under `ServerMode.prohibitWriteAccess`. The object is\n evaluated here. A write or persisting action at module level **fails** — move it into\n `call()`. A missing `call` member is rejected.\n2. **checkAccess + call**. `checkAccess()` is honored: returning `false` reports access\n denial and `call()` is **not** run. `call()` then runs **write-enabled** — persisting\n actions (`createPage`, `deletePage`, …) **commit**. This requires low-code edit\n permission (`mayEditLowCode`); without it the call is denied.\n\nThe tool returns `call()`'s **raw value**. It does **not** reproduce the framework's\nreturn-object interpretation (`success` / `message` / `target` → URL / `job` → modal).\n**Timeout**: 30 seconds maximum execution time.\n\n**Injected bindings** (in addition to the baseline cplace API):\n- `page` — WrappedPage the action was invoked on\n- `embeddingPage` — WrappedPage hosting the action (aliased to `page` at this row in production)\n- `messages` — CplaceJSTypeMessageProvider for the page's type (when one exists)\n\n**Allowed type classes**: `Search`, `Filters` (lowcode wrapper classes).\n**`cplace.actions(...)`**: enabled. Use it for any state-changing side effect (inside `call()`).\n\n**Writes are real**: a `call()` that persists commits to the dev instance. There is no\ndry-run/rollback mode.\n\n**Return Value Restrictions**: Same as cplace_execute_script (primitives, flat arrays/objects only).\n\n**When to use**: Before saving a page-action script, to verify the action object's\n`checkAccess`/`call` control flow against `page`, `embeddingPage`, and any\n`cplace.actions()` call. For other contexts (widget, change listener, validator, job,\nwizard, button widget) use the matching `cplace_simulate_*` tool — never\n`cplace_execute_script_write` for context-specific scripts.";
|
|
7
7
|
readonly inputSchema: {
|
|
8
8
|
readonly script: z.ZodString;
|
|
9
9
|
readonly pageUID: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-action-simulation.d.ts","sourceRoot":"","sources":["../../src/tools/page-action-simulation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAO5C,eAAO,MAAM,uCAAuC;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"page-action-simulation.d.ts","sourceRoot":"","sources":["../../src/tools/page-action-simulation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAO5C,eAAO,MAAM,uCAAuC;;;;;;;;;;;;CAyE1C,CAAC;AAEX,wBAAgB,iCAAiC,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,QAkE3F"}
|
|
@@ -7,14 +7,36 @@ export const PAGE_ACTION_SIMULATION_TOOL_DEFINITIONS = {
|
|
|
7
7
|
[TOOL_SIMULATE_PAGE_ACTION]: {
|
|
8
8
|
description: `Execute a page-action script under the production page-action engine context for pre-embed verification.
|
|
9
9
|
|
|
10
|
-
This tool
|
|
11
|
-
(\`ExecutePageActionHandler
|
|
12
|
-
|
|
13
|
-
\`
|
|
10
|
+
This tool runs the real two-phase page-action lifecycle from the cplace platform
|
|
11
|
+
(\`ExecutePageActionHandler\`). The bindings, allowed type classes, and posture come
|
|
12
|
+
from the platform source row — see \`script-context-cards/page-action.md\` and
|
|
13
|
+
\`best-practices/low-code/script-contexts.md\`.
|
|
14
14
|
|
|
15
|
-
**
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
**Script shape**: \`script\` must evaluate to an action object that exposes at least a
|
|
16
|
+
\`call\` method (optionally a \`checkAccess\` method), exactly like a saved page action:
|
|
17
|
+
\`\`\`js
|
|
18
|
+
return {
|
|
19
|
+
checkAccess: function() { return true; }, // optional; false denies and skips call()
|
|
20
|
+
call: function() {
|
|
21
|
+
// write-enabled — persisting actions commit here
|
|
22
|
+
cplace.actions('<plugin>').createPage({ name: '...', space: '...', customType: '...' });
|
|
23
|
+
return 'ok';
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
\`\`\`
|
|
27
|
+
|
|
28
|
+
**Two-phase lifecycle**:
|
|
29
|
+
1. **Load (module level)** runs under \`ServerMode.prohibitWriteAccess\`. The object is
|
|
30
|
+
evaluated here. A write or persisting action at module level **fails** — move it into
|
|
31
|
+
\`call()\`. A missing \`call\` member is rejected.
|
|
32
|
+
2. **checkAccess + call**. \`checkAccess()\` is honored: returning \`false\` reports access
|
|
33
|
+
denial and \`call()\` is **not** run. \`call()\` then runs **write-enabled** — persisting
|
|
34
|
+
actions (\`createPage\`, \`deletePage\`, …) **commit**. This requires low-code edit
|
|
35
|
+
permission (\`mayEditLowCode\`); without it the call is denied.
|
|
36
|
+
|
|
37
|
+
The tool returns \`call()\`'s **raw value**. It does **not** reproduce the framework's
|
|
38
|
+
return-object interpretation (\`success\` / \`message\` / \`target\` → URL / \`job\` → modal).
|
|
39
|
+
**Timeout**: 30 seconds maximum execution time.
|
|
18
40
|
|
|
19
41
|
**Injected bindings** (in addition to the baseline cplace API):
|
|
20
42
|
- \`page\` — WrappedPage the action was invoked on
|
|
@@ -22,19 +44,24 @@ fails. Side effects must go through \`cplace.actions(...)\`, which **is** enable
|
|
|
22
44
|
- \`messages\` — CplaceJSTypeMessageProvider for the page's type (when one exists)
|
|
23
45
|
|
|
24
46
|
**Allowed type classes**: \`Search\`, \`Filters\` (lowcode wrapper classes).
|
|
25
|
-
**\`cplace.actions(...)\`**: enabled. Use it for any state-changing side effect.
|
|
47
|
+
**\`cplace.actions(...)\`**: enabled. Use it for any state-changing side effect (inside \`call()\`).
|
|
48
|
+
|
|
49
|
+
**Writes are real**: a \`call()\` that persists commits to the dev instance. There is no
|
|
50
|
+
dry-run/rollback mode.
|
|
26
51
|
|
|
27
52
|
**Return Value Restrictions**: Same as cplace_execute_script (primitives, flat arrays/objects only).
|
|
28
53
|
|
|
29
|
-
**When to use**: Before saving a page-action script, to verify the action
|
|
30
|
-
control flow against \`page\`, \`embeddingPage\`, and any
|
|
31
|
-
For other contexts (widget, change listener, validator, job,
|
|
32
|
-
use the matching \`cplace_simulate_*\` tool — never
|
|
33
|
-
for context-specific scripts.`,
|
|
54
|
+
**When to use**: Before saving a page-action script, to verify the action object's
|
|
55
|
+
\`checkAccess\`/\`call\` control flow against \`page\`, \`embeddingPage\`, and any
|
|
56
|
+
\`cplace.actions()\` call. For other contexts (widget, change listener, validator, job,
|
|
57
|
+
wizard, button widget) use the matching \`cplace_simulate_*\` tool — never
|
|
58
|
+
\`cplace_execute_script_write\` for context-specific scripts.`,
|
|
34
59
|
inputSchema: {
|
|
35
|
-
script: z.string().describe(`JavaScript
|
|
36
|
-
\`
|
|
37
|
-
|
|
60
|
+
script: z.string().describe(`JavaScript that evaluates to a page-action object with at least a \`call\` method (optionally \`checkAccess\`), e.g. \`return { call: function() { ... } };\`.
|
|
61
|
+
Bindings: \`page\`, \`embeddingPage\` (both WrappedPage), \`messages\` (CplaceJSTypeMessageProvider).
|
|
62
|
+
Load (module level) runs under \`prohibitWriteAccess\` — a write/persisting action there fails; put persistence inside \`call()\`, which runs write-enabled and commits (requires low-code edit permission).
|
|
63
|
+
\`checkAccess()\` returning false denies and skips \`call()\`. The tool returns \`call()\`'s raw value.
|
|
64
|
+
Allowed type classes: Search, Filters. \`call()\` must return a JSON-serializable value.` +
|
|
38
65
|
CPLACEJS_COMMON_API_CHEAT_SHEET),
|
|
39
66
|
pageUID: z
|
|
40
67
|
.string()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-action-simulation.js","sourceRoot":"","sources":["../../src/tools/page-action-simulation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AAEtE,MAAM,yBAAyB,GAAG,6BAA6B,CAAC;AAEhE,MAAM,CAAC,MAAM,uCAAuC,GAAG;IACrD,CAAC,yBAAyB,CAAC,EAAE;QAC3B,WAAW,EAAE
|
|
1
|
+
{"version":3,"file":"page-action-simulation.js","sourceRoot":"","sources":["../../src/tools/page-action-simulation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,+BAA+B,EAAE,MAAM,qBAAqB,CAAC;AAEtE,MAAM,yBAAyB,GAAG,6BAA6B,CAAC;AAEhE,MAAM,CAAC,MAAM,uCAAuC,GAAG;IACrD,CAAC,yBAAyB,CAAC,EAAE;QAC3B,WAAW,E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