@lushly-dev/afd-server 0.6.0 → 2.0.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.
Files changed (112) hide show
  1. package/README.md +320 -14
  2. package/dist/bootstrap/afd-context.d.ts +11 -2
  3. package/dist/bootstrap/afd-context.d.ts.map +1 -1
  4. package/dist/bootstrap/afd-context.js +56 -11
  5. package/dist/bootstrap/afd-context.js.map +1 -1
  6. package/dist/bootstrap/afd-docs.d.ts +6 -3
  7. package/dist/bootstrap/afd-docs.d.ts.map +1 -1
  8. package/dist/bootstrap/afd-docs.js +14 -9
  9. package/dist/bootstrap/afd-docs.js.map +1 -1
  10. package/dist/bootstrap/afd-help.d.ts +6 -3
  11. package/dist/bootstrap/afd-help.d.ts.map +1 -1
  12. package/dist/bootstrap/afd-help.js +10 -8
  13. package/dist/bootstrap/afd-help.js.map +1 -1
  14. package/dist/bootstrap/afd-schema.d.ts +8 -4
  15. package/dist/bootstrap/afd-schema.d.ts.map +1 -1
  16. package/dist/bootstrap/afd-schema.js +55 -42
  17. package/dist/bootstrap/afd-schema.js.map +1 -1
  18. package/dist/bootstrap/described-command.d.ts +32 -0
  19. package/dist/bootstrap/described-command.d.ts.map +1 -0
  20. package/dist/bootstrap/described-command.js +12 -0
  21. package/dist/bootstrap/described-command.js.map +1 -0
  22. package/dist/bootstrap/index.d.ts +1 -0
  23. package/dist/bootstrap/index.d.ts.map +1 -1
  24. package/dist/bootstrap/index.js.map +1 -1
  25. package/dist/bootstrap/json-schema-to-ts.d.ts +27 -0
  26. package/dist/bootstrap/json-schema-to-ts.d.ts.map +1 -0
  27. package/dist/bootstrap/json-schema-to-ts.js +154 -0
  28. package/dist/bootstrap/json-schema-to-ts.js.map +1 -0
  29. package/dist/bootstrap/registry.d.ts +17 -6
  30. package/dist/bootstrap/registry.d.ts.map +1 -1
  31. package/dist/bootstrap/registry.js +32 -5
  32. package/dist/bootstrap/registry.js.map +1 -1
  33. package/dist/command-names.d.ts +19 -0
  34. package/dist/command-names.d.ts.map +1 -0
  35. package/dist/command-names.js +33 -0
  36. package/dist/command-names.js.map +1 -0
  37. package/dist/command-routing.d.ts +47 -0
  38. package/dist/command-routing.d.ts.map +1 -0
  39. package/dist/command-routing.js +75 -0
  40. package/dist/command-routing.js.map +1 -0
  41. package/dist/context-scope.d.ts +26 -0
  42. package/dist/context-scope.d.ts.map +1 -0
  43. package/dist/context-scope.js +31 -0
  44. package/dist/context-scope.js.map +1 -0
  45. package/dist/define.d.ts +42 -0
  46. package/dist/define.d.ts.map +1 -0
  47. package/dist/define.js +41 -0
  48. package/dist/define.js.map +1 -0
  49. package/dist/direct-registry.d.ts +103 -0
  50. package/dist/direct-registry.d.ts.map +1 -0
  51. package/dist/direct-registry.js +102 -0
  52. package/dist/direct-registry.js.map +1 -0
  53. package/dist/execution.d.ts +9 -0
  54. package/dist/execution.d.ts.map +1 -1
  55. package/dist/execution.js +105 -321
  56. package/dist/execution.js.map +1 -1
  57. package/dist/http-handler.d.ts +24 -17
  58. package/dist/http-handler.d.ts.map +1 -1
  59. package/dist/http-handler.js +282 -253
  60. package/dist/http-handler.js.map +1 -1
  61. package/dist/http-security.d.ts +23 -0
  62. package/dist/http-security.d.ts.map +1 -0
  63. package/dist/http-security.js +101 -0
  64. package/dist/http-security.js.map +1 -0
  65. package/dist/http-sessions.d.ts +33 -0
  66. package/dist/http-sessions.d.ts.map +1 -0
  67. package/dist/http-sessions.js +65 -0
  68. package/dist/http-sessions.js.map +1 -0
  69. package/dist/http-sse.d.ts +30 -0
  70. package/dist/http-sse.d.ts.map +1 -0
  71. package/dist/http-sse.js +70 -0
  72. package/dist/http-sse.js.map +1 -0
  73. package/dist/index.d.ts +5 -4
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +4 -2
  76. package/dist/index.js.map +1 -1
  77. package/dist/json-rpc.d.ts +56 -0
  78. package/dist/json-rpc.d.ts.map +1 -0
  79. package/dist/json-rpc.js +73 -0
  80. package/dist/json-rpc.js.map +1 -0
  81. package/dist/lazy-tools.d.ts +2 -12
  82. package/dist/lazy-tools.d.ts.map +1 -1
  83. package/dist/lazy-tools.js +9 -14
  84. package/dist/lazy-tools.js.map +1 -1
  85. package/dist/meta-tools.d.ts +122 -0
  86. package/dist/meta-tools.d.ts.map +1 -0
  87. package/dist/meta-tools.js +156 -0
  88. package/dist/meta-tools.js.map +1 -0
  89. package/dist/middleware.d.ts +34 -7
  90. package/dist/middleware.d.ts.map +1 -1
  91. package/dist/middleware.js +82 -40
  92. package/dist/middleware.js.map +1 -1
  93. package/dist/schema.d.ts +27 -6
  94. package/dist/schema.d.ts.map +1 -1
  95. package/dist/schema.js +17 -12
  96. package/dist/schema.js.map +1 -1
  97. package/dist/server-types.d.ts +100 -13
  98. package/dist/server-types.d.ts.map +1 -1
  99. package/dist/server-types.js.map +1 -1
  100. package/dist/server.d.ts +10 -2
  101. package/dist/server.d.ts.map +1 -1
  102. package/dist/server.js +165 -48
  103. package/dist/server.js.map +1 -1
  104. package/dist/tool-router.d.ts +6 -5
  105. package/dist/tool-router.d.ts.map +1 -1
  106. package/dist/tool-router.js +104 -120
  107. package/dist/tool-router.js.map +1 -1
  108. package/dist/tools.d.ts +10 -420
  109. package/dist/tools.d.ts.map +1 -1
  110. package/dist/tools.js +99 -208
  111. package/dist/tools.js.map +1 -1
  112. package/package.json +13 -8
package/dist/tools.d.ts CHANGED
@@ -1,428 +1,18 @@
1
1
  /**
2
2
  * @fileoverview MCP tool list generation — individual, grouped, and lazy strategies.
3
3
  */
4
+ import { type GroupByFn } from './command-routing.js';
5
+ import { type McpToolDefinition } from './meta-tools.js';
4
6
  import type { ZodCommandDefinition } from './schema.js';
7
+ /**
8
+ * Largest serialized size (in characters) of a grouped tool's per-action parameter
9
+ * schemas that is inlined into `inputSchema.properties.params.anyOf`. Larger groups
10
+ * advertise only the generic `params` object; their schemas stay in `_meta.actions`
11
+ * and `afd-detail`, which keeps `tools/list` small.
12
+ */
13
+ export declare const GROUPED_PARAMS_SCHEMA_BUDGET = 8192;
5
14
  /**
6
15
  * Get the tools list based on toolStrategy.
7
16
  */
8
- export declare function getToolsList(commands: ZodCommandDefinition[], toolStrategy: 'individual' | 'grouped' | 'lazy', groupByFn?: (command: ZodCommandDefinition) => string | undefined, activeContext?: string | null): ({
9
- name: string;
10
- description: string;
11
- inputSchema: {
12
- type: "object";
13
- properties: {
14
- commands: {
15
- type: string;
16
- description: string;
17
- items: {
18
- type: string;
19
- properties: {
20
- id: {
21
- type: string;
22
- description: string;
23
- };
24
- command: {
25
- type: string;
26
- description: string;
27
- };
28
- input: {
29
- type: string;
30
- description: string;
31
- };
32
- };
33
- required: string[];
34
- };
35
- };
36
- options: {
37
- type: string;
38
- description: string;
39
- properties: {
40
- stopOnError: {
41
- type: string;
42
- description: string;
43
- };
44
- timeout: {
45
- type: string;
46
- description: string;
47
- };
48
- };
49
- };
50
- };
51
- required: string[];
52
- };
53
- } | {
54
- name: string;
55
- description: string;
56
- inputSchema: {
57
- type: "object";
58
- properties: {
59
- steps: {
60
- type: string;
61
- description: string;
62
- items: {
63
- type: string;
64
- properties: {
65
- command: {
66
- type: string;
67
- description: string;
68
- };
69
- input: {
70
- type: string;
71
- description: string;
72
- };
73
- as: {
74
- type: string;
75
- description: string;
76
- };
77
- when: {
78
- type: string;
79
- description: string;
80
- };
81
- };
82
- required: string[];
83
- };
84
- };
85
- options: {
86
- type: string;
87
- description: string;
88
- properties: {
89
- continueOnFailure: {
90
- type: string;
91
- description: string;
92
- };
93
- timeoutMs: {
94
- type: string;
95
- description: string;
96
- };
97
- };
98
- };
99
- };
100
- required: string[];
101
- };
102
- } | {
103
- name: string;
104
- description: string;
105
- inputSchema: {
106
- type: "object";
107
- properties: {
108
- category: {
109
- type: string;
110
- description: string;
111
- };
112
- tag: {
113
- type: string;
114
- description: string;
115
- };
116
- tagMode: {
117
- type: string;
118
- enum: string[];
119
- description: string;
120
- };
121
- search: {
122
- type: string;
123
- description: string;
124
- };
125
- includeMutation: {
126
- type: string;
127
- description: string;
128
- };
129
- limit: {
130
- type: string;
131
- description: string;
132
- };
133
- offset: {
134
- type: string;
135
- description: string;
136
- };
137
- };
138
- };
139
- } | {
140
- name: string;
141
- description: string;
142
- inputSchema: {
143
- type: "object";
144
- properties: {
145
- command: {
146
- type: string;
147
- description: string;
148
- };
149
- };
150
- required: string[];
151
- };
152
- })[] | ({
153
- name: string;
154
- description: string;
155
- inputSchema: {
156
- type: "object";
157
- properties: {
158
- commands: {
159
- type: string;
160
- description: string;
161
- items: {
162
- type: string;
163
- properties: {
164
- id: {
165
- type: string;
166
- description: string;
167
- };
168
- command: {
169
- type: string;
170
- description: string;
171
- };
172
- input: {
173
- type: string;
174
- description: string;
175
- };
176
- };
177
- required: string[];
178
- };
179
- };
180
- options: {
181
- type: string;
182
- description: string;
183
- properties: {
184
- stopOnError: {
185
- type: string;
186
- description: string;
187
- };
188
- timeout: {
189
- type: string;
190
- description: string;
191
- };
192
- };
193
- };
194
- };
195
- required: string[];
196
- };
197
- } | {
198
- name: string;
199
- description: string;
200
- inputSchema: {
201
- type: "object";
202
- properties: {
203
- steps: {
204
- type: string;
205
- description: string;
206
- items: {
207
- type: string;
208
- properties: {
209
- command: {
210
- type: string;
211
- description: string;
212
- };
213
- input: {
214
- type: string;
215
- description: string;
216
- };
217
- as: {
218
- type: string;
219
- description: string;
220
- };
221
- when: {
222
- type: string;
223
- description: string;
224
- };
225
- };
226
- required: string[];
227
- };
228
- };
229
- options: {
230
- type: string;
231
- description: string;
232
- properties: {
233
- continueOnFailure: {
234
- type: string;
235
- description: string;
236
- };
237
- timeoutMs: {
238
- type: string;
239
- description: string;
240
- };
241
- };
242
- };
243
- };
244
- required: string[];
245
- };
246
- } | {
247
- name: string;
248
- description: string;
249
- inputSchema: {
250
- type: "object";
251
- properties: {
252
- command: {
253
- type: string;
254
- description: string;
255
- };
256
- input: {
257
- type: string;
258
- description: string;
259
- };
260
- };
261
- required: string[];
262
- };
263
- } | {
264
- _meta?: {
265
- contexts?: string[] | undefined;
266
- outputSchema?: import("@lushly-dev/afd-core").JsonSchema | undefined;
267
- examples?: import("@lushly-dev/afd-core").CommandExample<unknown>[] | undefined;
268
- mutation?: boolean | undefined;
269
- requires?: string[] | undefined;
270
- } | undefined;
271
- name: string;
272
- description: string;
273
- inputSchema: {
274
- description?: string;
275
- required?: string[] | boolean;
276
- default?: unknown;
277
- enum?: unknown[];
278
- items?: import("@lushly-dev/afd-core").JsonSchema;
279
- properties?: Record<string, import("@lushly-dev/afd-core").JsonSchema>;
280
- additionalProperties?: boolean | import("@lushly-dev/afd-core").JsonSchema;
281
- minimum?: number;
282
- maximum?: number;
283
- exclusiveMinimum?: number;
284
- exclusiveMaximum?: number;
285
- minLength?: number;
286
- maxLength?: number;
287
- minItems?: number;
288
- maxItems?: number;
289
- pattern?: string;
290
- format?: string;
291
- oneOf?: import("@lushly-dev/afd-core").JsonSchema[];
292
- anyOf?: import("@lushly-dev/afd-core").JsonSchema[];
293
- allOf?: import("@lushly-dev/afd-core").JsonSchema[];
294
- not?: import("@lushly-dev/afd-core").JsonSchema;
295
- const?: unknown;
296
- type: "object";
297
- };
298
- })[] | ({
299
- name: string;
300
- description: string;
301
- inputSchema: {
302
- type: "object";
303
- properties: {
304
- commands: {
305
- type: string;
306
- description: string;
307
- items: {
308
- type: string;
309
- properties: {
310
- id: {
311
- type: string;
312
- description: string;
313
- };
314
- command: {
315
- type: string;
316
- description: string;
317
- };
318
- input: {
319
- type: string;
320
- description: string;
321
- };
322
- };
323
- required: string[];
324
- };
325
- };
326
- options: {
327
- type: string;
328
- description: string;
329
- properties: {
330
- stopOnError: {
331
- type: string;
332
- description: string;
333
- };
334
- timeout: {
335
- type: string;
336
- description: string;
337
- };
338
- };
339
- };
340
- };
341
- required: string[];
342
- };
343
- } | {
344
- name: string;
345
- description: string;
346
- inputSchema: {
347
- type: "object";
348
- properties: {
349
- steps: {
350
- type: string;
351
- description: string;
352
- items: {
353
- type: string;
354
- properties: {
355
- command: {
356
- type: string;
357
- description: string;
358
- };
359
- input: {
360
- type: string;
361
- description: string;
362
- };
363
- as: {
364
- type: string;
365
- description: string;
366
- };
367
- when: {
368
- type: string;
369
- description: string;
370
- };
371
- };
372
- required: string[];
373
- };
374
- };
375
- options: {
376
- type: string;
377
- description: string;
378
- properties: {
379
- continueOnFailure: {
380
- type: string;
381
- description: string;
382
- };
383
- timeoutMs: {
384
- type: string;
385
- description: string;
386
- };
387
- };
388
- };
389
- };
390
- required: string[];
391
- };
392
- } | {
393
- name: string;
394
- description: string;
395
- inputSchema: {
396
- type: "object";
397
- properties: {
398
- command: {
399
- type: string;
400
- description: string;
401
- };
402
- input: {
403
- type: string;
404
- description: string;
405
- };
406
- };
407
- required: string[];
408
- };
409
- } | {
410
- name: string;
411
- description: string;
412
- inputSchema: {
413
- type: "object";
414
- properties: {
415
- action: {
416
- type: string;
417
- enum: string[];
418
- description: string;
419
- };
420
- params: {
421
- type: string;
422
- description: string;
423
- };
424
- };
425
- required: string[];
426
- };
427
- })[];
17
+ export declare function getToolsList(commands: ZodCommandDefinition[], toolStrategy: 'individual' | 'grouped' | 'lazy', groupByFn?: GroupByFn, activeContext?: string | null): McpToolDefinition[];
428
18
  //# sourceMappingURL=tools.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AA0KxD;;GAEG;AACH,wBAAgB,YAAY,CAC3B,QAAQ,EAAE,oBAAoB,EAAE,EAChC,YAAY,EAAE,YAAY,GAAG,SAAS,GAAG,MAAM,EAC/C,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,MAAM,GAAG,SAAS,EACjE,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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