@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,176 @@
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 suffix tables and character groupings.
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 Among = require("./among");
35
+
36
+ const tables = {};
37
+
38
+ tables.a_0 = [new Among("arsen", -1, -1), new Among("commun", -1, -1), new Among("gener", -1, -1)];
39
+
40
+ tables.a_1 = [new Among("'", -1, 1), new Among("'s'", 0, 1), new Among("'s", -1, 1)];
41
+
42
+ tables.a_2 = [
43
+ new Among("ied", -1, 2),
44
+ new Among("s", -1, 3),
45
+ new Among("ies", 1, 2),
46
+ new Among("sses", 1, 1),
47
+ new Among("ss", 1, -1),
48
+ new Among("us", 1, -1),
49
+ ];
50
+
51
+ tables.a_3 = [
52
+ new Among("", -1, 3),
53
+ new Among("bb", 0, 2),
54
+ new Among("dd", 0, 2),
55
+ new Among("ff", 0, 2),
56
+ new Among("gg", 0, 2),
57
+ new Among("bl", 0, 1),
58
+ new Among("mm", 0, 2),
59
+ new Among("nn", 0, 2),
60
+ new Among("pp", 0, 2),
61
+ new Among("rr", 0, 2),
62
+ new Among("at", 0, 1),
63
+ new Among("tt", 0, 2),
64
+ new Among("iz", 0, 1),
65
+ ];
66
+
67
+ tables.a_4 = [
68
+ new Among("ed", -1, 2),
69
+ new Among("eed", 0, 1),
70
+ new Among("ing", -1, 2),
71
+ new Among("edly", -1, 2),
72
+ new Among("eedly", 3, 1),
73
+ new Among("ingly", -1, 2),
74
+ ];
75
+
76
+ tables.a_5 = [
77
+ new Among("anci", -1, 3),
78
+ new Among("enci", -1, 2),
79
+ new Among("ogi", -1, 13),
80
+ new Among("li", -1, 16),
81
+ new Among("bli", 3, 12),
82
+ new Among("abli", 4, 4),
83
+ new Among("alli", 3, 8),
84
+ new Among("fulli", 3, 14),
85
+ new Among("lessli", 3, 15),
86
+ new Among("ousli", 3, 10),
87
+ new Among("entli", 3, 5),
88
+ new Among("aliti", -1, 8),
89
+ new Among("biliti", -1, 12),
90
+ new Among("iviti", -1, 11),
91
+ new Among("tional", -1, 1),
92
+ new Among("ational", 14, 7),
93
+ new Among("alism", -1, 8),
94
+ new Among("ation", -1, 7),
95
+ new Among("ization", 17, 6),
96
+ new Among("izer", -1, 6),
97
+ new Among("ator", -1, 7),
98
+ new Among("iveness", -1, 11),
99
+ new Among("fulness", -1, 9),
100
+ new Among("ousness", -1, 10),
101
+ ];
102
+
103
+ tables.a_6 = [
104
+ new Among("icate", -1, 4),
105
+ new Among("ative", -1, 6),
106
+ new Among("alize", -1, 3),
107
+ new Among("iciti", -1, 4),
108
+ new Among("ical", -1, 4),
109
+ new Among("tional", -1, 1),
110
+ new Among("ational", 5, 2),
111
+ new Among("ful", -1, 5),
112
+ new Among("ness", -1, 5),
113
+ ];
114
+
115
+ tables.a_7 = [
116
+ new Among("ic", -1, 1),
117
+ new Among("ance", -1, 1),
118
+ new Among("ence", -1, 1),
119
+ new Among("able", -1, 1),
120
+ new Among("ible", -1, 1),
121
+ new Among("ate", -1, 1),
122
+ new Among("ive", -1, 1),
123
+ new Among("ize", -1, 1),
124
+ new Among("iti", -1, 1),
125
+ new Among("al", -1, 1),
126
+ new Among("ism", -1, 1),
127
+ new Among("ion", -1, 2),
128
+ new Among("er", -1, 1),
129
+ new Among("ous", -1, 1),
130
+ new Among("ant", -1, 1),
131
+ new Among("ent", -1, 1),
132
+ new Among("ment", 15, 1),
133
+ new Among("ement", 16, 1),
134
+ ];
135
+
136
+ tables.a_8 = [new Among("e", -1, 1), new Among("l", -1, 2)];
137
+
138
+ tables.a_9 = [
139
+ new Among("succeed", -1, -1),
140
+ new Among("proceed", -1, -1),
141
+ new Among("exceed", -1, -1),
142
+ new Among("canning", -1, -1),
143
+ new Among("inning", -1, -1),
144
+ new Among("earring", -1, -1),
145
+ new Among("herring", -1, -1),
146
+ new Among("outing", -1, -1),
147
+ ];
148
+
149
+ tables.a_10 = [
150
+ new Among("andes", -1, -1),
151
+ new Among("atlas", -1, -1),
152
+ new Among("bias", -1, -1),
153
+ new Among("cosmos", -1, -1),
154
+ new Among("dying", -1, 3),
155
+ new Among("early", -1, 9),
156
+ new Among("gently", -1, 7),
157
+ new Among("howe", -1, -1),
158
+ new Among("idly", -1, 6),
159
+ new Among("lying", -1, 4),
160
+ new Among("news", -1, -1),
161
+ new Among("only", -1, 10),
162
+ new Among("singly", -1, 11),
163
+ new Among("skies", -1, 2),
164
+ new Among("skis", -1, 1),
165
+ new Among("sky", -1, -1),
166
+ new Among("tying", -1, 5),
167
+ new Among("ugly", -1, 8),
168
+ ];
169
+
170
+ tables.g_v = [17, 65, 16, 1];
171
+
172
+ tables.g_v_WXY = [1, 17, 65, 208, 1];
173
+
174
+ tables.g_valid_LI = [55, 141, 2];
175
+
176
+ module.exports = tables;
@@ -0,0 +1,238 @@
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 class with its entry point.
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 BaseStemmer = require("./base-stemmer");
35
+
36
+ class StemmerEn extends BaseStemmer {
37
+ constructor() {
38
+ super();
39
+ this.name = "stemmer-en";
40
+ this.B_Y_found = false;
41
+ this.I_p2 = 0;
42
+ this.I_p1 = 0;
43
+ }
44
+
45
+ innerStem() {
46
+ let v_1;
47
+ let v_2;
48
+ let v_3;
49
+ let v_4;
50
+ let v_5;
51
+ let v_6;
52
+ let v_7;
53
+ let v_8;
54
+ let v_9;
55
+ let v_10;
56
+ let v_11;
57
+ let v_12;
58
+ let v_13;
59
+ // (, line 205
60
+ // or, line 207
61
+ let lab0 = true;
62
+ label0: while (lab0 === true) {
63
+ lab0 = false;
64
+ v_1 = this.cursor;
65
+ let lab1 = true;
66
+ while (lab1 === true) {
67
+ lab1 = false;
68
+ // call exception1, line 207
69
+ if (!this.r_exception1()) {
70
+ break;
71
+ }
72
+ break label0;
73
+ }
74
+ this.cursor = v_1;
75
+ let lab2 = true;
76
+ label2: while (lab2 === true) {
77
+ lab2 = false;
78
+ // not, line 208
79
+ {
80
+ v_2 = this.cursor;
81
+ let lab3 = true;
82
+ while (lab3 === true) {
83
+ lab3 = false;
84
+ // hop, line 208
85
+ {
86
+ const c = this.cursor + 3;
87
+ if (c < 0 || c > this.limit) {
88
+ break;
89
+ }
90
+ this.cursor = c;
91
+ }
92
+ break label2;
93
+ }
94
+ this.cursor = v_2;
95
+ }
96
+ break label0;
97
+ }
98
+ this.cursor = v_1;
99
+ // (, line 208
100
+ // do, line 209
101
+ v_3 = this.cursor;
102
+ let lab4 = true;
103
+ while (lab4 === true) {
104
+ lab4 = false;
105
+ // call prelude, line 209
106
+ if (!this.r_prelude()) {
107
+ break;
108
+ }
109
+ }
110
+ this.cursor = v_3;
111
+ // do, line 210
112
+ v_4 = this.cursor;
113
+ let lab5 = true;
114
+ while (lab5 === true) {
115
+ lab5 = false;
116
+ // call mark_regions, line 210
117
+ if (!this.r_mark_regions()) {
118
+ break;
119
+ }
120
+ }
121
+ this.cursor = v_4;
122
+ // backwards, line 211
123
+ this.limit_backward = this.cursor;
124
+ this.cursor = this.limit;
125
+ // (, line 211
126
+ // do, line 213
127
+ v_5 = this.limit - this.cursor;
128
+ let lab6 = true;
129
+ while (lab6 === true) {
130
+ lab6 = false;
131
+ // call Step_1a, line 213
132
+ if (!this.r_Step_1a()) {
133
+ break;
134
+ }
135
+ }
136
+ this.cursor = this.limit - v_5;
137
+ // or, line 215
138
+ let lab7 = true;
139
+ label7: while (lab7 === true) {
140
+ lab7 = false;
141
+ v_6 = this.limit - this.cursor;
142
+ let lab8 = true;
143
+ while (lab8 === true) {
144
+ lab8 = false;
145
+ // call exception2, line 215
146
+ if (!this.r_exception2()) {
147
+ break;
148
+ }
149
+ break label7;
150
+ }
151
+ this.cursor = this.limit - v_6;
152
+ // (, line 215
153
+ // do, line 217
154
+ v_7 = this.limit - this.cursor;
155
+ let lab9 = true;
156
+ while (lab9 === true) {
157
+ lab9 = false;
158
+ // call Step_1b, line 217
159
+ if (!this.r_Step_1b()) {
160
+ break;
161
+ }
162
+ }
163
+ this.cursor = this.limit - v_7;
164
+ // do, line 218
165
+ v_8 = this.limit - this.cursor;
166
+ let lab10 = true;
167
+ while (lab10 === true) {
168
+ lab10 = false;
169
+ // call Step_1c, line 218
170
+ if (!this.r_Step_1c()) {
171
+ break;
172
+ }
173
+ }
174
+ this.cursor = this.limit - v_8;
175
+ // do, line 220
176
+ v_9 = this.limit - this.cursor;
177
+ let lab11 = true;
178
+ while (lab11 === true) {
179
+ lab11 = false;
180
+ // call Step_2, line 220
181
+ if (!this.r_Step_2()) {
182
+ break;
183
+ }
184
+ }
185
+ this.cursor = this.limit - v_9;
186
+ // do, line 221
187
+ v_10 = this.limit - this.cursor;
188
+ let lab12 = true;
189
+ while (lab12 === true) {
190
+ lab12 = false;
191
+ // call Step_3, line 221
192
+ if (!this.r_Step_3()) {
193
+ break;
194
+ }
195
+ }
196
+ this.cursor = this.limit - v_10;
197
+ // do, line 222
198
+ v_11 = this.limit - this.cursor;
199
+ let lab13 = true;
200
+ while (lab13 === true) {
201
+ lab13 = false;
202
+ // call Step_4, line 222
203
+ if (!this.r_Step_4()) {
204
+ break;
205
+ }
206
+ }
207
+ this.cursor = this.limit - v_11;
208
+ // do, line 224
209
+ v_12 = this.limit - this.cursor;
210
+ let lab14 = true;
211
+ while (lab14 === true) {
212
+ lab14 = false;
213
+ // call Step_5, line 224
214
+ if (!this.r_Step_5()) {
215
+ break;
216
+ }
217
+ }
218
+ this.cursor = this.limit - v_12;
219
+ }
220
+ this.cursor = this.limit_backward; // do, line 227
221
+ v_13 = this.cursor;
222
+ let lab15 = true;
223
+ while (lab15 === true) {
224
+ lab15 = false;
225
+ // call postlude, line 227
226
+ if (!this.r_postlude()) {
227
+ break;
228
+ }
229
+ }
230
+ this.cursor = v_13;
231
+ }
232
+ return true;
233
+ }
234
+ }
235
+
236
+ Object.assign(StemmerEn.prototype, require("./en-regions"), require("./en-suffixes"));
237
+
238
+ module.exports = StemmerEn;