@objectstack/knowledge-ragflow 17.2.0 → 17.4.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,491 @@
1
1
  # @objectstack/knowledge-ragflow
2
2
 
3
+ ## 17.4.0
4
+
5
+ ### Patch Changes
6
+
7
+ - be92d46: These fourteen packages now declare `repository.directory`, so their npm pages carry a working "source" deep link to their own directory in the monorepo.
8
+
9
+ npm renders that field by concatenating it onto `repository.url`. None of these fourteen manifests carried a `repository` block at all, so every one of their npm pages offered no route from the package back to its code — not a broken link, no link. That is what this publishes: the block those pages read, naming each package's own directory.
10
+
11
+ Nothing else about these packages changes. No export, no runtime behaviour, no dependency and no file in the tarball other than the manifest's own `repository` key. The version bump exists because the fix is only real once it is published: the field lives in the manifest npm serves, so a corrected manifest sitting in the repository leaves the package page exactly as wrong as it was.
12
+
13
+ The rule behind it is now mechanical rather than remembered — `check:manifest-repository-directory` makes a publishable (non-private) workspace manifest declare the field naming its own directory, so a package added or moved after this cannot quietly go back to having no source link.
14
+ - Updated dependencies [fe0d9a4]
15
+ - Updated dependencies [ecd2158]
16
+ - Updated dependencies [f2b5e46]
17
+ - Updated dependencies [2ed6be6]
18
+ - Updated dependencies [ed7243d]
19
+ - Updated dependencies [6ba0db4]
20
+ - Updated dependencies [625b0c3]
21
+ - Updated dependencies [233222e]
22
+ - Updated dependencies [07f40e5]
23
+ - Updated dependencies [ceb4877]
24
+ - Updated dependencies [e9fcd6b]
25
+ - Updated dependencies [90e7e6d]
26
+ - Updated dependencies [2bdabe6]
27
+ - Updated dependencies [ca326b5]
28
+ - Updated dependencies [8f404a5]
29
+ - Updated dependencies [68437d4]
30
+ - Updated dependencies [abb140c]
31
+ - Updated dependencies [8333a6c]
32
+ - Updated dependencies [3e3ecb0]
33
+ - Updated dependencies [3030369]
34
+ - Updated dependencies [d5d8d50]
35
+ - Updated dependencies [e08892d]
36
+ - Updated dependencies [ae05f2e]
37
+ - Updated dependencies [b548e43]
38
+ - Updated dependencies [c463d03]
39
+ - Updated dependencies [64bd6a3]
40
+ - Updated dependencies [13c48c2]
41
+ - Updated dependencies [b0529e1]
42
+ - Updated dependencies [66dc6ab]
43
+ - Updated dependencies [6f94458]
44
+ - Updated dependencies [6e67b86]
45
+ - Updated dependencies [132742f]
46
+ - Updated dependencies [85a2459]
47
+ - Updated dependencies [50dc214]
48
+ - Updated dependencies [e89fa92]
49
+ - Updated dependencies [e9fcd6b]
50
+ - Updated dependencies [8976ea1]
51
+ - Updated dependencies [56fe8c2]
52
+ - Updated dependencies [acabd24]
53
+ - Updated dependencies [ab50c8f]
54
+ - Updated dependencies [6491463]
55
+ - Updated dependencies [89cf4d6]
56
+ - Updated dependencies [21c5dcb]
57
+ - Updated dependencies [6d4d5d3]
58
+ - Updated dependencies [ed5d557]
59
+ - Updated dependencies [bca21f7]
60
+ - Updated dependencies [e9fcd6b]
61
+ - Updated dependencies [2025b1f]
62
+ - Updated dependencies [1a7a7c9]
63
+ - Updated dependencies [e9fcd6b]
64
+ - Updated dependencies [ef3a138]
65
+ - Updated dependencies [68d5dfd]
66
+ - Updated dependencies [3e21cf0]
67
+ - Updated dependencies [4cfc93b]
68
+ - Updated dependencies [efd6b43]
69
+ - Updated dependencies [859ded3]
70
+ - Updated dependencies [fa125f3]
71
+ - Updated dependencies [74628d9]
72
+ - Updated dependencies [a646120]
73
+ - Updated dependencies [6f1ce7d]
74
+ - Updated dependencies [7778115]
75
+ - Updated dependencies [2c753fe]
76
+ - Updated dependencies [52804cd]
77
+ - Updated dependencies [3f89967]
78
+ - Updated dependencies [53cf263]
79
+ - Updated dependencies [21aabbc]
80
+ - Updated dependencies [9c270bb]
81
+ - Updated dependencies [76c8c5a]
82
+ - Updated dependencies [a84e1ce]
83
+ - Updated dependencies [bf1054a]
84
+ - Updated dependencies [d8d2776]
85
+ - Updated dependencies [222dc0f]
86
+ - Updated dependencies [e9fcd6b]
87
+ - Updated dependencies [32c917d]
88
+ - Updated dependencies [f9a3c32]
89
+ - Updated dependencies [f502898]
90
+ - Updated dependencies [51ae731]
91
+ - Updated dependencies [af7edfe]
92
+ - Updated dependencies [b60f48b]
93
+ - Updated dependencies [c78c918]
94
+ - Updated dependencies [cf9bda4]
95
+ - Updated dependencies [784cb92]
96
+ - Updated dependencies [7629f4d]
97
+ - Updated dependencies [51df9fd]
98
+ - Updated dependencies [a7da4de]
99
+ - Updated dependencies [de0bcdd]
100
+ - Updated dependencies [70f7d6d]
101
+ - Updated dependencies [c677cda]
102
+ - Updated dependencies [554a160]
103
+ - Updated dependencies [f7da71e]
104
+ - Updated dependencies [7f745c3]
105
+ - Updated dependencies [5eb24f8]
106
+ - Updated dependencies [2a3decc]
107
+ - Updated dependencies [cc00df2]
108
+ - Updated dependencies [cc00df2]
109
+ - Updated dependencies [f4e6adf]
110
+ - Updated dependencies [ee4a59b]
111
+ - Updated dependencies [4db3c61]
112
+ - Updated dependencies [5ca314a]
113
+ - Updated dependencies [e0af1a8]
114
+ - Updated dependencies [4771bd9]
115
+ - Updated dependencies [414c1fc]
116
+ - Updated dependencies [22c0279]
117
+ - Updated dependencies [0db2947]
118
+ - Updated dependencies [92b5d7f]
119
+ - Updated dependencies [613bfbd]
120
+ - Updated dependencies [abae16a]
121
+ - Updated dependencies [094b8fd]
122
+ - Updated dependencies [c7aca0d]
123
+ - Updated dependencies [c1d8f98]
124
+ - Updated dependencies [8e0b297]
125
+ - Updated dependencies [d4f9b2a]
126
+ - Updated dependencies [5f7fa1d]
127
+ - Updated dependencies [87f0ccc]
128
+ - Updated dependencies [aedbaef]
129
+ - Updated dependencies [a727043]
130
+ - Updated dependencies [c5d6803]
131
+ - Updated dependencies [10d05bb]
132
+ - Updated dependencies [69602e5]
133
+ - Updated dependencies [c3ce76c]
134
+ - Updated dependencies [7936b29]
135
+ - Updated dependencies [46803fa]
136
+ - Updated dependencies [c2a336c]
137
+ - Updated dependencies [9f890d3]
138
+ - Updated dependencies [0bb2318]
139
+ - Updated dependencies [f7db8f4]
140
+ - Updated dependencies [1ecee3e]
141
+ - Updated dependencies [9408b7f]
142
+ - Updated dependencies [e9fcd6b]
143
+ - Updated dependencies [9bcd9be]
144
+ - Updated dependencies [b398ad2]
145
+ - Updated dependencies [99261a7]
146
+ - Updated dependencies [81b426f]
147
+ - Updated dependencies [001af1c]
148
+ - Updated dependencies [fb77aa5]
149
+ - Updated dependencies [581d8f8]
150
+ - Updated dependencies [f81afe3]
151
+ - Updated dependencies [40a44b9]
152
+ - Updated dependencies [f89812e]
153
+ - Updated dependencies [7a7fb03]
154
+ - Updated dependencies [8fd246d]
155
+ - @objectstack/spec@17.4.0
156
+ - @objectstack/core@17.4.0
157
+ - @objectstack/service-knowledge@17.4.0
158
+
159
+ ## 17.3.0
160
+
161
+ ### Patch Changes
162
+
163
+ - ad54eb3: feat(tooling): onboard all 14 `packages/plugins/**` packages into `check:test-typecheck` (#14062)
164
+
165
+ Every plugin package now has a `tsconfig.test.json` compiled by the shared
166
+ `check:test-typecheck` gate, and its `typecheck` script names it. Before this,
167
+ the shrink-only `test-typecheck-debt.json` ratchet said **nothing** about a
168
+ third of the repo's runtime surface: 14 packages, 1 `tsconfig.test.json`
169
+ (`plugin-security`, wired directly to `tsc` rather than to the instrument), and
170
+ 0 `check:test-typecheck` scripts.
171
+
172
+ Onboarded as a family by the director ruling of 2026-09-01 on #14062
173
+ (maintainer verbatim: 「同意」), which also carries the #5286 maintainer
174
+ authority the starting ledgers need. The smaller branch triage recommended —
175
+ declare the instrument's scope and re-site the two compile-time pins — was
176
+ recorded as considered and not taken: an instrument silent over a third of the
177
+ runtime surface is a hole readers generalise across, and that costs more than
178
+ fourteen tsconfigs.
179
+
180
+ **Measured, not assumed** (at `e80889095`, workspace closure built first). Four
181
+ packages carry residue and therefore a starting ledger — plugin-approvals 324
182
+ over 8 files, plugin-auth 94 over 10, plugin-sharing 3 over 2,
183
+ knowledge-ragflow 3 over 1. The other ten measure **zero** and deliberately get
184
+ no ledger file at all: the gate reads a missing ledger as `{ entries: {} }`, so
185
+ any error there is red immediately with no entry to be added to — strictly
186
+ stronger than a ledger holding nothing, and the call `plugin-security` had
187
+ already recorded for itself.
188
+
189
+ ⛔ **This does not repair 345 type errors.** Per ruling item 3 it makes the
190
+ ratchet able to *see* them; paydown follows the ratchet's own shrink-only
191
+ discipline on its own cards. No test file is edited here.
192
+
193
+ Two corrections to the finding's own prose, both measured: the exclusion is
194
+ narrower than "no plugin package compiles its tests" — 9 of the 14 already
195
+ compiled their tests inside the `typecheck`-invoked build config, at zero
196
+ errors — and `exec-context-annotation.pin.ts` is a `.pin.ts`, which
197
+ `**/*.test.ts` never excluded, so its directives were already live. The pin
198
+ this change genuinely makes real is
199
+ `plugin-approvals/src/manager-org-screen-parity.contract.test.ts`, which no tsc
200
+ program had ever read.
201
+ - Updated dependencies [809d417]
202
+ - Updated dependencies [387e231]
203
+ - Updated dependencies [f794e4e]
204
+ - Updated dependencies [cae2169]
205
+ - Updated dependencies [b812a54]
206
+ - Updated dependencies [2d4fa75]
207
+ - Updated dependencies [0e4e51b]
208
+ - Updated dependencies [e84bbf6]
209
+ - Updated dependencies [effae80]
210
+ - Updated dependencies [efb3513]
211
+ - Updated dependencies [d62f990]
212
+ - Updated dependencies [c45d8e6]
213
+ - Updated dependencies [2e3e8c7]
214
+ - Updated dependencies [e621291]
215
+ - Updated dependencies [655b106]
216
+ - Updated dependencies [40a93b5]
217
+ - Updated dependencies [d5b330d]
218
+ - Updated dependencies [dda969c]
219
+ - Updated dependencies [1f45690]
220
+ - Updated dependencies [277948f]
221
+ - Updated dependencies [8bdd955]
222
+ - Updated dependencies [f3bbbef]
223
+ - Updated dependencies [4f24e9d]
224
+ - Updated dependencies [e27583e]
225
+ - Updated dependencies [4bd6faa]
226
+ - Updated dependencies [86cbe37]
227
+ - Updated dependencies [6a180e4]
228
+ - Updated dependencies [474242f]
229
+ - Updated dependencies [63cd487]
230
+ - Updated dependencies [bd4aa4e]
231
+ - Updated dependencies [803eaab]
232
+ - Updated dependencies [f8e8f03]
233
+ - Updated dependencies [983edf1]
234
+ - Updated dependencies [eae824e]
235
+ - Updated dependencies [f6fa22c]
236
+ - Updated dependencies [8a483b3]
237
+ - Updated dependencies [97bcd99]
238
+ - Updated dependencies [df59de0]
239
+ - Updated dependencies [96e25a8]
240
+ - Updated dependencies [f75a38a]
241
+ - Updated dependencies [7a25e7d]
242
+ - Updated dependencies [1fa05a6]
243
+ - Updated dependencies [c85a265]
244
+ - Updated dependencies [dcb10a5]
245
+ - Updated dependencies [773a999]
246
+ - Updated dependencies [35dffea]
247
+ - Updated dependencies [d8024f0]
248
+ - Updated dependencies [8120808]
249
+ - Updated dependencies [776a098]
250
+ - Updated dependencies [5060877]
251
+ - Updated dependencies [4f6325d]
252
+ - Updated dependencies [52954c0]
253
+ - Updated dependencies [2aa8456]
254
+ - Updated dependencies [93809a3]
255
+ - Updated dependencies [7c0d0c3]
256
+ - Updated dependencies [daae7aa]
257
+ - Updated dependencies [8dc22d6]
258
+ - Updated dependencies [279431e]
259
+ - Updated dependencies [948dd6b]
260
+ - Updated dependencies [3b4c56c]
261
+ - Updated dependencies [ae8edd2]
262
+ - Updated dependencies [e25403c]
263
+ - Updated dependencies [64baa68]
264
+ - Updated dependencies [9fa70d7]
265
+ - Updated dependencies [09db64a]
266
+ - Updated dependencies [92916e7]
267
+ - Updated dependencies [a84f3ea]
268
+ - Updated dependencies [f2eaae8]
269
+ - Updated dependencies [c09451b]
270
+ - Updated dependencies [ba64877]
271
+ - Updated dependencies [e7191ce]
272
+ - Updated dependencies [7345308]
273
+ - Updated dependencies [79b6a22]
274
+ - Updated dependencies [30d96ab]
275
+ - Updated dependencies [f658793]
276
+ - Updated dependencies [c95ad19]
277
+ - Updated dependencies [e58ea8b]
278
+ - Updated dependencies [4a17645]
279
+ - Updated dependencies [3795c5f]
280
+ - Updated dependencies [8ab926b]
281
+ - Updated dependencies [7317cf2]
282
+ - Updated dependencies [e25e839]
283
+ - Updated dependencies [5997207]
284
+ - Updated dependencies [8b13cc8]
285
+ - Updated dependencies [4a4a35d]
286
+ - Updated dependencies [86e765a]
287
+ - Updated dependencies [1d7e76a]
288
+ - Updated dependencies [53dc739]
289
+ - Updated dependencies [fd289be]
290
+ - Updated dependencies [03bf7b1]
291
+ - Updated dependencies [f90e820]
292
+ - Updated dependencies [18d816a]
293
+ - Updated dependencies [e8bd715]
294
+ - Updated dependencies [b91c351]
295
+ - Updated dependencies [a28a3c0]
296
+ - Updated dependencies [daeaaf9]
297
+ - Updated dependencies [c459da6]
298
+ - Updated dependencies [e914733]
299
+ - Updated dependencies [f887e52]
300
+ - Updated dependencies [881f8d8]
301
+ - Updated dependencies [3bfa1e6]
302
+ - Updated dependencies [0a8ebf3]
303
+ - Updated dependencies [901355c]
304
+ - Updated dependencies [34ce8e7]
305
+ - Updated dependencies [33681ea]
306
+ - Updated dependencies [4635f3e]
307
+ - Updated dependencies [fd289be]
308
+ - Updated dependencies [ee3595c]
309
+ - Updated dependencies [b2eab95]
310
+ - Updated dependencies [93940d4]
311
+ - Updated dependencies [3a04b01]
312
+ - Updated dependencies [45b9051]
313
+ - Updated dependencies [b9e9227]
314
+ - Updated dependencies [d395692]
315
+ - Updated dependencies [5894d30]
316
+ - Updated dependencies [a3765f6]
317
+ - Updated dependencies [2d5cee3]
318
+ - Updated dependencies [e22158f]
319
+ - Updated dependencies [7404925]
320
+ - Updated dependencies [0c2334f]
321
+ - Updated dependencies [778c59f]
322
+ - Updated dependencies [d2619fd]
323
+ - Updated dependencies [af56546]
324
+ - Updated dependencies [6acb11a]
325
+ - Updated dependencies [33c5fd3]
326
+ - Updated dependencies [20b0fdb]
327
+ - Updated dependencies [905019b]
328
+ - Updated dependencies [a286411]
329
+ - Updated dependencies [98c0d33]
330
+ - Updated dependencies [368a82e]
331
+ - Updated dependencies [a3d5724]
332
+ - Updated dependencies [93ea19b]
333
+ - Updated dependencies [9ee2dcf]
334
+ - Updated dependencies [8cb96ec]
335
+ - Updated dependencies [8f10a79]
336
+ - Updated dependencies [6269a55]
337
+ - Updated dependencies [a17da05]
338
+ - Updated dependencies [a8c00e2]
339
+ - Updated dependencies [0fb8760]
340
+ - Updated dependencies [e5ce2ed]
341
+ - Updated dependencies [be21955]
342
+ - Updated dependencies [bc56e18]
343
+ - Updated dependencies [be21955]
344
+ - Updated dependencies [a9ee989]
345
+ - Updated dependencies [4d0d944]
346
+ - Updated dependencies [15d58db]
347
+ - Updated dependencies [d63b014]
348
+ - Updated dependencies [9abe4e4]
349
+ - Updated dependencies [2cc7122]
350
+ - Updated dependencies [50d6c92]
351
+ - Updated dependencies [9e0ba21]
352
+ - Updated dependencies [311433f]
353
+ - Updated dependencies [3e5ad08]
354
+ - Updated dependencies [9abe4e4]
355
+ - Updated dependencies [b7131f3]
356
+ - Updated dependencies [e5812fa]
357
+ - Updated dependencies [7085f90]
358
+ - Updated dependencies [dee4dd4]
359
+ - Updated dependencies [ce7e497]
360
+ - Updated dependencies [51ecb2f]
361
+ - Updated dependencies [9086761]
362
+ - Updated dependencies [42a117b]
363
+ - Updated dependencies [1401ae7]
364
+ - Updated dependencies [4297fe7]
365
+ - Updated dependencies [e398863]
366
+ - Updated dependencies [d16df74]
367
+ - Updated dependencies [f11fc61]
368
+ - Updated dependencies [e808890]
369
+ - Updated dependencies [8f79379]
370
+ - Updated dependencies [e6ca40e]
371
+ - Updated dependencies [0c77ea4]
372
+ - Updated dependencies [52954c0]
373
+ - Updated dependencies [89eb997]
374
+ - Updated dependencies [7131f12]
375
+ - Updated dependencies [aa5994e]
376
+ - Updated dependencies [be93457]
377
+ - Updated dependencies [a65db76]
378
+ - Updated dependencies [15eb2c9]
379
+ - Updated dependencies [5691b07]
380
+ - Updated dependencies [2a6122b]
381
+ - Updated dependencies [225e769]
382
+ - Updated dependencies [8af88dd]
383
+ - Updated dependencies [fb5fbb8]
384
+ - Updated dependencies [d7b3963]
385
+ - Updated dependencies [33184fd]
386
+ - Updated dependencies [7c41693]
387
+ - Updated dependencies [b72db01]
388
+ - Updated dependencies [dce5cd4]
389
+ - Updated dependencies [9688f58]
390
+ - Updated dependencies [556ebc1]
391
+ - Updated dependencies [177ebdc]
392
+ - Updated dependencies [8d237b4]
393
+ - Updated dependencies [2d2e6f0]
394
+ - Updated dependencies [2d8dd8d]
395
+ - Updated dependencies [22d573e]
396
+ - Updated dependencies [b5a2398]
397
+ - Updated dependencies [348860c]
398
+ - Updated dependencies [5383fa6]
399
+ - Updated dependencies [5b3ff63]
400
+ - Updated dependencies [1a6a19c]
401
+ - Updated dependencies [527e050]
402
+ - Updated dependencies [dd33bf9]
403
+ - Updated dependencies [4cb2a90]
404
+ - Updated dependencies [74a7804]
405
+ - Updated dependencies [53d3689]
406
+ - Updated dependencies [b3a63d3]
407
+ - Updated dependencies [49f0dcf]
408
+ - Updated dependencies [033a34c]
409
+ - Updated dependencies [4d25d22]
410
+ - Updated dependencies [1ffee51]
411
+ - Updated dependencies [5ae4303]
412
+ - Updated dependencies [ece4dad]
413
+ - Updated dependencies [e9b377e]
414
+ - Updated dependencies [146f448]
415
+ - Updated dependencies [735f5c7]
416
+ - Updated dependencies [a7e18de]
417
+ - Updated dependencies [366f895]
418
+ - Updated dependencies [dc75ba8]
419
+ - Updated dependencies [cce0aa9]
420
+ - Updated dependencies [e764507]
421
+ - Updated dependencies [cff17af]
422
+ - Updated dependencies [39404f3]
423
+ - Updated dependencies [ca1965f]
424
+ - Updated dependencies [8619f95]
425
+ - Updated dependencies [b706af9]
426
+ - Updated dependencies [8422acd]
427
+ - Updated dependencies [add4360]
428
+ - Updated dependencies [fc9ba76]
429
+ - Updated dependencies [0f94cc7]
430
+ - Updated dependencies [a11c1a5]
431
+ - Updated dependencies [71f9cd1]
432
+ - Updated dependencies [ee17d86]
433
+ - Updated dependencies [cdbd920]
434
+ - Updated dependencies [18c432e]
435
+ - Updated dependencies [3c418c4]
436
+ - Updated dependencies [fa8715a]
437
+ - Updated dependencies [a933ed7]
438
+ - Updated dependencies [b3ca463]
439
+ - Updated dependencies [a933ed7]
440
+ - Updated dependencies [0d4a6a8]
441
+ - Updated dependencies [518d5e5]
442
+ - Updated dependencies [6643ba1]
443
+ - Updated dependencies [eeba2ef]
444
+ - Updated dependencies [ec4c4d2]
445
+ - Updated dependencies [424f73c]
446
+ - Updated dependencies [cccbe51]
447
+ - Updated dependencies [a8d6b1d]
448
+ - Updated dependencies [e4a7695]
449
+ - Updated dependencies [87075b1]
450
+ - Updated dependencies [fc58a99]
451
+ - Updated dependencies [14cfc00]
452
+ - Updated dependencies [1c6f7b4]
453
+ - Updated dependencies [e854a53]
454
+ - Updated dependencies [dfebfc8]
455
+ - Updated dependencies [d028b37]
456
+ - Updated dependencies [f7b25c5]
457
+ - Updated dependencies [122ef38]
458
+ - Updated dependencies [4a37870]
459
+ - Updated dependencies [428f9b2]
460
+ - Updated dependencies [aa7ff56]
461
+ - Updated dependencies [c41b42e]
462
+ - Updated dependencies [c4db311]
463
+ - Updated dependencies [750fff5]
464
+ - Updated dependencies [c19035e]
465
+ - Updated dependencies [ececf7a]
466
+ - Updated dependencies [d173125]
467
+ - Updated dependencies [8eeca27]
468
+ - Updated dependencies [8425c17]
469
+ - Updated dependencies [a5ef1d8]
470
+ - Updated dependencies [772d5de]
471
+ - Updated dependencies [ce80ec2]
472
+ - Updated dependencies [b372318]
473
+ - Updated dependencies [97a2263]
474
+ - Updated dependencies [29d0676]
475
+ - Updated dependencies [0169d49]
476
+ - Updated dependencies [6bd3231]
477
+ - Updated dependencies [d2b5ba8]
478
+ - Updated dependencies [b799ac5]
479
+ - Updated dependencies [8f74307]
480
+ - Updated dependencies [d23dc08]
481
+ - Updated dependencies [644ad50]
482
+ - Updated dependencies [0da7cd2]
483
+ - Updated dependencies [28a5c3e]
484
+ - Updated dependencies [4bc18e5]
485
+ - @objectstack/spec@17.3.0
486
+ - @objectstack/core@17.3.0
487
+ - @objectstack/service-knowledge@17.3.0
488
+
3
489
  ## 17.2.0
4
490
 
5
491
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -58,7 +58,7 @@ interface KnowledgeRagflowPluginOptions extends KnowledgeRagflowAdapterOptions {
58
58
  declare class KnowledgeRagflowPlugin implements Plugin {
59
59
  name: string;
60
60
  version: string;
61
- type: string;
61
+ type: "standard";
62
62
  private readonly adapter;
63
63
  constructor(opts: KnowledgeRagflowPluginOptions);
64
64
  init(_ctx: PluginContext): Promise<void>;
package/dist/index.d.ts CHANGED
@@ -58,7 +58,7 @@ interface KnowledgeRagflowPluginOptions extends KnowledgeRagflowAdapterOptions {
58
58
  declare class KnowledgeRagflowPlugin implements Plugin {
59
59
  name: string;
60
60
  version: string;
61
- type: string;
61
+ type: "standard";
62
62
  private readonly adapter;
63
63
  constructor(opts: KnowledgeRagflowPluginOptions);
64
64
  init(_ctx: PluginContext): Promise<void>;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport type { Plugin, PluginContext } from '@objectstack/core';\nimport type {\n IKnowledgeAdapter,\n IKnowledgeService,\n AdapterContext,\n AdapterSearchOptions,\n} from '@objectstack/spec/contracts';\nimport type {\n KnowledgeDocument,\n KnowledgeHit,\n KnowledgeSource,\n} from '@objectstack/spec/ai';\nimport { KNOWLEDGE_SERVICE } from '@objectstack/spec/contracts';\n\n/**\n * Subset of `fetch` used by the adapter. Inject in tests; defaults to\n * the global `fetch`.\n */\nexport type FetchLike = (\n input: string,\n init?: {\n method?: string;\n headers?: Record<string, string>;\n body?: string;\n signal?: AbortSignal;\n },\n) => Promise<{\n ok: boolean;\n status: number;\n statusText: string;\n text(): Promise<string>;\n json(): Promise<unknown>;\n}>;\n\nexport interface KnowledgeRagflowAdapterOptions {\n /** RAGFlow endpoint, e.g. `http://localhost:9380`. */\n endpoint: string;\n /** RAGFlow API key (Bearer token). */\n apiKey: string;\n /** Adapter id. @default 'ragflow' */\n id?: string;\n /** Override `fetch` for tests. */\n fetch?: FetchLike;\n /** Request timeout in milliseconds. @default 30000 */\n timeoutMs?: number;\n}\n\ninterface RagflowSourceOptions {\n datasetId: string;\n /** Optional rerank model id (overrides dataset default). */\n rerankModel?: string;\n /** Optional similarity threshold passed through to RAGFlow. */\n similarityThreshold?: number;\n /** Optional vector vs keyword weight in [0,1]. */\n vectorSimilarityWeight?: number;\n}\n\nfunction extractRagflowOptions(source: KnowledgeSource): RagflowSourceOptions {\n const opts = ((source as unknown as { options?: Record<string, unknown> }).options ?? {}) as\n Record<string, unknown>;\n const datasetId = opts.datasetId;\n if (typeof datasetId !== 'string' || !datasetId) {\n throw new Error(\n `RAGFlow adapter requires source.options.datasetId on source '${source.id}'`,\n );\n }\n return {\n datasetId,\n rerankModel: typeof opts.rerankModel === 'string' ? opts.rerankModel : undefined,\n similarityThreshold:\n typeof opts.similarityThreshold === 'number' ? opts.similarityThreshold : undefined,\n vectorSimilarityWeight:\n typeof opts.vectorSimilarityWeight === 'number'\n ? opts.vectorSimilarityWeight\n : undefined,\n };\n}\n\n/**\n * RAGFlow adapter. Maps {@link KnowledgeDocument} upserts to the\n * dataset's chunk API, delegates retrieval to `/api/v1/retrieval`, and\n * returns {@link KnowledgeHit}s with `sourceRecordId` preserved so the\n * orchestrator can run a permission re-check.\n */\nexport class KnowledgeRagflowAdapter implements IKnowledgeAdapter {\n readonly id: string;\n private readonly endpoint: string;\n private readonly apiKey: string;\n private readonly fetchImpl: FetchLike;\n private readonly timeoutMs: number;\n\n constructor(opts: KnowledgeRagflowAdapterOptions) {\n if (!opts.endpoint) throw new Error('RAGFlow adapter: endpoint required');\n if (!opts.apiKey) throw new Error('RAGFlow adapter: apiKey required');\n this.id = opts.id ?? 'ragflow';\n this.endpoint = opts.endpoint.replace(/\\/+$/, '');\n this.apiKey = opts.apiKey;\n this.fetchImpl = opts.fetch ?? ((globalThis as { fetch?: FetchLike }).fetch as FetchLike);\n this.timeoutMs = opts.timeoutMs ?? 30000;\n if (!this.fetchImpl) {\n throw new Error('RAGFlow adapter: no fetch available; pass options.fetch');\n }\n }\n\n async upsert(docs: KnowledgeDocument[], ctx: AdapterContext): Promise<void> {\n const { datasetId } = extractRagflowOptions(ctx.source);\n // RAGFlow models documents in two layers: documents (file-like) and\n // chunks (text blocks). We treat each KnowledgeDocument as a single\n // chunk-set: delete existing chunks with the same external id, then\n // upload as `content` chunks tagged with our document id.\n for (const doc of docs) {\n await this.deleteChunksByDocumentId(datasetId, doc.id);\n await this.request(`/api/v1/datasets/${datasetId}/chunks`, {\n method: 'POST',\n body: JSON.stringify({\n content: doc.content,\n // RAGFlow accepts arbitrary metadata used for filtering at\n // retrieval time. We always stamp `objectstack_doc_id` so\n // delete() can find these chunks again.\n important_keywords: doc.title ? [doc.title] : undefined,\n metadata: {\n ...(doc.metadata ?? {}),\n objectstack_doc_id: doc.id,\n objectstack_source_id: doc.sourceId,\n objectstack_record_id: doc.sourceRecordId,\n title: doc.title,\n },\n }),\n });\n }\n }\n\n async delete(documentIds: string[], ctx: AdapterContext): Promise<void> {\n const { datasetId } = extractRagflowOptions(ctx.source);\n for (const id of documentIds) {\n await this.deleteChunksByDocumentId(datasetId, id);\n }\n }\n\n async search(query: string, opts: AdapterSearchOptions): Promise<KnowledgeHit[]> {\n const { datasetId, rerankModel, similarityThreshold, vectorSimilarityWeight } =\n extractRagflowOptions(opts.source);\n const body: Record<string, unknown> = {\n question: query,\n dataset_ids: [datasetId],\n top_k: opts.topK,\n keyword: true,\n };\n if (rerankModel) body.rerank_id = rerankModel;\n if (typeof similarityThreshold === 'number') body.similarity_threshold = similarityThreshold;\n if (typeof vectorSimilarityWeight === 'number')\n body.vector_similarity_weight = vectorSimilarityWeight;\n if (opts.filter) body.metadata_condition = { ...opts.filter };\n\n const res = await this.request('/api/v1/retrieval', {\n method: 'POST',\n body: JSON.stringify(body),\n });\n const data = (res?.data ?? {}) as { chunks?: RagflowChunkHit[] };\n const chunks = data.chunks ?? [];\n return chunks.slice(0, opts.topK).map<KnowledgeHit>((c) => {\n const md = (c.metadata ?? {}) as Record<string, unknown>;\n const docId =\n (md.objectstack_doc_id as string | undefined) ??\n c.document_id ??\n c.doc_id ??\n c.id;\n const recordId = md.objectstack_record_id as string | undefined;\n return {\n chunkId: c.id ?? `${docId}#${c.position ?? 0}`,\n documentId: docId ?? c.id ?? 'unknown',\n sourceId: opts.source.id,\n sourceRecordId: recordId,\n score: c.similarity ?? c.score ?? 0,\n snippet: c.content ?? c.content_with_weight ?? '',\n title: (md.title as string | undefined) ?? c.document_name,\n metadata: md,\n };\n });\n }\n\n async healthCheck(): Promise<{ ok: boolean; message?: string }> {\n try {\n await this.request('/api/v1/datasets?page=1&page_size=1', { method: 'GET' });\n return { ok: true };\n } catch (err) {\n return { ok: false, message: err instanceof Error ? err.message : String(err) };\n }\n }\n\n private async deleteChunksByDocumentId(datasetId: string, docId: string): Promise<void> {\n // Find chunks with our stamped metadata, then delete by chunk id.\n const found = (await this.request(`/api/v1/retrieval`, {\n method: 'POST',\n body: JSON.stringify({\n question: docId,\n dataset_ids: [datasetId],\n top_k: 256,\n keyword: false,\n metadata_condition: { objectstack_doc_id: docId },\n }),\n })) as { data?: { chunks?: Array<{ id?: string }> } };\n const ids = (found.data?.chunks ?? [])\n .map((c) => c.id)\n .filter((x): x is string => typeof x === 'string');\n if (ids.length === 0) return;\n await this.request(`/api/v1/datasets/${datasetId}/chunks`, {\n method: 'DELETE',\n body: JSON.stringify({ chunk_ids: ids }),\n });\n }\n\n private async request(\n path: string,\n init: { method: string; body?: string },\n ): Promise<{ data?: unknown; code?: number; message?: string }> {\n const controller = new AbortController();\n const t = setTimeout(() => controller.abort(), this.timeoutMs);\n try {\n const res = await this.fetchImpl(`${this.endpoint}${path}`, {\n method: init.method,\n headers: {\n 'content-type': 'application/json',\n authorization: `Bearer ${this.apiKey}`,\n },\n body: init.body,\n signal: controller.signal,\n });\n const raw = await res.text();\n let parsed: { data?: unknown; code?: number; message?: string } = {};\n if (raw) {\n try {\n parsed = JSON.parse(raw) as typeof parsed;\n } catch {\n if (!res.ok) {\n throw new Error(\n `RAGFlow ${init.method} ${path} → ${res.status} ${res.statusText}: ${raw.slice(0, 200)}`,\n );\n }\n }\n }\n if (!res.ok || (typeof parsed.code === 'number' && parsed.code !== 0 && parsed.code !== 200)) {\n throw new Error(\n `RAGFlow ${init.method} ${path} → ${res.status} ${res.statusText}${\n parsed.message ? ` (${parsed.message})` : ''\n }`,\n );\n }\n return parsed;\n } finally {\n clearTimeout(t);\n }\n }\n}\n\ninterface RagflowChunkHit {\n id?: string;\n document_id?: string;\n doc_id?: string;\n document_name?: string;\n content?: string;\n content_with_weight?: string;\n similarity?: number;\n score?: number;\n position?: number;\n metadata?: Record<string, unknown>;\n}\n\n/* ---------------------------------------------------------------- */\n/* Kernel plugin glue */\n/* ---------------------------------------------------------------- */\n\nexport interface KnowledgeRagflowPluginOptions extends KnowledgeRagflowAdapterOptions {}\n\nexport class KnowledgeRagflowPlugin implements Plugin {\n name = 'com.objectstack.plugin.knowledge-ragflow';\n version = '0.1.0';\n type = 'standard';\n\n private readonly adapter: KnowledgeRagflowAdapter;\n\n constructor(opts: KnowledgeRagflowPluginOptions) {\n this.adapter = new KnowledgeRagflowAdapter(opts);\n }\n\n async init(_ctx: PluginContext): Promise<void> {\n // No-op: actual registration happens in start() once service is available.\n }\n\n async start(ctx: PluginContext): Promise<void> {\n let svc: IKnowledgeService | undefined;\n try {\n svc = ctx.getService<IKnowledgeService>(KNOWLEDGE_SERVICE);\n } catch {\n ctx.logger.warn?.(\n 'KnowledgeRagflowPlugin: IKnowledgeService not registered — install KnowledgeServicePlugin first.',\n );\n return;\n }\n svc.registerAdapter(this.adapter.id, this.adapter);\n ctx.logger.info?.(\n `KnowledgeRagflowPlugin: adapter '${this.adapter.id}' registered (endpoint=${(this.adapter as unknown as { endpoint: string }).endpoint}).`,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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K,OAAO,OAAO,MAAM,EAC5C;AAAA,QACF;AAAA,MACF;AACA,aAAO;AAAA,IACT,UAAE;AACA,mBAAa,CAAC;AAAA,IAChB;AAAA,EACF;AACF;AAqBO,IAAM,yBAAN,MAA+C;AAAA,EAOpD,YAAY,MAAqC;AANjD,gBAAO;AACP,mBAAU;AACV,gBAAO;AAKL,SAAK,UAAU,IAAI,wBAAwB,IAAI;AAAA,EACjD;AAAA,EAEA,MAAM,KAAK,MAAoC;AAAA,EAE/C;AAAA,EAEA,MAAM,MAAM,KAAmC;AAC7C,QAAI;AACJ,QAAI;AACF,YAAM,IAAI,WAA8B,kCAAiB;AAAA,IAC3D,QAAQ;AACN,UAAI,OAAO;AAAA,QACT;AAAA,MACF;AACA;AAAA,IACF;AACA,QAAI,gBAAgB,KAAK,QAAQ,IAAI,KAAK,OAAO;AACjD,QAAI,OAAO;AAAA,MACT,oCAAoC,KAAK,QAAQ,EAAE,0BAA2B,KAAK,QAA4C,QAAQ;AAAA,IACzI;AAAA,EACF;AACF;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.\n\nimport type { Plugin, PluginContext } from '@objectstack/core';\nimport type {\n IKnowledgeAdapter,\n IKnowledgeService,\n AdapterContext,\n AdapterSearchOptions,\n} from '@objectstack/spec/contracts';\nimport type {\n KnowledgeDocument,\n KnowledgeHit,\n KnowledgeSource,\n} from '@objectstack/spec/ai';\nimport { KNOWLEDGE_SERVICE } from '@objectstack/spec/contracts';\n\n/**\n * Subset of `fetch` used by the adapter. Inject in tests; defaults to\n * the global `fetch`.\n */\nexport type FetchLike = (\n input: string,\n init?: {\n method?: string;\n headers?: Record<string, string>;\n body?: string;\n signal?: AbortSignal;\n },\n) => Promise<{\n ok: boolean;\n status: number;\n statusText: string;\n text(): Promise<string>;\n json(): Promise<unknown>;\n}>;\n\nexport interface KnowledgeRagflowAdapterOptions {\n /** RAGFlow endpoint, e.g. `http://localhost:9380`. */\n endpoint: string;\n /** RAGFlow API key (Bearer token). */\n apiKey: string;\n /** Adapter id. @default 'ragflow' */\n id?: string;\n /** Override `fetch` for tests. */\n fetch?: FetchLike;\n /** Request timeout in milliseconds. @default 30000 */\n timeoutMs?: number;\n}\n\ninterface RagflowSourceOptions {\n datasetId: string;\n /** Optional rerank model id (overrides dataset default). */\n rerankModel?: string;\n /** Optional similarity threshold passed through to RAGFlow. */\n similarityThreshold?: number;\n /** Optional vector vs keyword weight in [0,1]. */\n vectorSimilarityWeight?: number;\n}\n\nfunction extractRagflowOptions(source: KnowledgeSource): RagflowSourceOptions {\n const opts = ((source as unknown as { options?: Record<string, unknown> }).options ?? {}) as\n Record<string, unknown>;\n const datasetId = opts.datasetId;\n if (typeof datasetId !== 'string' || !datasetId) {\n throw new Error(\n `RAGFlow adapter requires source.options.datasetId on source '${source.id}'`,\n );\n }\n return {\n datasetId,\n rerankModel: typeof opts.rerankModel === 'string' ? opts.rerankModel : undefined,\n similarityThreshold:\n typeof opts.similarityThreshold === 'number' ? opts.similarityThreshold : undefined,\n vectorSimilarityWeight:\n typeof opts.vectorSimilarityWeight === 'number'\n ? opts.vectorSimilarityWeight\n : undefined,\n };\n}\n\n/**\n * RAGFlow adapter. Maps {@link KnowledgeDocument} upserts to the\n * dataset's chunk API, delegates retrieval to `/api/v1/retrieval`, and\n * returns {@link KnowledgeHit}s with `sourceRecordId` preserved so the\n * orchestrator can run a permission re-check.\n */\nexport class KnowledgeRagflowAdapter implements IKnowledgeAdapter {\n readonly id: string;\n private readonly endpoint: string;\n private readonly apiKey: string;\n private readonly fetchImpl: FetchLike;\n private readonly timeoutMs: number;\n\n constructor(opts: KnowledgeRagflowAdapterOptions) {\n if (!opts.endpoint) throw new Error('RAGFlow adapter: endpoint required');\n if (!opts.apiKey) throw new Error('RAGFlow adapter: apiKey required');\n this.id = opts.id ?? 'ragflow';\n this.endpoint = opts.endpoint.replace(/\\/+$/, '');\n this.apiKey = opts.apiKey;\n this.fetchImpl = opts.fetch ?? ((globalThis as { fetch?: FetchLike }).fetch as FetchLike);\n this.timeoutMs = opts.timeoutMs ?? 30000;\n if (!this.fetchImpl) {\n throw new Error('RAGFlow adapter: no fetch available; pass options.fetch');\n }\n }\n\n async upsert(docs: KnowledgeDocument[], ctx: AdapterContext): Promise<void> {\n const { datasetId } = extractRagflowOptions(ctx.source);\n // RAGFlow models documents in two layers: documents (file-like) and\n // chunks (text blocks). We treat each KnowledgeDocument as a single\n // chunk-set: delete existing chunks with the same external id, then\n // upload as `content` chunks tagged with our document id.\n for (const doc of docs) {\n await this.deleteChunksByDocumentId(datasetId, doc.id);\n await this.request(`/api/v1/datasets/${datasetId}/chunks`, {\n method: 'POST',\n body: JSON.stringify({\n content: doc.content,\n // RAGFlow accepts arbitrary metadata used for filtering at\n // retrieval time. We always stamp `objectstack_doc_id` so\n // delete() can find these chunks again.\n important_keywords: doc.title ? [doc.title] : undefined,\n metadata: {\n ...(doc.metadata ?? {}),\n objectstack_doc_id: doc.id,\n objectstack_source_id: doc.sourceId,\n objectstack_record_id: doc.sourceRecordId,\n title: doc.title,\n },\n }),\n });\n }\n }\n\n async delete(documentIds: string[], ctx: AdapterContext): Promise<void> {\n const { datasetId } = extractRagflowOptions(ctx.source);\n for (const id of documentIds) {\n await this.deleteChunksByDocumentId(datasetId, id);\n }\n }\n\n async search(query: string, opts: AdapterSearchOptions): Promise<KnowledgeHit[]> {\n const { datasetId, rerankModel, similarityThreshold, vectorSimilarityWeight } =\n extractRagflowOptions(opts.source);\n const body: Record<string, unknown> = {\n question: query,\n dataset_ids: [datasetId],\n top_k: opts.topK,\n keyword: true,\n };\n if (rerankModel) body.rerank_id = rerankModel;\n if (typeof similarityThreshold === 'number') body.similarity_threshold = similarityThreshold;\n if (typeof vectorSimilarityWeight === 'number')\n body.vector_similarity_weight = vectorSimilarityWeight;\n if (opts.filter) body.metadata_condition = { ...opts.filter };\n\n const res = await this.request('/api/v1/retrieval', {\n method: 'POST',\n body: JSON.stringify(body),\n });\n const data = (res?.data ?? {}) as { chunks?: RagflowChunkHit[] };\n const chunks = data.chunks ?? [];\n return chunks.slice(0, opts.topK).map<KnowledgeHit>((c) => {\n const md = (c.metadata ?? {}) as Record<string, unknown>;\n const docId =\n (md.objectstack_doc_id as string | undefined) ??\n c.document_id ??\n c.doc_id ??\n c.id;\n const recordId = md.objectstack_record_id as string | undefined;\n return {\n chunkId: c.id ?? `${docId}#${c.position ?? 0}`,\n documentId: docId ?? c.id ?? 'unknown',\n sourceId: opts.source.id,\n sourceRecordId: recordId,\n score: c.similarity ?? c.score ?? 0,\n snippet: c.content ?? c.content_with_weight ?? '',\n title: (md.title as string | undefined) ?? c.document_name,\n metadata: md,\n };\n });\n }\n\n async healthCheck(): Promise<{ ok: boolean; message?: string }> {\n try {\n await this.request('/api/v1/datasets?page=1&page_size=1', { method: 'GET' });\n return { ok: true };\n } catch (err) {\n return { ok: false, message: err instanceof Error ? err.message : String(err) };\n }\n }\n\n private async deleteChunksByDocumentId(datasetId: string, docId: string): Promise<void> {\n // Find chunks with our stamped metadata, then delete by chunk id.\n const found = (await this.request(`/api/v1/retrieval`, {\n method: 'POST',\n body: JSON.stringify({\n question: docId,\n dataset_ids: [datasetId],\n top_k: 256,\n keyword: false,\n metadata_condition: { objectstack_doc_id: docId },\n }),\n })) as { data?: { chunks?: Array<{ id?: string }> } };\n const ids = (found.data?.chunks ?? [])\n .map((c) => c.id)\n .filter((x): x is string => typeof x === 'string');\n if (ids.length === 0) return;\n await this.request(`/api/v1/datasets/${datasetId}/chunks`, {\n method: 'DELETE',\n body: JSON.stringify({ chunk_ids: ids }),\n });\n }\n\n private async request(\n path: string,\n init: { method: string; body?: string },\n ): Promise<{ data?: unknown; code?: number; message?: string }> {\n const controller = new AbortController();\n const t = setTimeout(() => controller.abort(), this.timeoutMs);\n try {\n const res = await this.fetchImpl(`${this.endpoint}${path}`, {\n method: init.method,\n headers: {\n 'content-type': 'application/json',\n authorization: `Bearer ${this.apiKey}`,\n },\n body: init.body,\n signal: controller.signal,\n });\n const raw = await res.text();\n let parsed: { data?: unknown; code?: number; message?: string } = {};\n if (raw) {\n try {\n parsed = JSON.parse(raw) as typeof parsed;\n } catch {\n if (!res.ok) {\n throw new Error(\n `RAGFlow ${init.method} ${path} → ${res.status} ${res.statusText}: ${raw.slice(0, 200)}`,\n );\n }\n }\n }\n if (!res.ok || (typeof parsed.code === 'number' && parsed.code !== 0 && parsed.code !== 200)) {\n throw new Error(\n `RAGFlow ${init.method} ${path} → ${res.status} ${res.statusText}${\n parsed.message ? ` (${parsed.message})` : ''\n }`,\n );\n }\n return parsed;\n } finally {\n clearTimeout(t);\n }\n }\n}\n\ninterface RagflowChunkHit {\n id?: string;\n document_id?: string;\n doc_id?: string;\n document_name?: string;\n content?: string;\n content_with_weight?: string;\n similarity?: number;\n score?: number;\n position?: number;\n metadata?: Record<string, unknown>;\n}\n\n/* ---------------------------------------------------------------- */\n/* Kernel plugin glue */\n/* ---------------------------------------------------------------- */\n\nexport interface KnowledgeRagflowPluginOptions extends KnowledgeRagflowAdapterOptions {}\n\nexport class KnowledgeRagflowPlugin implements Plugin {\n name = 'com.objectstack.plugin.knowledge-ragflow';\n version = '0.1.0';\n type = 'standard';\n\n private readonly adapter: KnowledgeRagflowAdapter;\n\n constructor(opts: KnowledgeRagflowPluginOptions) {\n this.adapter = new KnowledgeRagflowAdapter(opts);\n }\n\n async init(_ctx: PluginContext): Promise<void> {\n // No-op: actual registration happens in start() once service is available.\n }\n\n async start(ctx: PluginContext): Promise<void> {\n let svc: IKnowledgeService | undefined;\n try {\n svc = ctx.getService<IKnowledgeService>(KNOWLEDGE_SERVICE);\n } catch {\n ctx.logger.warn?.(\n 'KnowledgeRagflowPlugin: IKnowledgeService not registered — install KnowledgeServicePlugin first.',\n );\n return;\n }\n svc.registerAdapter(this.adapter.id, this.adapter);\n ctx.logger.info?.(\n `KnowledgeRagflowPlugin: adapter '${this.adapter.id}' registered (endpoint=${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KAAK,OAAO,OAAO,MAAM,EAC5C;AAAA,QACF;AAAA,MACF;AACA,aAAO;AAAA,IACT,UAAE;AACA,mBAAa,CAAC;AAAA,IAChB;AAAA,EACF;AACF;AAqBO,IAAM,yBAAN,MAA+C;AAAA,EAOpD,YAAY,MAAqC;AANjD,gBAAO;AACP,mBAAU;AACV,gBAAO;AAKL,SAAK,UAAU,IAAI,wBAAwB,IAAI;AAAA,EACjD;AAAA,EAEA,MAAM,KAAK,MAAoC;AAAA,EAE/C;AAAA,EAEA,MAAM,MAAM,KAAmC;AAC7C,QAAI;AACJ,QAAI;AACF,YAAM,IAAI,WAA8B,iBAAiB;AAAA,IAC3D,QAAQ;AACN,UAAI,OAAO;AAAA,QACT;AAAA,MACF;AACA;AAAA,IACF;AACA,QAAI,gBAAgB,KAAK,QAAQ,IAAI,KAAK,OAAO;AACjD,QAAI,OAAO;AAAA,MACT,oCAAoC,KAAK,QAAQ,EAAE,0BAA2B,KAAK,QAA4C,QAAQ;AAAA,IACzI;AAAA,EACF;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@objectstack/knowledge-ragflow",
3
- "version": "17.2.0",
3
+ "version": "17.4.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "RAGFlow knowledge adapter for ObjectStack — production-grade RAG via the Apache 2.0 RAGFlow REST API.",
6
6
  "main": "dist/index.js",
@@ -13,12 +13,13 @@
13
13
  }
14
14
  },
15
15
  "dependencies": {
16
- "@objectstack/core": "17.2.0",
17
- "@objectstack/service-knowledge": "17.2.0",
18
- "@objectstack/spec": "17.2.0"
16
+ "@objectstack/core": "17.4.0",
17
+ "@objectstack/service-knowledge": "17.4.0",
18
+ "@objectstack/spec": "17.4.0"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@types/node": "^26.2.0",
22
+ "tsx": "^4.23.12",
22
23
  "typescript": "^6.0.3",
23
24
  "vitest": "^4.1.10"
24
25
  },
@@ -28,14 +29,22 @@
28
29
  "rag",
29
30
  "ragflow"
30
31
  ],
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/objectstack-ai/objectstack.git",
35
+ "directory": "packages/plugins/knowledge-ragflow"
36
+ },
31
37
  "files": [
32
38
  "dist",
33
39
  "README.md",
34
40
  "CHANGELOG.md"
35
41
  ],
36
42
  "scripts": {
37
- "build": "tsup --config ../../../tsup.config.ts",
43
+ "build": "tsup --config ../../../tsup.config.ts && node ../../../scripts/check-dts-emitted.mjs",
38
44
  "dev": "tsc -w",
39
- "test": "vitest run"
45
+ "test": "vitest run",
46
+ "typecheck": "tsc --noEmit && pnpm check:test-typecheck",
47
+ "check:test-typecheck": "tsx ../../../scripts/check-test-typecheck.mts --self-test && tsx ../../../scripts/check-test-typecheck.mts --package packages/plugins/knowledge-ragflow --project tsconfig.test.json",
48
+ "gen:test-typecheck-debt": "tsx ../../../scripts/check-test-typecheck.mts --update --package packages/plugins/knowledge-ragflow --project tsconfig.test.json"
40
49
  }
41
50
  }