@mfdaves/okf-mcp 0.9.0 → 0.12.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 (97) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/README.md +176 -19
  3. package/bin/okf-mcp.js +6 -1
  4. package/okf/okf-mcp/policies/authoring-safety.md +11 -1
  5. package/package.json +17 -5
  6. package/server.json +2 -2
  7. package/src/assets.js +165 -73
  8. package/src/authoring/candidates.js +391 -0
  9. package/src/authoring/git-preflight.js +225 -0
  10. package/src/authoring/git-publish.js +776 -0
  11. package/src/authoring/live.js +789 -0
  12. package/src/authoring/paths.js +112 -0
  13. package/src/authoring/policy-hook.js +221 -0
  14. package/src/authoring/proposal-policy.js +137 -0
  15. package/src/authoring/receipts.js +329 -0
  16. package/src/authoring/render.js +38 -0
  17. package/src/authoring/shared.js +75 -0
  18. package/src/authoring/staging.js +216 -0
  19. package/src/authoring.js +386 -287
  20. package/src/cache/files.js +147 -0
  21. package/src/cache/lock.js +201 -0
  22. package/src/cache/paths.js +197 -0
  23. package/src/cache/store.js +703 -0
  24. package/src/catalog-text.js +19 -0
  25. package/src/cli.js +184 -151
  26. package/src/computation.js +99 -61
  27. package/src/context/assemble.js +567 -0
  28. package/src/context/cli-options.js +88 -0
  29. package/src/context/score.js +234 -0
  30. package/src/context/sections.js +274 -0
  31. package/src/embed/interface.js +160 -0
  32. package/src/embed/openai.js +715 -0
  33. package/src/embed/prepare.js +182 -0
  34. package/src/embed/units.js +96 -0
  35. package/src/git-source.js +112 -52
  36. package/src/graph.js +95 -37
  37. package/src/http-server.js +36 -17
  38. package/src/index.js +15 -0
  39. package/src/indexer/assemble.js +566 -0
  40. package/src/indexer/build.js +290 -0
  41. package/src/indexer/cache.js +81 -0
  42. package/src/indexer/edges.js +430 -0
  43. package/src/indexer/index.js +44 -0
  44. package/src/indexer/paths.js +178 -0
  45. package/src/indexer/resolve.js +282 -0
  46. package/src/indexer/update.js +720 -0
  47. package/src/indexer.js +3 -1068
  48. package/src/live-authoring.js +4 -2329
  49. package/src/markdown.js +21 -16
  50. package/src/mcp/registry.js +328 -0
  51. package/src/mcp/resources.js +45 -0
  52. package/src/mcp/server.js +472 -0
  53. package/src/mcp/tools/catalog.js +244 -0
  54. package/src/mcp/tools/computation.js +83 -0
  55. package/src/mcp/tools/context.js +133 -0
  56. package/src/mcp/tools/graph.js +167 -0
  57. package/src/mcp/tools/live-authoring.js +316 -0
  58. package/src/mcp/tools/migration.js +86 -0
  59. package/src/mcp/tools/producers.js +79 -0
  60. package/src/mcp/tools/proposals.js +213 -0
  61. package/src/mcp/tools/provenance.js +87 -0
  62. package/src/mcp/tools/remote.js +79 -0
  63. package/src/mcp/tools/search.js +242 -0
  64. package/src/mcp-server.js +3 -1611
  65. package/src/migration.js +431 -253
  66. package/src/parser.js +245 -130
  67. package/src/plugins.js +71 -48
  68. package/src/policy/write-policy.js +713 -0
  69. package/src/producer-publisher.js +195 -77
  70. package/src/producers.js +265 -101
  71. package/src/project.js +277 -93
  72. package/src/remote.js +96 -61
  73. package/src/search/cli-options.js +107 -0
  74. package/src/search/confidence.js +61 -0
  75. package/src/search/dense.js +304 -0
  76. package/src/search/embedding-cli.js +57 -0
  77. package/src/search/embedding-config.js +217 -0
  78. package/src/search/fusion.js +249 -0
  79. package/src/search/hybrid.js +526 -0
  80. package/src/search/languages.js +200 -0
  81. package/src/search/lexical.js +695 -0
  82. package/src/search/query.js +620 -0
  83. package/src/search/stem/among.js +43 -0
  84. package/src/search/stem/base-stemmer.js +311 -0
  85. package/src/search/stem/en-regions.js +456 -0
  86. package/src/search/stem/en-suffixes.js +664 -0
  87. package/src/search/stem/en-tables.js +176 -0
  88. package/src/search/stem/en.js +238 -0
  89. package/src/search/stem/it-regions.js +459 -0
  90. package/src/search/stem/it-suffixes.js +471 -0
  91. package/src/search/stem/it-tables.js +257 -0
  92. package/src/search/stem/it.js +155 -0
  93. package/src/search-index.js +2 -81
  94. package/src/search.js +2 -252
  95. package/src/store.js +134 -81
  96. package/src/v02.js +301 -105
  97. package/src/validation.js +24 -20
@@ -0,0 +1,471 @@
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 suffix removal steps.
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_attached_pronoun() {
38
+ // (, line 86
39
+ // [, line 87
40
+ this.ket = this.cursor;
41
+ // substring, line 87
42
+ if (this.find_among_b(tables.a_2, 37) === 0) {
43
+ return false;
44
+ }
45
+ // ], line 87
46
+ this.bra = this.cursor;
47
+ // among, line 97
48
+ const among_var = this.find_among_b(tables.a_3, 5);
49
+ if (among_var === 0) {
50
+ return false;
51
+ }
52
+ // (, line 97
53
+ // call RV, line 97
54
+ if (!this.r_RV()) {
55
+ return false;
56
+ }
57
+ switch (among_var) {
58
+ case 0:
59
+ return false;
60
+ case 1:
61
+ // (, line 98
62
+ // delete, line 98
63
+ if (!this.slice_del()) {
64
+ return false;
65
+ }
66
+ break;
67
+ case 2:
68
+ // (, line 99
69
+ // <-, line 99
70
+ if (!this.slice_from("e")) {
71
+ return false;
72
+ }
73
+ break;
74
+ }
75
+ return true;
76
+ },
77
+
78
+ r_standard_suffix() {
79
+ let among_var;
80
+ let v_1;
81
+ let v_2;
82
+ let v_3;
83
+ let v_4;
84
+ // (, line 103
85
+ // [, line 104
86
+ this.ket = this.cursor;
87
+ // substring, line 104
88
+ among_var = this.find_among_b(tables.a_6, 51);
89
+ if (among_var === 0) {
90
+ return false;
91
+ }
92
+ // ], line 104
93
+ this.bra = this.cursor;
94
+ switch (among_var) {
95
+ case 0:
96
+ return false;
97
+ case 1:
98
+ // (, line 111
99
+ // call R2, line 111
100
+ if (!this.r_R2()) {
101
+ return false;
102
+ }
103
+ // delete, line 111
104
+ if (!this.slice_del()) {
105
+ return false;
106
+ }
107
+ break;
108
+ case 2: {
109
+ // (, line 113
110
+ // call R2, line 113
111
+ if (!this.r_R2()) {
112
+ return false;
113
+ }
114
+ // delete, line 113
115
+ if (!this.slice_del()) {
116
+ return false;
117
+ }
118
+ // try, line 114
119
+ v_1 = this.limit - this.cursor;
120
+ let lab0 = true;
121
+ while (lab0 === true) {
122
+ lab0 = false;
123
+ // (, line 114
124
+ // [, line 114
125
+ this.ket = this.cursor;
126
+ // literal, line 114
127
+ if (!this.eq_s_b(2, "ic")) {
128
+ this.cursor = this.limit - v_1;
129
+ break;
130
+ }
131
+ // ], line 114
132
+ this.bra = this.cursor;
133
+ // call R2, line 114
134
+ if (!this.r_R2()) {
135
+ this.cursor = this.limit - v_1;
136
+ break;
137
+ }
138
+ // delete, line 114
139
+ if (!this.slice_del()) {
140
+ return false;
141
+ }
142
+ }
143
+ break;
144
+ }
145
+ case 3:
146
+ // (, line 117
147
+ // call R2, line 117
148
+ if (!this.r_R2()) {
149
+ return false;
150
+ }
151
+ // <-, line 117
152
+ if (!this.slice_from("log")) {
153
+ return false;
154
+ }
155
+ break;
156
+ case 4:
157
+ // (, line 119
158
+ // call R2, line 119
159
+ if (!this.r_R2()) {
160
+ return false;
161
+ }
162
+ // <-, line 119
163
+ if (!this.slice_from("u")) {
164
+ return false;
165
+ }
166
+ break;
167
+ case 5:
168
+ // (, line 121
169
+ // call R2, line 121
170
+ if (!this.r_R2()) {
171
+ return false;
172
+ }
173
+ // <-, line 121
174
+ if (!this.slice_from("ente")) {
175
+ return false;
176
+ }
177
+ break;
178
+ case 6:
179
+ // (, line 123
180
+ // call RV, line 123
181
+ if (!this.r_RV()) {
182
+ return false;
183
+ }
184
+ // delete, line 123
185
+ if (!this.slice_del()) {
186
+ return false;
187
+ }
188
+ break;
189
+ case 7: {
190
+ // (, line 124
191
+ // call R1, line 125
192
+ if (!this.r_R1()) {
193
+ return false;
194
+ }
195
+ // delete, line 125
196
+ if (!this.slice_del()) {
197
+ return false;
198
+ }
199
+ // try, line 126
200
+ v_2 = this.limit - this.cursor;
201
+ let lab1 = true;
202
+ label1: while (lab1 === true) {
203
+ lab1 = false;
204
+ // (, line 126
205
+ // [, line 127
206
+ this.ket = this.cursor;
207
+ // substring, line 127
208
+ among_var = this.find_among_b(tables.a_4, 4);
209
+ if (among_var === 0) {
210
+ this.cursor = this.limit - v_2;
211
+ break;
212
+ }
213
+ // ], line 127
214
+ this.bra = this.cursor;
215
+ // call R2, line 127
216
+ if (!this.r_R2()) {
217
+ this.cursor = this.limit - v_2;
218
+ break;
219
+ }
220
+ // delete, line 127
221
+ if (!this.slice_del()) {
222
+ return false;
223
+ }
224
+ switch (among_var) {
225
+ case 0:
226
+ this.cursor = this.limit - v_2;
227
+ break label1;
228
+ case 1:
229
+ // (, line 128
230
+ // [, line 128
231
+ this.ket = this.cursor;
232
+ // literal, line 128
233
+ if (!this.eq_s_b(2, "at")) {
234
+ this.cursor = this.limit - v_2;
235
+ break label1;
236
+ }
237
+ // ], line 128
238
+ this.bra = this.cursor;
239
+ // call R2, line 128
240
+ if (!this.r_R2()) {
241
+ this.cursor = this.limit - v_2;
242
+ break label1;
243
+ }
244
+ // delete, line 128
245
+ if (!this.slice_del()) {
246
+ return false;
247
+ }
248
+ break;
249
+ }
250
+ }
251
+ break;
252
+ }
253
+ case 8: {
254
+ // (, line 133
255
+ // call R2, line 134
256
+ if (!this.r_R2()) {
257
+ return false;
258
+ }
259
+ // delete, line 134
260
+ if (!this.slice_del()) {
261
+ return false;
262
+ }
263
+ // try, line 135
264
+ v_3 = this.limit - this.cursor;
265
+ let lab2 = true;
266
+ label2: while (lab2 === true) {
267
+ lab2 = false;
268
+ // (, line 135
269
+ // [, line 136
270
+ this.ket = this.cursor;
271
+ // substring, line 136
272
+ among_var = this.find_among_b(tables.a_5, 3);
273
+ if (among_var === 0) {
274
+ this.cursor = this.limit - v_3;
275
+ break;
276
+ }
277
+ // ], line 136
278
+ this.bra = this.cursor;
279
+ switch (among_var) {
280
+ case 0:
281
+ this.cursor = this.limit - v_3;
282
+ break label2;
283
+ case 1:
284
+ // (, line 137
285
+ // call R2, line 137
286
+ if (!this.r_R2()) {
287
+ this.cursor = this.limit - v_3;
288
+ break label2;
289
+ }
290
+ // delete, line 137
291
+ if (!this.slice_del()) {
292
+ return false;
293
+ }
294
+ break;
295
+ }
296
+ }
297
+ break;
298
+ }
299
+ case 9: {
300
+ // (, line 141
301
+ // call R2, line 142
302
+ if (!this.r_R2()) {
303
+ return false;
304
+ }
305
+ // delete, line 142
306
+ if (!this.slice_del()) {
307
+ return false;
308
+ }
309
+ // try, line 143
310
+ v_4 = this.limit - this.cursor;
311
+ let lab3 = true;
312
+ while (lab3 === true) {
313
+ lab3 = false;
314
+ // (, line 143
315
+ // [, line 143
316
+ this.ket = this.cursor;
317
+ // literal, line 143
318
+ if (!this.eq_s_b(2, "at")) {
319
+ this.cursor = this.limit - v_4;
320
+ break;
321
+ }
322
+ // ], line 143
323
+ this.bra = this.cursor;
324
+ // call R2, line 143
325
+ if (!this.r_R2()) {
326
+ this.cursor = this.limit - v_4;
327
+ break;
328
+ }
329
+ // delete, line 143
330
+ if (!this.slice_del()) {
331
+ return false;
332
+ }
333
+ // [, line 143
334
+ this.ket = this.cursor;
335
+ // literal, line 143
336
+ if (!this.eq_s_b(2, "ic")) {
337
+ this.cursor = this.limit - v_4;
338
+ break;
339
+ }
340
+ // ], line 143
341
+ this.bra = this.cursor;
342
+ // call R2, line 143
343
+ if (!this.r_R2()) {
344
+ this.cursor = this.limit - v_4;
345
+ break;
346
+ }
347
+ // delete, line 143
348
+ if (!this.slice_del()) {
349
+ return false;
350
+ }
351
+ }
352
+ break;
353
+ }
354
+ }
355
+ return true;
356
+ },
357
+
358
+ r_verb_suffix() {
359
+ // setlimit, line 148
360
+ const v_1 = this.limit - this.cursor;
361
+ // tomark, line 148
362
+ if (this.cursor < this.I_pV) {
363
+ return false;
364
+ }
365
+ this.cursor = this.I_pV;
366
+ const v_2 = this.limit_backward;
367
+ this.limit_backward = this.cursor;
368
+ this.cursor = this.limit - v_1;
369
+ // (, line 148
370
+ // [, line 149
371
+ this.ket = this.cursor;
372
+ // substring, line 149
373
+ const among_var = this.find_among_b(tables.a_7, 87);
374
+ if (among_var === 0) {
375
+ this.limit_backward = v_2;
376
+ return false;
377
+ }
378
+ // ], line 149
379
+ this.bra = this.cursor;
380
+ switch (among_var) {
381
+ case 0:
382
+ this.limit_backward = v_2;
383
+ return false;
384
+ case 1:
385
+ // (, line 163
386
+ // delete, line 163
387
+ if (!this.slice_del()) {
388
+ return false;
389
+ }
390
+ break;
391
+ }
392
+ this.limit_backward = v_2;
393
+ return true;
394
+ },
395
+
396
+ r_vowel_suffix() {
397
+ // (, line 170
398
+ // try, line 171
399
+ const v_1 = this.limit - this.cursor;
400
+ let lab0 = true;
401
+ while (lab0 === true) {
402
+ lab0 = false;
403
+ // (, line 171
404
+ // [, line 172
405
+ this.ket = this.cursor;
406
+ if (!this.in_grouping_b(tables.g_AEIO, 97, 242)) {
407
+ this.cursor = this.limit - v_1;
408
+ break;
409
+ }
410
+ // ], line 172
411
+ this.bra = this.cursor;
412
+ // call RV, line 172
413
+ if (!this.r_RV()) {
414
+ this.cursor = this.limit - v_1;
415
+ break;
416
+ }
417
+ // delete, line 172
418
+ if (!this.slice_del()) {
419
+ return false;
420
+ }
421
+ // [, line 173
422
+ this.ket = this.cursor;
423
+ // literal, line 173
424
+ if (!this.eq_s_b(1, "i")) {
425
+ this.cursor = this.limit - v_1;
426
+ break;
427
+ }
428
+ // ], line 173
429
+ this.bra = this.cursor;
430
+ // call RV, line 173
431
+ if (!this.r_RV()) {
432
+ this.cursor = this.limit - v_1;
433
+ break;
434
+ }
435
+ // delete, line 173
436
+ if (!this.slice_del()) {
437
+ return false;
438
+ }
439
+ }
440
+ // try, line 175
441
+ const v_2 = this.limit - this.cursor;
442
+ let lab1 = true;
443
+ while (lab1 === true) {
444
+ lab1 = false;
445
+ // (, line 175
446
+ // [, line 176
447
+ this.ket = this.cursor;
448
+ // literal, line 176
449
+ if (!this.eq_s_b(1, "h")) {
450
+ this.cursor = this.limit - v_2;
451
+ break;
452
+ }
453
+ // ], line 176
454
+ this.bra = this.cursor;
455
+ if (!this.in_grouping_b(tables.g_CG, 99, 103)) {
456
+ this.cursor = this.limit - v_2;
457
+ break;
458
+ }
459
+ // call RV, line 176
460
+ if (!this.r_RV()) {
461
+ this.cursor = this.limit - v_2;
462
+ break;
463
+ }
464
+ // delete, line 176
465
+ if (!this.slice_del()) {
466
+ return false;
467
+ }
468
+ }
469
+ return true;
470
+ },
471
+ };