@mfdaves/okf-mcp 0.9.1 → 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 +172 -17
  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,456 @@
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-en-min 4.26.1, src/stemmer-en.js (MIT,
25
+ // header above), itself generated by the Snowball compiler from the
26
+ // Snowball English (Porter2) 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("./en-tables");
35
+
36
+ module.exports = {
37
+ r_prelude() {
38
+ let v_4;
39
+ let v_5;
40
+ // (, line 25
41
+ // unset Y_found, line 26
42
+ this.B_Y_found = false;
43
+ // do, line 27
44
+ const v_1 = this.cursor;
45
+ let lab0 = true;
46
+ while (lab0 === true) {
47
+ lab0 = false;
48
+ // (, line 27
49
+ // [, line 27
50
+ this.bra = this.cursor;
51
+ // literal, line 27
52
+ if (!this.eq_s("'")) {
53
+ break;
54
+ }
55
+ // ], line 27
56
+ this.ket = this.cursor;
57
+ // delete, line 27
58
+ if (!this.slice_del()) {
59
+ return false;
60
+ }
61
+ }
62
+ this.cursor = v_1;
63
+ // do, line 28
64
+ const v_2 = this.cursor;
65
+ let lab1 = true;
66
+ while (lab1 === true) {
67
+ lab1 = false;
68
+ // (, line 28
69
+ // [, line 28
70
+ this.bra = this.cursor;
71
+ // literal, line 28
72
+ if (!this.eq_s("y")) {
73
+ break;
74
+ }
75
+ // ], line 28
76
+ this.ket = this.cursor;
77
+ // <-, line 28
78
+ if (!this.slice_from("Y")) {
79
+ return false;
80
+ }
81
+ // set Y_found, line 28
82
+ this.B_Y_found = true;
83
+ }
84
+ this.cursor = v_2;
85
+ // do, line 29
86
+ const v_3 = this.cursor;
87
+ let lab2 = true;
88
+ while (lab2 === true) {
89
+ lab2 = false;
90
+ // repeat, line 29
91
+ replab3: while (true) {
92
+ v_4 = this.cursor;
93
+ let lab4 = true;
94
+ label4: while (lab4 === true) {
95
+ lab4 = false;
96
+ // (, line 29
97
+ // goto, line 29
98
+ golab5: while (true) {
99
+ v_5 = this.cursor;
100
+ let lab6 = true;
101
+ while (lab6 === true) {
102
+ lab6 = false;
103
+ // (, line 29
104
+ if (!this.in_grouping(tables.g_v, 97, 121)) {
105
+ break;
106
+ }
107
+ // [, line 29
108
+ this.bra = this.cursor;
109
+ // literal, line 29
110
+ if (!this.eq_s("y")) {
111
+ break;
112
+ }
113
+ // ], line 29
114
+ this.ket = this.cursor;
115
+ this.cursor = v_5;
116
+ break golab5;
117
+ }
118
+ this.cursor = v_5;
119
+ if (this.cursor >= this.limit) {
120
+ break label4;
121
+ }
122
+ this.cursor++;
123
+ }
124
+ // <-, line 29
125
+ if (!this.slice_from("Y")) {
126
+ return false;
127
+ }
128
+ // set Y_found, line 29
129
+ this.B_Y_found = true;
130
+ continue replab3;
131
+ }
132
+ this.cursor = v_4;
133
+ break;
134
+ }
135
+ }
136
+ this.cursor = v_3;
137
+ return true;
138
+ },
139
+
140
+ r_mark_regions() {
141
+ let v_2;
142
+ // (, line 32
143
+ this.I_p1 = this.limit;
144
+ this.I_p2 = this.limit;
145
+ // do, line 35
146
+ const v_1 = this.cursor;
147
+ let lab0 = true;
148
+ label0: while (lab0 === true) {
149
+ lab0 = false;
150
+ // (, line 35
151
+ // or, line 41
152
+ let lab1 = true;
153
+ label1: while (lab1 === true) {
154
+ lab1 = false;
155
+ v_2 = this.cursor;
156
+ let lab2 = true;
157
+ while (lab2 === true) {
158
+ lab2 = false;
159
+ // among, line 36
160
+ if (this.find_among(tables.a_0, 3) === 0) {
161
+ break;
162
+ }
163
+ break label1;
164
+ }
165
+ this.cursor = v_2;
166
+ // (, line 41
167
+ // gopast, line 41
168
+ golab3: while (true) {
169
+ let lab4 = true;
170
+ while (lab4 === true) {
171
+ lab4 = false;
172
+ if (!this.in_grouping(tables.g_v, 97, 121)) {
173
+ break;
174
+ }
175
+ break golab3;
176
+ }
177
+ if (this.cursor >= this.limit) {
178
+ break label0;
179
+ }
180
+ this.cursor++;
181
+ }
182
+ // gopast, line 41
183
+ golab5: while (true) {
184
+ let lab6 = true;
185
+ while (lab6 === true) {
186
+ lab6 = false;
187
+ if (!this.out_grouping(tables.g_v, 97, 121)) {
188
+ break;
189
+ }
190
+ break golab5;
191
+ }
192
+ if (this.cursor >= this.limit) {
193
+ break label0;
194
+ }
195
+ this.cursor++;
196
+ }
197
+ }
198
+ // setmark p1, line 42
199
+ this.I_p1 = this.cursor;
200
+ // gopast, line 43
201
+ golab7: while (true) {
202
+ let lab8 = true;
203
+ while (lab8 === true) {
204
+ lab8 = false;
205
+ if (!this.in_grouping(tables.g_v, 97, 121)) {
206
+ break;
207
+ }
208
+ break golab7;
209
+ }
210
+ if (this.cursor >= this.limit) {
211
+ break label0;
212
+ }
213
+ this.cursor++;
214
+ }
215
+ // gopast, line 43
216
+ golab9: while (true) {
217
+ let lab10 = true;
218
+ while (lab10 === true) {
219
+ lab10 = false;
220
+ if (!this.out_grouping(tables.g_v, 97, 121)) {
221
+ break;
222
+ }
223
+ break golab9;
224
+ }
225
+ if (this.cursor >= this.limit) {
226
+ break label0;
227
+ }
228
+ this.cursor++;
229
+ }
230
+ // setmark p2, line 43
231
+ this.I_p2 = this.cursor;
232
+ }
233
+ this.cursor = v_1;
234
+ return true;
235
+ },
236
+
237
+ r_shortv() {
238
+ let v_1;
239
+ // (, line 49
240
+ // or, line 51
241
+ let lab0 = true;
242
+ label0: while (lab0 === true) {
243
+ lab0 = false;
244
+ v_1 = this.limit - this.cursor;
245
+ let lab1 = true;
246
+ while (lab1 === true) {
247
+ lab1 = false;
248
+ // (, line 50
249
+ if (!this.out_grouping_b(tables.g_v_WXY, 89, 121)) {
250
+ break;
251
+ }
252
+ if (!this.in_grouping_b(tables.g_v, 97, 121)) {
253
+ break;
254
+ }
255
+ if (!this.out_grouping_b(tables.g_v, 97, 121)) {
256
+ break;
257
+ }
258
+ break label0;
259
+ }
260
+ this.cursor = this.limit - v_1;
261
+ // (, line 52
262
+ if (!this.out_grouping_b(tables.g_v, 97, 121)) {
263
+ return false;
264
+ }
265
+ if (!this.in_grouping_b(tables.g_v, 97, 121)) {
266
+ return false;
267
+ }
268
+ // atlimit, line 52
269
+ if (this.cursor > this.limit_backward) {
270
+ return false;
271
+ }
272
+ }
273
+ return true;
274
+ },
275
+
276
+ r_R1() {
277
+ if (!(this.I_p1 <= this.cursor)) {
278
+ return false;
279
+ }
280
+ return true;
281
+ },
282
+
283
+ r_R2() {
284
+ if (!(this.I_p2 <= this.cursor)) {
285
+ return false;
286
+ }
287
+ return true;
288
+ },
289
+
290
+ r_postlude() {
291
+ let v_1;
292
+ let v_2;
293
+ // (, line 203
294
+ // Boolean test Y_found, line 203
295
+ if (!this.B_Y_found) {
296
+ return false;
297
+ }
298
+ // repeat, line 203
299
+ replab0: while (true) {
300
+ v_1 = this.cursor;
301
+ let lab1 = true;
302
+ label1: while (lab1 === true) {
303
+ lab1 = false;
304
+ // (, line 203
305
+ // goto, line 203
306
+ golab2: while (true) {
307
+ v_2 = this.cursor;
308
+ let lab3 = true;
309
+ while (lab3 === true) {
310
+ lab3 = false;
311
+ // (, line 203
312
+ // [, line 203
313
+ this.bra = this.cursor;
314
+ // literal, line 203
315
+ if (!this.eq_s("Y")) {
316
+ break;
317
+ }
318
+ // ], line 203
319
+ this.ket = this.cursor;
320
+ this.cursor = v_2;
321
+ break golab2;
322
+ }
323
+ this.cursor = v_2;
324
+ if (this.cursor >= this.limit) {
325
+ break label1;
326
+ }
327
+ this.cursor++;
328
+ }
329
+ // <-, line 203
330
+ if (!this.slice_from("y")) {
331
+ return false;
332
+ }
333
+ continue replab0;
334
+ }
335
+ this.cursor = v_1;
336
+ break;
337
+ }
338
+ return true;
339
+ },
340
+
341
+ r_exception2() {
342
+ // (, line 156
343
+ // [, line 158
344
+ this.ket = this.cursor;
345
+ // substring, line 158
346
+ if (this.find_among_b(tables.a_9, 8) === 0) {
347
+ return false;
348
+ }
349
+ // ], line 158
350
+ this.bra = this.cursor;
351
+ // atlimit, line 158
352
+ if (this.cursor > this.limit_backward) {
353
+ return false;
354
+ }
355
+ return true;
356
+ },
357
+
358
+ r_exception1() {
359
+ // (, line 168
360
+ // [, line 170
361
+ this.bra = this.cursor;
362
+ // substring, line 170
363
+ const among_var = this.find_among(tables.a_10, 18);
364
+ if (among_var === 0) {
365
+ return false;
366
+ }
367
+ // ], line 170
368
+ this.ket = this.cursor;
369
+ // atlimit, line 170
370
+ if (this.cursor < this.limit) {
371
+ return false;
372
+ }
373
+ switch (among_var) {
374
+ case 0:
375
+ return false;
376
+ case 1:
377
+ // (, line 174
378
+ // <-, line 174
379
+ if (!this.slice_from("ski")) {
380
+ return false;
381
+ }
382
+ break;
383
+ case 2:
384
+ // (, line 175
385
+ // <-, line 175
386
+ if (!this.slice_from("sky")) {
387
+ return false;
388
+ }
389
+ break;
390
+ case 3:
391
+ // (, line 176
392
+ // <-, line 176
393
+ if (!this.slice_from("die")) {
394
+ return false;
395
+ }
396
+ break;
397
+ case 4:
398
+ // (, line 177
399
+ // <-, line 177
400
+ if (!this.slice_from("lie")) {
401
+ return false;
402
+ }
403
+ break;
404
+ case 5:
405
+ // (, line 178
406
+ // <-, line 178
407
+ if (!this.slice_from("tie")) {
408
+ return false;
409
+ }
410
+ break;
411
+ case 6:
412
+ // (, line 182
413
+ // <-, line 182
414
+ if (!this.slice_from("idl")) {
415
+ return false;
416
+ }
417
+ break;
418
+ case 7:
419
+ // (, line 183
420
+ // <-, line 183
421
+ if (!this.slice_from("gentl")) {
422
+ return false;
423
+ }
424
+ break;
425
+ case 8:
426
+ // (, line 184
427
+ // <-, line 184
428
+ if (!this.slice_from("ugli")) {
429
+ return false;
430
+ }
431
+ break;
432
+ case 9:
433
+ // (, line 185
434
+ // <-, line 185
435
+ if (!this.slice_from("earli")) {
436
+ return false;
437
+ }
438
+ break;
439
+ case 10:
440
+ // (, line 186
441
+ // <-, line 186
442
+ if (!this.slice_from("onli")) {
443
+ return false;
444
+ }
445
+ break;
446
+ case 11:
447
+ // (, line 187
448
+ // <-, line 187
449
+ if (!this.slice_from("singl")) {
450
+ return false;
451
+ }
452
+ break;
453
+ }
454
+ return true;
455
+ },
456
+ };