@xano/xanoscript-language-server 12.22.0 → 12.23.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/lexer/tokens.js CHANGED
@@ -295,6 +295,12 @@ export const HistoryToken = createTokenByName("history", {
295
295
  categories: [Identifier], // could also be an identifier
296
296
  });
297
297
 
298
+ // `mesh0 = {logging, statements}` on objects and containers.
299
+ export const Mesh0Token = createTokenByName("mesh0", {
300
+ longer_alt: Identifier,
301
+ categories: [Identifier], // could also be an identifier
302
+ });
303
+
298
304
  export const Cachetoken = createTokenByName("cache", {
299
305
  longer_alt: Identifier,
300
306
  categories: [Identifier], // could also be an identifier
@@ -438,6 +444,7 @@ export const allTokens = uniq([
438
444
  NullToken,
439
445
  NowToken,
440
446
  HistoryToken,
447
+ Mesh0Token,
441
448
  Cachetoken,
442
449
  SecurityToken,
443
450
  ...StorageTokens,
@@ -557,6 +564,7 @@ function buildTokenTypeMap() {
557
564
  // Structural and control keywords
558
565
  [Cachetoken.name]: "keyword",
559
566
  [HistoryToken.name]: "keyword",
567
+ [Mesh0Token.name]: "keyword",
560
568
  [IndexToken.name]: "keyword",
561
569
  [InputToken.name]: "keyword",
562
570
  [MiddlewareToken.name]: "keyword",
@@ -444,7 +444,7 @@ api.call "account/{account_id}" verb=POST {
444
444
  } as $account_update_response
445
445
  ```
446
446
 
447
- Calls an internal Xano API endpoint from within a `workflow_test` or `test` clause. This allows you to invoke internal APIs as part of your end-to-end workflow tests or unit tests within queries, functions, and tasks.
447
+ Calls an internal Xano API endpoint from within a `workflow_test`, `tool`, `prompt`, `resource` or `test` clause. This allows you to invoke internal APIs as part of your end-to-end workflow tests, from MCP tools, prompts and resources, or in unit tests within queries, functions, and tasks.
448
448
 
449
449
  To call the endpoint as a logged-in user, pass a token with `auth = {token: "...", ignore_expiration: true}` (a literal token) or an `Authorization` header (`headers = ["Authorization: Bearer " ~ $token]`).
450
450
 
@@ -482,7 +482,7 @@ tool.call "my_tool" {
482
482
  } as $tool_response
483
483
  ```
484
484
 
485
- Calls an internal Xano AI tool, it allows you to invoke internal tools within your end-to-end workflows tests.
485
+ Calls an internal Xano AI tool, it allows you to invoke internal tools within your end-to-end workflows tests, and from other tools, prompts and resources.
486
486
 
487
487
  - `tool.call` takes the name of the tool as an argument.
488
488
  - `input`: The input parameters for the tool.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xano/xanoscript-language-server",
3
- "version": "12.22.0",
3
+ "version": "12.23.0",
4
4
  "description": "Language Server Protocol implementation for XanoScript, the language of Xano backends",
5
5
  "keywords": [
6
6
  "xano",
@@ -17,6 +17,7 @@ export function agentTriggerDeclaration($) {
17
17
  let hasGuid = false;
18
18
  let hasDocs = false;
19
19
  let hasHistory = false;
20
+ let hasMesh0 = false;
20
21
  let hasInput = false;
21
22
  let hasResponse = false;
22
23
  let hasStack = false;
@@ -92,6 +93,13 @@ export function agentTriggerDeclaration($) {
92
93
  $.SUBRULE($.historyClause);
93
94
  },
94
95
  },
96
+ {
97
+ GATE: () => !hasMesh0,
98
+ ALT: () => {
99
+ hasMesh0 = true;
100
+ $.SUBRULE($.mesh0Clause);
101
+ },
102
+ },
95
103
  {
96
104
  GATE: () => !hasInput,
97
105
  ALT: () => {
@@ -19,6 +19,7 @@ export function apiGroupDeclaration($) {
19
19
  let hasGuid = false;
20
20
  let hasDocs = false;
21
21
  let hasHistory = false;
22
+ let hasMesh0 = false;
22
23
  let hasSwagger = false;
23
24
  let hasTags = false;
24
25
  let hasMiddleware = false;
@@ -112,6 +113,13 @@ export function apiGroupDeclaration($) {
112
113
  $.SUBRULE($.historyClause);
113
114
  },
114
115
  },
116
+ {
117
+ GATE: () => !hasMesh0,
118
+ ALT: () => {
119
+ hasMesh0 = true;
120
+ $.SUBRULE($.mesh0Clause);
121
+ },
122
+ },
115
123
  {
116
124
  GATE: () => !hasSwagger,
117
125
  ALT: () => {
@@ -1,6 +1,7 @@
1
1
  import { BranchToken } from "../lexer/branch.js";
2
2
  import { StringLiteral } from "../lexer/literal.js";
3
3
  import { Identifier, NewlineToken } from "../lexer/tokens.js";
4
+ import { MESH0_SETTING_SCHEMA } from "./clauses/mesh0Clause.js";
4
5
 
5
6
  export function branchDeclaration($) {
6
7
  return () => {
@@ -56,6 +57,20 @@ export function branchDeclaration($) {
56
57
  "prompt?": historyValues,
57
58
  "resource?": historyValues,
58
59
  },
60
+ // Strict whitelist of run types, each `{logging, statements}`.
61
+ // The platform writes only the types that differ from the
62
+ // default, and no block at all when none do.
63
+ "mesh0?": {
64
+ "function?": MESH0_SETTING_SCHEMA,
65
+ "query?": MESH0_SETTING_SCHEMA,
66
+ "task?": MESH0_SETTING_SCHEMA,
67
+ "tool?": MESH0_SETTING_SCHEMA,
68
+ "trigger?": MESH0_SETTING_SCHEMA,
69
+ "middleware?": MESH0_SETTING_SCHEMA,
70
+ "prompt?": MESH0_SETTING_SCHEMA,
71
+ "resource?": MESH0_SETTING_SCHEMA,
72
+ "message?": MESH0_SETTING_SCHEMA,
73
+ },
59
74
  },
60
75
  ],
61
76
  });
@@ -19,6 +19,7 @@ export function channelDeclaration($) {
19
19
  let hasDelivery = false;
20
20
  let hasRateLimit = false;
21
21
  let hasHistory = false;
22
+ let hasMesh0 = false;
22
23
  let hasMiddleware = false;
23
24
  let hasInput = false;
24
25
  let hasDescription = false;
@@ -143,6 +144,13 @@ export function channelDeclaration($) {
143
144
  $.SUBRULE($.historyClause);
144
145
  },
145
146
  },
147
+ {
148
+ GATE: () => !hasMesh0,
149
+ ALT: () => {
150
+ hasMesh0 = true;
151
+ $.SUBRULE($.mesh0Clause);
152
+ },
153
+ },
146
154
  {
147
155
  GATE: () => !hasMiddleware,
148
156
  ALT: () => {
@@ -13,6 +13,7 @@ export function channelTriggerDeclaration($) {
13
13
  let hasDescription = false;
14
14
  let hasGuid = false;
15
15
  let hasHistory = false;
16
+ let hasMesh0 = false;
16
17
  let hasInput = false;
17
18
  let hasResponse = false;
18
19
  let hasStack = false;
@@ -99,6 +100,13 @@ export function channelTriggerDeclaration($) {
99
100
  $.SUBRULE($.historyClause);
100
101
  },
101
102
  },
103
+ {
104
+ GATE: () => !hasMesh0,
105
+ ALT: () => {
106
+ hasMesh0 = true;
107
+ $.SUBRULE($.mesh0Clause);
108
+ },
109
+ },
102
110
  {
103
111
  GATE: () => !hasInput,
104
112
  ALT: () => {
@@ -0,0 +1,51 @@
1
+ import { EqualToken } from "../../lexer/control.js";
2
+ import { Mesh0Token } from "../../lexer/tokens.js";
3
+
4
+ /**
5
+ * The value set of one mesh0 setting, `{logging, statements}`, shared by the
6
+ * object/container `mesh0 = {...}` clause and each run type of a branch
7
+ * document's `mesh0` block (`branch_parser.js`).
8
+ *
9
+ * Mirrors the platform's mesh0 settings: `logging` is the trace detail
10
+ * (`"inherit"` defers to the next level), `statements` the per-run statement
11
+ * span cap. Unlimited is written `"all"`, as `history` writes it; the platform
12
+ * stores it as `-1`. Both keys are optional, and a missing one inherits.
13
+ */
14
+ export const MESH0_SETTING_SCHEMA = {
15
+ "logging?": ["inherit", "minimal", "light", "full"],
16
+ "statements?": [100, 1000, 10000, "all"],
17
+ };
18
+
19
+ /**
20
+ * Parses the `mesh0 = {logging: "light", statements: 1000}` setting of an
21
+ * object (query, function, task, tool, middleware, trigger, prompt, resource)
22
+ * or a container (api_group, mcp_server, channel, realtime_server). It sits
23
+ * beside `history`. A container presents the same two keys; the platform maps
24
+ * them to its type-prefixed fields (`query_logging`, `tool_statements`, ...).
25
+ *
26
+ * @param {import('../base_parser.js').XanoBaseParser} $
27
+ */
28
+ export function mesh0Clause($) {
29
+ return () => {
30
+ $.sectionStack.push("mesh0Clause");
31
+ const parent = $.CONSUME(Mesh0Token); // "mesh0"
32
+ $.CONSUME(EqualToken); // "="
33
+
34
+ const captured = {};
35
+ $.SUBRULE($.schemaParseObjectFn, {
36
+ ARGS: [parent, MESH0_SETTING_SCHEMA, captured],
37
+ });
38
+
39
+ // Both keys are optional, but an empty setting says nothing.
40
+ $.ACTION(() => {
41
+ if (Object.keys(captured).length === 0) {
42
+ $.addMissingError(
43
+ parent,
44
+ "{} requires at least one of: logging, statements",
45
+ );
46
+ }
47
+ });
48
+
49
+ $.sectionStack.pop();
50
+ };
51
+ }
@@ -15,6 +15,7 @@ import {
15
15
  mcpToolAnnotationsClause,
16
16
  } from "./mcpMetadataClauses.js";
17
17
  import { mcpServerClause } from "./mcpServerClause.js";
18
+ import { mesh0Clause } from "./mesh0Clause.js";
18
19
  import { middlewareClause } from "./middlewareClause.js";
19
20
  import { nakedStackFn } from "./nakedStackFn.js";
20
21
  import { outputClause } from "./outputClause.js";
@@ -42,6 +43,7 @@ export const register = ($) => {
42
43
  flexibleStringClause($)
43
44
  );
44
45
  $.historyClause = $.RULE("historyClause", historyClause($));
46
+ $.mesh0Clause = $.RULE("mesh0Clause", mesh0Clause($));
45
47
  $.indexClause = $.RULE("indexClause", indexClause($));
46
48
  $.inputClause = $.RULE("inputClause", inputClause($));
47
49
  $.outputClause = $.RULE("outputClause", outputClause($));
@@ -10,6 +10,7 @@ export function errorTriggerDeclaration($) {
10
10
  let hasDescription = false;
11
11
  let hasGuid = false;
12
12
  let hasHistory = false;
13
+ let hasMesh0 = false;
13
14
  let hasInput = false;
14
15
  let hasStack = false;
15
16
  let hasTags = false;
@@ -60,6 +61,13 @@ export function errorTriggerDeclaration($) {
60
61
  $.SUBRULE($.historyClause);
61
62
  },
62
63
  },
64
+ {
65
+ GATE: () => !hasMesh0,
66
+ ALT: () => {
67
+ hasMesh0 = true;
68
+ $.SUBRULE($.mesh0Clause);
69
+ },
70
+ },
63
71
  {
64
72
  GATE: () => !hasInput,
65
73
  ALT: () => {
@@ -12,6 +12,7 @@ export function functionDeclaration($) {
12
12
  let hasGuid = false;
13
13
  let hasDocs = false;
14
14
  let hasHistory = false;
15
+ let hasMesh0 = false;
15
16
  let hasInput = false;
16
17
  let hasMiddleware = false;
17
18
  let hasResponse = false;
@@ -77,6 +78,13 @@ export function functionDeclaration($) {
77
78
  $.SUBRULE($.historyClause);
78
79
  },
79
80
  },
81
+ {
82
+ GATE: () => !hasMesh0,
83
+ ALT: () => {
84
+ hasMesh0 = true;
85
+ $.SUBRULE($.mesh0Clause);
86
+ },
87
+ },
80
88
  {
81
89
  GATE: () => !hasInput,
82
90
  ALT: () => {
@@ -24,6 +24,8 @@ export function apiCallFn($) {
24
24
  const validContexts = [
25
25
  "workflowTestDeclaration",
26
26
  "toolDeclaration",
27
+ "promptDeclaration",
28
+ "resourceDeclaration",
27
29
  "testClause",
28
30
  ];
29
31
  const isInValidContext = validContexts.some((context) =>
@@ -33,7 +35,7 @@ export function apiCallFn($) {
33
35
  if (!isInValidContext) {
34
36
  $.addInvalidValueError(
35
37
  fnToken,
36
- "api.call can only be used within workflow_test, tool, or test contexts",
38
+ "api.call can only be used within workflow_test, tool, prompt, resource, or test contexts",
37
39
  );
38
40
  }
39
41
 
@@ -160,6 +160,7 @@ function mcpPrimitiveDeclaration($, kind) {
160
160
  let hasDocs = false;
161
161
  let hasGuid = false;
162
162
  let hasHistory = false;
163
+ let hasMesh0 = false;
163
164
  let hasIcons = false;
164
165
  let hasInput = false;
165
166
  let hasMiddleware = false;
@@ -224,6 +225,13 @@ function mcpPrimitiveDeclaration($, kind) {
224
225
  $.SUBRULE($.historyClause);
225
226
  },
226
227
  },
228
+ {
229
+ GATE: () => !hasMesh0,
230
+ ALT: () => {
231
+ hasMesh0 = true;
232
+ $.SUBRULE($.mesh0Clause);
233
+ },
234
+ },
227
235
  {
228
236
  GATE: () => !hasIcons,
229
237
  ALT: () => {
@@ -271,7 +279,12 @@ function mcpPrimitiveDeclaration($, kind) {
271
279
  GATE: () => !hasStack,
272
280
  ALT: () => {
273
281
  hasStack = true;
274
- $.SUBRULE($.stackClause);
282
+ // Like a tool's: the backend's prompt/resource runner loads the
283
+ // workspace's tools, addons and middleware, so the call
284
+ // statements resolve here.
285
+ $.SUBRULE($.stackClause, {
286
+ ARGS: [{ allowCallStatements: true }],
287
+ });
275
288
  },
276
289
  },
277
290
  {
@@ -18,6 +18,7 @@ export function mcpServerDeclaration($) {
18
18
  let hasGuid = false;
19
19
  let hasDocs = false;
20
20
  let hasHistory = false;
21
+ let hasMesh0 = false;
21
22
  let hasInstructions = false;
22
23
  let hasOauth = false;
23
24
  let hasPrompts = false;
@@ -86,6 +87,13 @@ export function mcpServerDeclaration($) {
86
87
  $.SUBRULE($.historyClause);
87
88
  },
88
89
  },
90
+ {
91
+ GATE: () => !hasMesh0,
92
+ ALT: () => {
93
+ hasMesh0 = true;
94
+ $.SUBRULE($.mesh0Clause);
95
+ },
96
+ },
89
97
  {
90
98
  GATE: () => !hasInstructions,
91
99
  ALT: () => {
@@ -14,6 +14,7 @@ export function mcpServerTriggerDeclaration($) {
14
14
  let hasDescription = false;
15
15
  let hasGuid = false;
16
16
  let hasHistory = false;
17
+ let hasMesh0 = false;
17
18
  let hasInput = false;
18
19
  let hasMcpServer = false;
19
20
  let hasResponse = false;
@@ -87,6 +88,13 @@ export function mcpServerTriggerDeclaration($) {
87
88
  $.SUBRULE($.historyClause);
88
89
  },
89
90
  },
91
+ {
92
+ GATE: () => !hasMesh0,
93
+ ALT: () => {
94
+ hasMesh0 = true;
95
+ $.SUBRULE($.mesh0Clause);
96
+ },
97
+ },
90
98
  {
91
99
  GATE: () => !hasInput,
92
100
  ALT: () => {
@@ -15,6 +15,7 @@ export function middlewareDeclaration($) {
15
15
  let hasDocs = false;
16
16
  let hasExceptionPolicy = false;
17
17
  let hasHistory = false;
18
+ let hasMesh0 = false;
18
19
  let hasInput = false;
19
20
  let hasResponse = false;
20
21
  let hasResponseStrategy = false;
@@ -78,6 +79,13 @@ export function middlewareDeclaration($) {
78
79
  $.SUBRULE($.historyClause);
79
80
  },
80
81
  },
82
+ {
83
+ GATE: () => !hasMesh0,
84
+ ALT: () => {
85
+ hasMesh0 = true;
86
+ $.SUBRULE($.mesh0Clause);
87
+ },
88
+ },
81
89
  {
82
90
  GATE: () => !hasInput,
83
91
  ALT: () => {
@@ -30,6 +30,7 @@ export function queryDeclaration($) {
30
30
  let hasGuid = false;
31
31
  let hasDocs = false;
32
32
  let hasHistory = false;
33
+ let hasMesh0 = false;
33
34
  let hasInput = false;
34
35
  let hasMiddleware = false;
35
36
  let hasResponse = false;
@@ -154,6 +155,13 @@ export function queryDeclaration($) {
154
155
  $.SUBRULE($.historyClause);
155
156
  },
156
157
  },
158
+ {
159
+ GATE: () => !hasMesh0,
160
+ ALT: () => {
161
+ hasMesh0 = true;
162
+ $.SUBRULE($.mesh0Clause);
163
+ },
164
+ },
157
165
  {
158
166
  GATE: () => !hasInput,
159
167
  ALT: () => {
@@ -12,6 +12,7 @@ export function realtimeServerDeclaration($) {
12
12
  let hasGuid = false;
13
13
  let hasDocs = false;
14
14
  let hasHistory = false;
15
+ let hasMesh0 = false;
15
16
  let hasMiddleware = false;
16
17
  let hasTags = false;
17
18
 
@@ -76,6 +77,13 @@ export function realtimeServerDeclaration($) {
76
77
  $.SUBRULE($.historyClause);
77
78
  },
78
79
  },
80
+ {
81
+ GATE: () => !hasMesh0,
82
+ ALT: () => {
83
+ hasMesh0 = true;
84
+ $.SUBRULE($.mesh0Clause);
85
+ },
86
+ },
79
87
  {
80
88
  GATE: () => !hasMiddleware,
81
89
  ALT: () => {
@@ -11,6 +11,7 @@ export function realtimeServerTriggerDeclaration($) {
11
11
  let hasDescription = false;
12
12
  let hasGuid = false;
13
13
  let hasHistory = false;
14
+ let hasMesh0 = false;
14
15
  let hasInput = false;
15
16
  let hasRealtimeServer = false;
16
17
  let hasResponse = false;
@@ -83,6 +84,13 @@ export function realtimeServerTriggerDeclaration($) {
83
84
  $.SUBRULE($.historyClause);
84
85
  },
85
86
  },
87
+ {
88
+ GATE: () => !hasMesh0,
89
+ ALT: () => {
90
+ hasMesh0 = true;
91
+ $.SUBRULE($.mesh0Clause);
92
+ },
93
+ },
86
94
  {
87
95
  GATE: () => !hasInput,
88
96
  ALT: () => {
@@ -15,6 +15,7 @@ export function realtimeTriggerDeclaration($) {
15
15
  let hasDescription = false;
16
16
  let hasGuid = false;
17
17
  let hasHistory = false;
18
+ let hasMesh0 = false;
18
19
  let hasInput = false;
19
20
  let hasResponse = false;
20
21
  let hasStack = false;
@@ -91,6 +92,13 @@ export function realtimeTriggerDeclaration($) {
91
92
  $.SUBRULE($.historyClause);
92
93
  },
93
94
  },
95
+ {
96
+ GATE: () => !hasMesh0,
97
+ ALT: () => {
98
+ hasMesh0 = true;
99
+ $.SUBRULE($.mesh0Clause);
100
+ },
101
+ },
94
102
  {
95
103
  GATE: () => !hasInput,
96
104
  ALT: () => {
@@ -18,6 +18,7 @@ export function tableTriggerDeclaration($) {
18
18
  let hasDescription = false;
19
19
  let hasGuid = false;
20
20
  let hasHistory = false;
21
+ let hasMesh0 = false;
21
22
  let hasInput = false;
22
23
  let hasStack = false;
23
24
  let hasTags = false;
@@ -109,6 +110,13 @@ export function tableTriggerDeclaration($) {
109
110
  $.SUBRULE($.historyClause);
110
111
  },
111
112
  },
113
+ {
114
+ GATE: () => !hasMesh0,
115
+ ALT: () => {
116
+ hasMesh0 = true;
117
+ $.SUBRULE($.mesh0Clause);
118
+ },
119
+ },
112
120
  {
113
121
  GATE: () => !hasInput,
114
122
  ALT: () => {
@@ -13,6 +13,7 @@ export function taskDeclaration($) {
13
13
  let hasGuid = false;
14
14
  let hasDocs = false;
15
15
  let hasHistory = false;
16
+ let hasMesh0 = false;
16
17
  let hasMiddleware = false;
17
18
  let hasSchedule = false;
18
19
  let hasStack = false;
@@ -81,6 +82,13 @@ export function taskDeclaration($) {
81
82
  $.SUBRULE($.historyClause);
82
83
  },
83
84
  },
85
+ {
86
+ GATE: () => !hasMesh0,
87
+ ALT: () => {
88
+ hasMesh0 = true;
89
+ $.SUBRULE($.mesh0Clause);
90
+ },
91
+ },
84
92
  {
85
93
  GATE: () => !hasMiddleware,
86
94
  ALT: () => {
@@ -10,6 +10,7 @@ export function toolDeclaration($) {
10
10
  let hasGuid = false;
11
11
  let hasDocs = false;
12
12
  let hasHistory = false;
13
+ let hasMesh0 = false;
13
14
  let hasIcons = false;
14
15
  let hasInput = false;
15
16
  let hasInstructions = false;
@@ -70,6 +71,13 @@ export function toolDeclaration($) {
70
71
  $.SUBRULE($.historyClause);
71
72
  },
72
73
  },
74
+ {
75
+ GATE: () => !hasMesh0,
76
+ ALT: () => {
77
+ hasMesh0 = true;
78
+ $.SUBRULE($.mesh0Clause);
79
+ },
80
+ },
73
81
  {
74
82
  GATE: () => !hasIcons,
75
83
  ALT: () => {
@@ -14,6 +14,7 @@ export function workspaceTriggerDeclaration($) {
14
14
  let hasDescription = false;
15
15
  let hasGuid = false;
16
16
  let hasHistory = false;
17
+ let hasMesh0 = false;
17
18
  let hasInput = false;
18
19
  let hasStack = false;
19
20
  let hasTags = false;
@@ -83,6 +84,13 @@ export function workspaceTriggerDeclaration($) {
83
84
  $.SUBRULE($.historyClause);
84
85
  },
85
86
  },
87
+ {
88
+ GATE: () => !hasMesh0,
89
+ ALT: () => {
90
+ hasMesh0 = true;
91
+ $.SUBRULE($.mesh0Clause);
92
+ },
93
+ },
86
94
  {
87
95
  GATE: () => !hasInput,
88
96
  ALT: () => {