@mfdaves/okf-mcp 0.9.1 → 0.13.0-rc.1

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 (115) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/README.md +452 -26
  3. package/bin/okf-mcp.js +6 -1
  4. package/okf/okf-mcp/distribution/reference-bundle.md +10 -3
  5. package/okf/okf-mcp/index.md +2 -1
  6. package/okf/okf-mcp/interfaces/http-authoring-api.md +11 -2
  7. package/okf/okf-mcp/interfaces/mcp-http.md +64 -0
  8. package/okf/okf-mcp/interfaces/mcp-tools.md +25 -6
  9. package/okf/okf-mcp/overview/okf-mcp.md +16 -6
  10. package/okf/okf-mcp/policies/authoring-safety.md +28 -5
  11. package/okf/okf-mcp/runtime/indexer.md +14 -1
  12. package/okf/okf-mcp/runtime/mcp-server.md +16 -8
  13. package/okf/okf-mcp/specs/producer-api.md +16 -2
  14. package/package.json +17 -5
  15. package/server.json +38 -2
  16. package/src/assets.js +165 -73
  17. package/src/authoring/candidates.js +434 -0
  18. package/src/authoring/git-preflight.js +225 -0
  19. package/src/authoring/git-publish.js +783 -0
  20. package/src/authoring/live.js +757 -0
  21. package/src/authoring/paths.js +112 -0
  22. package/src/authoring/policy-hook.js +221 -0
  23. package/src/authoring/proposal-policy.js +159 -0
  24. package/src/authoring/receipts.js +373 -0
  25. package/src/authoring/render.js +38 -0
  26. package/src/authoring/shared.js +75 -0
  27. package/src/authoring/staging.js +216 -0
  28. package/src/authoring.js +386 -287
  29. package/src/cache/files.js +147 -0
  30. package/src/cache/lock.js +201 -0
  31. package/src/cache/paths.js +197 -0
  32. package/src/cache/store.js +703 -0
  33. package/src/catalog-text.js +19 -0
  34. package/src/cli/commands.js +448 -0
  35. package/src/cli/http-options.js +193 -0
  36. package/src/cli/options.js +554 -0
  37. package/src/cli/usage.js +96 -0
  38. package/src/cli.js +18 -932
  39. package/src/computation.js +99 -61
  40. package/src/context/assemble.js +567 -0
  41. package/src/context/cli-options.js +88 -0
  42. package/src/context/score.js +234 -0
  43. package/src/context/sections.js +274 -0
  44. package/src/embed/interface.js +160 -0
  45. package/src/embed/openai.js +715 -0
  46. package/src/embed/prepare.js +182 -0
  47. package/src/embed/units.js +96 -0
  48. package/src/error-details.js +53 -0
  49. package/src/git-source.js +112 -52
  50. package/src/graph.js +95 -37
  51. package/src/http-server.js +36 -17
  52. package/src/index.js +15 -0
  53. package/src/indexer/assemble.js +566 -0
  54. package/src/indexer/build.js +290 -0
  55. package/src/indexer/cache.js +81 -0
  56. package/src/indexer/edges.js +430 -0
  57. package/src/indexer/index.js +44 -0
  58. package/src/indexer/paths.js +178 -0
  59. package/src/indexer/resolve.js +282 -0
  60. package/src/indexer/update.js +720 -0
  61. package/src/indexer.js +3 -1068
  62. package/src/live-authoring.js +4 -2329
  63. package/src/markdown.js +21 -16
  64. package/src/mcp/auth.js +409 -0
  65. package/src/mcp/http.js +317 -0
  66. package/src/mcp/principal.js +59 -0
  67. package/src/mcp/registry.js +356 -0
  68. package/src/mcp/resources.js +45 -0
  69. package/src/mcp/server.js +567 -0
  70. package/src/mcp/tools/catalog.js +247 -0
  71. package/src/mcp/tools/computation.js +83 -0
  72. package/src/mcp/tools/context.js +133 -0
  73. package/src/mcp/tools/graph.js +167 -0
  74. package/src/mcp/tools/live-authoring.js +316 -0
  75. package/src/mcp/tools/migration.js +86 -0
  76. package/src/mcp/tools/producers.js +79 -0
  77. package/src/mcp/tools/proposals.js +225 -0
  78. package/src/mcp/tools/provenance.js +87 -0
  79. package/src/mcp/tools/remote.js +79 -0
  80. package/src/mcp/tools/search.js +242 -0
  81. package/src/mcp-server.js +3 -1611
  82. package/src/migration.js +431 -253
  83. package/src/parser.js +245 -130
  84. package/src/plugins.js +71 -48
  85. package/src/policy/write-policy.js +713 -0
  86. package/src/producer-publisher.js +202 -78
  87. package/src/producers.js +311 -103
  88. package/src/project.js +346 -93
  89. package/src/remote.js +96 -61
  90. package/src/search/cli-options.js +107 -0
  91. package/src/search/confidence.js +61 -0
  92. package/src/search/dense.js +304 -0
  93. package/src/search/embedding-cli.js +57 -0
  94. package/src/search/embedding-config.js +217 -0
  95. package/src/search/fusion.js +249 -0
  96. package/src/search/hybrid.js +526 -0
  97. package/src/search/languages.js +200 -0
  98. package/src/search/lexical.js +695 -0
  99. package/src/search/query.js +620 -0
  100. package/src/search/stem/among.js +43 -0
  101. package/src/search/stem/base-stemmer.js +311 -0
  102. package/src/search/stem/en-regions.js +456 -0
  103. package/src/search/stem/en-suffixes.js +664 -0
  104. package/src/search/stem/en-tables.js +176 -0
  105. package/src/search/stem/en.js +238 -0
  106. package/src/search/stem/it-regions.js +459 -0
  107. package/src/search/stem/it-suffixes.js +471 -0
  108. package/src/search/stem/it-tables.js +257 -0
  109. package/src/search/stem/it.js +155 -0
  110. package/src/search-index.js +2 -81
  111. package/src/search.js +2 -252
  112. package/src/store.js +134 -81
  113. package/src/tool-packs.js +346 -0
  114. package/src/v02.js +301 -105
  115. package/src/validation.js +24 -20
@@ -0,0 +1,459 @@
1
+ /*
2
+ * Copyright (c) AXA Group Operations Spain S.A.
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining
5
+ * a copy of this software and associated documentation files (the
6
+ * 'Software'), to deal in the Software without restriction, including
7
+ * without limitation the rights to use, copy, modify, merge, publish,
8
+ * distribute, sublicense, and/or sell copies of the Software, and to
9
+ * permit persons to whom the Software is furnished to do so, subject to
10
+ * the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice shall be
13
+ * included in all copies or substantial portions of the Software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
16
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ */
23
+
24
+ // Provenance: derived from @nlpjs/lang-it 4.26.1, src/stemmer-it.js (MIT,
25
+ // header above), itself generated by the Snowball compiler from the
26
+ // Snowball Italian stemming algorithm; this file holds the prelude, region marking and helper routines.
27
+ // Mechanical changes only (scripts/vendor-stemmers.js): the class is split
28
+ // by routine group to stay under the 800-line cap, local requires replace
29
+ // @nlpjs/core, no container or tokenizer plumbing, strict equality,
30
+ // block-scoped and const declarations, labels renamed apart from their
31
+ // guard variables, Biome formatting. test/stem-parity.test.js pins zero
32
+ // disagreements with the upstream package.
33
+ "use strict";
34
+ const tables = require("./it-tables");
35
+
36
+ module.exports = {
37
+ r_prelude() {
38
+ let among_var;
39
+ let v_2;
40
+ let v_3;
41
+ let v_4;
42
+ let v_5;
43
+ // (, line 34
44
+ // test, line 35
45
+ const v_1 = this.cursor;
46
+ // repeat, line 35
47
+ replab0: while (true) {
48
+ v_2 = this.cursor;
49
+ let lab1 = true;
50
+ label1: while (lab1 === true) {
51
+ lab1 = false;
52
+ // (, line 35
53
+ // [, line 36
54
+ this.bra = this.cursor;
55
+ // substring, line 36
56
+ among_var = this.find_among(tables.a_0, 7);
57
+ if (among_var === 0) {
58
+ break;
59
+ }
60
+ // ], line 36
61
+ this.ket = this.cursor;
62
+ switch (among_var) {
63
+ case 0:
64
+ break label1;
65
+ case 1:
66
+ // (, line 37
67
+ // <-, line 37
68
+ if (!this.slice_from("\u00E0")) {
69
+ return false;
70
+ }
71
+ break;
72
+ case 2:
73
+ // (, line 38
74
+ // <-, line 38
75
+ if (!this.slice_from("\u00E8")) {
76
+ return false;
77
+ }
78
+ break;
79
+ case 3:
80
+ // (, line 39
81
+ // <-, line 39
82
+ if (!this.slice_from("\u00EC")) {
83
+ return false;
84
+ }
85
+ break;
86
+ case 4:
87
+ // (, line 40
88
+ // <-, line 40
89
+ if (!this.slice_from("\u00F2")) {
90
+ return false;
91
+ }
92
+ break;
93
+ case 5:
94
+ // (, line 41
95
+ // <-, line 41
96
+ if (!this.slice_from("\u00F9")) {
97
+ return false;
98
+ }
99
+ break;
100
+ case 6:
101
+ // (, line 42
102
+ // <-, line 42
103
+ if (!this.slice_from("qU")) {
104
+ return false;
105
+ }
106
+ break;
107
+ case 7:
108
+ // (, line 43
109
+ // next, line 43
110
+ if (this.cursor >= this.limit) {
111
+ break label1;
112
+ }
113
+ this.cursor++;
114
+ break;
115
+ }
116
+ continue replab0;
117
+ }
118
+ this.cursor = v_2;
119
+ break;
120
+ }
121
+ this.cursor = v_1;
122
+ // repeat, line 46
123
+ replab2: while (true) {
124
+ v_3 = this.cursor;
125
+ let lab3 = true;
126
+ label3: while (lab3 === true) {
127
+ lab3 = false;
128
+ // goto, line 46
129
+ golab4: while (true) {
130
+ v_4 = this.cursor;
131
+ let lab5 = true;
132
+ label5: while (lab5 === true) {
133
+ lab5 = false;
134
+ // (, line 46
135
+ if (!this.in_grouping(tables.g_v, 97, 249)) {
136
+ break;
137
+ }
138
+ // [, line 47
139
+ this.bra = this.cursor;
140
+ // or, line 47
141
+ let lab6 = true;
142
+ label6: while (lab6 === true) {
143
+ lab6 = false;
144
+ v_5 = this.cursor;
145
+ let lab7 = true;
146
+ while (lab7 === true) {
147
+ lab7 = false;
148
+ // (, line 47
149
+ // literal, line 47
150
+ if (!this.eq_s(1, "u")) {
151
+ break;
152
+ }
153
+ // ], line 47
154
+ this.ket = this.cursor;
155
+ if (!this.in_grouping(tables.g_v, 97, 249)) {
156
+ break;
157
+ }
158
+ // <-, line 47
159
+ if (!this.slice_from("U")) {
160
+ return false;
161
+ }
162
+ break label6;
163
+ }
164
+ this.cursor = v_5;
165
+ // (, line 48
166
+ // literal, line 48
167
+ if (!this.eq_s(1, "i")) {
168
+ break label5;
169
+ }
170
+ // ], line 48
171
+ this.ket = this.cursor;
172
+ if (!this.in_grouping(tables.g_v, 97, 249)) {
173
+ break label5;
174
+ }
175
+ // <-, line 48
176
+ if (!this.slice_from("I")) {
177
+ return false;
178
+ }
179
+ }
180
+ this.cursor = v_4;
181
+ break golab4;
182
+ }
183
+ this.cursor = v_4;
184
+ if (this.cursor >= this.limit) {
185
+ break label3;
186
+ }
187
+ this.cursor++;
188
+ }
189
+ continue replab2;
190
+ }
191
+ this.cursor = v_3;
192
+ break;
193
+ }
194
+ return true;
195
+ },
196
+
197
+ r_mark_regions() {
198
+ let v_2;
199
+ let v_3;
200
+ let v_6;
201
+ // (, line 52
202
+ this.I_pV = this.limit;
203
+ this.I_p1 = this.limit;
204
+ this.I_p2 = this.limit;
205
+ // do, line 58
206
+ const v_1 = this.cursor;
207
+ let lab0 = true;
208
+ label0: while (lab0 === true) {
209
+ lab0 = false;
210
+ // (, line 58
211
+ // or, line 60
212
+ let lab1 = true;
213
+ label1: while (lab1 === true) {
214
+ lab1 = false;
215
+ v_2 = this.cursor;
216
+ let lab2 = true;
217
+ label2: while (lab2 === true) {
218
+ lab2 = false;
219
+ // (, line 59
220
+ if (!this.in_grouping(tables.g_v, 97, 249)) {
221
+ break;
222
+ }
223
+ // or, line 59
224
+ let lab3 = true;
225
+ label3: while (lab3 === true) {
226
+ lab3 = false;
227
+ v_3 = this.cursor;
228
+ let lab4 = true;
229
+ label4: while (lab4 === true) {
230
+ lab4 = false;
231
+ // (, line 59
232
+ if (!this.out_grouping(tables.g_v, 97, 249)) {
233
+ break;
234
+ }
235
+ // gopast, line 59
236
+ golab5: while (true) {
237
+ let lab6 = true;
238
+ while (lab6 === true) {
239
+ lab6 = false;
240
+ if (!this.in_grouping(tables.g_v, 97, 249)) {
241
+ break;
242
+ }
243
+ break golab5;
244
+ }
245
+ if (this.cursor >= this.limit) {
246
+ break label4;
247
+ }
248
+ this.cursor++;
249
+ }
250
+ break label3;
251
+ }
252
+ this.cursor = v_3;
253
+ // (, line 59
254
+ if (!this.in_grouping(tables.g_v, 97, 249)) {
255
+ break label2;
256
+ }
257
+ // gopast, line 59
258
+ golab7: while (true) {
259
+ let lab8 = true;
260
+ while (lab8 === true) {
261
+ lab8 = false;
262
+ if (!this.out_grouping(tables.g_v, 97, 249)) {
263
+ break;
264
+ }
265
+ break golab7;
266
+ }
267
+ if (this.cursor >= this.limit) {
268
+ break label2;
269
+ }
270
+ this.cursor++;
271
+ }
272
+ }
273
+ break label1;
274
+ }
275
+ this.cursor = v_2;
276
+ // (, line 61
277
+ if (!this.out_grouping(tables.g_v, 97, 249)) {
278
+ break label0;
279
+ }
280
+ // or, line 61
281
+ let lab9 = true;
282
+ label9: while (lab9 === true) {
283
+ lab9 = false;
284
+ v_6 = this.cursor;
285
+ let lab10 = true;
286
+ label10: while (lab10 === true) {
287
+ lab10 = false;
288
+ // (, line 61
289
+ if (!this.out_grouping(tables.g_v, 97, 249)) {
290
+ break;
291
+ }
292
+ // gopast, line 61
293
+ golab11: while (true) {
294
+ let lab12 = true;
295
+ while (lab12 === true) {
296
+ lab12 = false;
297
+ if (!this.in_grouping(tables.g_v, 97, 249)) {
298
+ break;
299
+ }
300
+ break golab11;
301
+ }
302
+ if (this.cursor >= this.limit) {
303
+ break label10;
304
+ }
305
+ this.cursor++;
306
+ }
307
+ break label9;
308
+ }
309
+ this.cursor = v_6;
310
+ // (, line 61
311
+ if (!this.in_grouping(tables.g_v, 97, 249)) {
312
+ break label0;
313
+ }
314
+ // next, line 61
315
+ if (this.cursor >= this.limit) {
316
+ break label0;
317
+ }
318
+ this.cursor++;
319
+ }
320
+ }
321
+ // setmark pV, line 62
322
+ this.I_pV = this.cursor;
323
+ }
324
+ this.cursor = v_1;
325
+ // do, line 64
326
+ const v_8 = this.cursor;
327
+ let lab13 = true;
328
+ label13: while (lab13 === true) {
329
+ lab13 = false;
330
+ // (, line 64
331
+ // gopast, line 65
332
+ golab14: while (true) {
333
+ let lab15 = true;
334
+ while (lab15 === true) {
335
+ lab15 = false;
336
+ if (!this.in_grouping(tables.g_v, 97, 249)) {
337
+ break;
338
+ }
339
+ break golab14;
340
+ }
341
+ if (this.cursor >= this.limit) {
342
+ break label13;
343
+ }
344
+ this.cursor++;
345
+ }
346
+ // gopast, line 65
347
+ golab16: while (true) {
348
+ let lab17 = true;
349
+ while (lab17 === true) {
350
+ lab17 = false;
351
+ if (!this.out_grouping(tables.g_v, 97, 249)) {
352
+ break;
353
+ }
354
+ break golab16;
355
+ }
356
+ if (this.cursor >= this.limit) {
357
+ break label13;
358
+ }
359
+ this.cursor++;
360
+ }
361
+ // setmark p1, line 65
362
+ this.I_p1 = this.cursor;
363
+ // gopast, line 66
364
+ golab18: while (true) {
365
+ let lab19 = true;
366
+ while (lab19 === true) {
367
+ lab19 = false;
368
+ if (!this.in_grouping(tables.g_v, 97, 249)) {
369
+ break;
370
+ }
371
+ break golab18;
372
+ }
373
+ if (this.cursor >= this.limit) {
374
+ break label13;
375
+ }
376
+ this.cursor++;
377
+ }
378
+ // gopast, line 66
379
+ golab20: while (true) {
380
+ let lab21 = true;
381
+ while (lab21 === true) {
382
+ lab21 = false;
383
+ if (!this.out_grouping(tables.g_v, 97, 249)) {
384
+ break;
385
+ }
386
+ break golab20;
387
+ }
388
+ if (this.cursor >= this.limit) {
389
+ break label13;
390
+ }
391
+ this.cursor++;
392
+ }
393
+ // setmark p2, line 66
394
+ this.I_p2 = this.cursor;
395
+ }
396
+ this.cursor = v_8;
397
+ return true;
398
+ },
399
+
400
+ r_postlude() {
401
+ let among_var;
402
+ let v_1;
403
+ // repeat, line 70
404
+ replab0: while (true) {
405
+ v_1 = this.cursor;
406
+ let lab1 = true;
407
+ label1: while (lab1 === true) {
408
+ lab1 = false;
409
+ // (, line 70
410
+ // [, line 72
411
+ this.bra = this.cursor;
412
+ // substring, line 72
413
+ among_var = this.find_among(tables.a_1, 3);
414
+ if (among_var === 0) {
415
+ break;
416
+ }
417
+ // ], line 72
418
+ this.ket = this.cursor;
419
+ switch (among_var) {
420
+ case 0:
421
+ break label1;
422
+ case 1:
423
+ // (, line 73
424
+ // <-, line 73
425
+ if (!this.slice_from("i")) {
426
+ return false;
427
+ }
428
+ break;
429
+ case 2:
430
+ // (, line 74
431
+ // <-, line 74
432
+ if (!this.slice_from("u")) {
433
+ return false;
434
+ }
435
+ break;
436
+ case 3:
437
+ // (, line 75
438
+ // next, line 75
439
+ if (this.cursor >= this.limit) {
440
+ break label1;
441
+ }
442
+ this.cursor++;
443
+ break;
444
+ }
445
+ continue replab0;
446
+ }
447
+ this.cursor = v_1;
448
+ break;
449
+ }
450
+ return true;
451
+ },
452
+
453
+ r_RV() {
454
+ if (!(this.I_pV <= this.cursor)) {
455
+ return false;
456
+ }
457
+ return true;
458
+ },
459
+ };