@semiont/make-meaning 0.4.2 → 0.4.4
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/README.md +54 -33
- package/dist/index.d.ts +147 -117
- package/dist/index.js +959 -857
- package/dist/index.js.map +1 -1
- package/package.json +3 -5
package/dist/index.js
CHANGED
|
@@ -7,11 +7,11 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
7
7
|
var __commonJS = (cb, mod) => function __require() {
|
|
8
8
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
9
|
};
|
|
10
|
-
var __copyProps = (to,
|
|
11
|
-
if (
|
|
12
|
-
for (let key of __getOwnPropNames(
|
|
10
|
+
var __copyProps = (to, from8, except, desc) => {
|
|
11
|
+
if (from8 && typeof from8 === "object" || typeof from8 === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from8))
|
|
13
13
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () =>
|
|
14
|
+
__defProp(to, key, { get: () => from8[key], enumerable: !(desc = __getOwnPropDesc(from8, key)) || desc.enumerable });
|
|
15
15
|
}
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
@@ -125,9 +125,9 @@ var require_Subscription = __commonJS({
|
|
|
125
125
|
}
|
|
126
126
|
return ar;
|
|
127
127
|
};
|
|
128
|
-
var __spreadArray = exports && exports.__spreadArray || function(to,
|
|
129
|
-
for (var i = 0, il =
|
|
130
|
-
to[j] =
|
|
128
|
+
var __spreadArray = exports && exports.__spreadArray || function(to, from8) {
|
|
129
|
+
for (var i = 0, il = from8.length, j = to.length; i < il; i++, j++)
|
|
130
|
+
to[j] = from8[i];
|
|
131
131
|
return to;
|
|
132
132
|
};
|
|
133
133
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -135,14 +135,14 @@ var require_Subscription = __commonJS({
|
|
|
135
135
|
var isFunction_1 = require_isFunction();
|
|
136
136
|
var UnsubscriptionError_1 = require_UnsubscriptionError();
|
|
137
137
|
var arrRemove_1 = require_arrRemove();
|
|
138
|
-
var
|
|
139
|
-
function
|
|
138
|
+
var Subscription7 = (function() {
|
|
139
|
+
function Subscription8(initialTeardown) {
|
|
140
140
|
this.initialTeardown = initialTeardown;
|
|
141
141
|
this.closed = false;
|
|
142
142
|
this._parentage = null;
|
|
143
143
|
this._finalizers = null;
|
|
144
144
|
}
|
|
145
|
-
|
|
145
|
+
Subscription8.prototype.unsubscribe = function() {
|
|
146
146
|
var e_1, _a, e_2, _b;
|
|
147
147
|
var errors;
|
|
148
148
|
if (!this.closed) {
|
|
@@ -209,13 +209,13 @@ var require_Subscription = __commonJS({
|
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
};
|
|
212
|
-
|
|
212
|
+
Subscription8.prototype.add = function(teardown) {
|
|
213
213
|
var _a;
|
|
214
214
|
if (teardown && teardown !== this) {
|
|
215
215
|
if (this.closed) {
|
|
216
216
|
execFinalizer(teardown);
|
|
217
217
|
} else {
|
|
218
|
-
if (teardown instanceof
|
|
218
|
+
if (teardown instanceof Subscription8) {
|
|
219
219
|
if (teardown.closed || teardown._hasParent(this)) {
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
@@ -225,15 +225,15 @@ var require_Subscription = __commonJS({
|
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
};
|
|
228
|
-
|
|
228
|
+
Subscription8.prototype._hasParent = function(parent) {
|
|
229
229
|
var _parentage = this._parentage;
|
|
230
230
|
return _parentage === parent || Array.isArray(_parentage) && _parentage.includes(parent);
|
|
231
231
|
};
|
|
232
|
-
|
|
232
|
+
Subscription8.prototype._addParent = function(parent) {
|
|
233
233
|
var _parentage = this._parentage;
|
|
234
234
|
this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
|
|
235
235
|
};
|
|
236
|
-
|
|
236
|
+
Subscription8.prototype._removeParent = function(parent) {
|
|
237
237
|
var _parentage = this._parentage;
|
|
238
238
|
if (_parentage === parent) {
|
|
239
239
|
this._parentage = null;
|
|
@@ -241,24 +241,24 @@ var require_Subscription = __commonJS({
|
|
|
241
241
|
arrRemove_1.arrRemove(_parentage, parent);
|
|
242
242
|
}
|
|
243
243
|
};
|
|
244
|
-
|
|
244
|
+
Subscription8.prototype.remove = function(teardown) {
|
|
245
245
|
var _finalizers = this._finalizers;
|
|
246
246
|
_finalizers && arrRemove_1.arrRemove(_finalizers, teardown);
|
|
247
|
-
if (teardown instanceof
|
|
247
|
+
if (teardown instanceof Subscription8) {
|
|
248
248
|
teardown._removeParent(this);
|
|
249
249
|
}
|
|
250
250
|
};
|
|
251
|
-
|
|
252
|
-
var empty = new
|
|
251
|
+
Subscription8.EMPTY = (function() {
|
|
252
|
+
var empty = new Subscription8();
|
|
253
253
|
empty.closed = true;
|
|
254
254
|
return empty;
|
|
255
255
|
})();
|
|
256
|
-
return
|
|
256
|
+
return Subscription8;
|
|
257
257
|
})();
|
|
258
|
-
exports.Subscription =
|
|
259
|
-
exports.EMPTY_SUBSCRIPTION =
|
|
258
|
+
exports.Subscription = Subscription7;
|
|
259
|
+
exports.EMPTY_SUBSCRIPTION = Subscription7.EMPTY;
|
|
260
260
|
function isSubscription(value) {
|
|
261
|
-
return value instanceof
|
|
261
|
+
return value instanceof Subscription7 || value && "closed" in value && isFunction_1.isFunction(value.remove) && isFunction_1.isFunction(value.add) && isFunction_1.isFunction(value.unsubscribe);
|
|
262
262
|
}
|
|
263
263
|
exports.isSubscription = isSubscription;
|
|
264
264
|
function execFinalizer(finalizer) {
|
|
@@ -308,9 +308,9 @@ var require_timeoutProvider = __commonJS({
|
|
|
308
308
|
}
|
|
309
309
|
return ar;
|
|
310
310
|
};
|
|
311
|
-
var __spreadArray = exports && exports.__spreadArray || function(to,
|
|
312
|
-
for (var i = 0, il =
|
|
313
|
-
to[j] =
|
|
311
|
+
var __spreadArray = exports && exports.__spreadArray || function(to, from8) {
|
|
312
|
+
for (var i = 0, il = from8.length, j = to.length; i < il; i++, j++)
|
|
313
|
+
to[j] = from8[i];
|
|
314
314
|
return to;
|
|
315
315
|
};
|
|
316
316
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -737,7 +737,7 @@ var require_Observable = __commonJS({
|
|
|
737
737
|
Observable2.prototype.forEach = function(next, promiseCtor) {
|
|
738
738
|
var _this = this;
|
|
739
739
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
740
|
-
return new promiseCtor(function(
|
|
740
|
+
return new promiseCtor(function(resolve2, reject) {
|
|
741
741
|
var subscriber = new Subscriber_1.SafeSubscriber({
|
|
742
742
|
next: function(value) {
|
|
743
743
|
try {
|
|
@@ -748,7 +748,7 @@ var require_Observable = __commonJS({
|
|
|
748
748
|
}
|
|
749
749
|
},
|
|
750
750
|
error: reject,
|
|
751
|
-
complete:
|
|
751
|
+
complete: resolve2
|
|
752
752
|
});
|
|
753
753
|
_this.subscribe(subscriber);
|
|
754
754
|
});
|
|
@@ -770,14 +770,14 @@ var require_Observable = __commonJS({
|
|
|
770
770
|
Observable2.prototype.toPromise = function(promiseCtor) {
|
|
771
771
|
var _this = this;
|
|
772
772
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
773
|
-
return new promiseCtor(function(
|
|
773
|
+
return new promiseCtor(function(resolve2, reject) {
|
|
774
774
|
var value;
|
|
775
775
|
_this.subscribe(function(x) {
|
|
776
776
|
return value = x;
|
|
777
777
|
}, function(err) {
|
|
778
778
|
return reject(err);
|
|
779
779
|
}, function() {
|
|
780
|
-
return
|
|
780
|
+
return resolve2(value);
|
|
781
781
|
});
|
|
782
782
|
});
|
|
783
783
|
};
|
|
@@ -1068,9 +1068,9 @@ var require_animationFrameProvider = __commonJS({
|
|
|
1068
1068
|
}
|
|
1069
1069
|
return ar;
|
|
1070
1070
|
};
|
|
1071
|
-
var __spreadArray = exports && exports.__spreadArray || function(to,
|
|
1072
|
-
for (var i = 0, il =
|
|
1073
|
-
to[j] =
|
|
1071
|
+
var __spreadArray = exports && exports.__spreadArray || function(to, from8) {
|
|
1072
|
+
for (var i = 0, il = from8.length, j = to.length; i < il; i++, j++)
|
|
1073
|
+
to[j] = from8[i];
|
|
1074
1074
|
return to;
|
|
1075
1075
|
};
|
|
1076
1076
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1668,9 +1668,9 @@ var require_intervalProvider = __commonJS({
|
|
|
1668
1668
|
}
|
|
1669
1669
|
return ar;
|
|
1670
1670
|
};
|
|
1671
|
-
var __spreadArray = exports && exports.__spreadArray || function(to,
|
|
1672
|
-
for (var i = 0, il =
|
|
1673
|
-
to[j] =
|
|
1671
|
+
var __spreadArray = exports && exports.__spreadArray || function(to, from8) {
|
|
1672
|
+
for (var i = 0, il = from8.length, j = to.length; i < il; i++, j++)
|
|
1673
|
+
to[j] = from8[i];
|
|
1674
1674
|
return to;
|
|
1675
1675
|
};
|
|
1676
1676
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1877,9 +1877,9 @@ var require_immediateProvider = __commonJS({
|
|
|
1877
1877
|
}
|
|
1878
1878
|
return ar;
|
|
1879
1879
|
};
|
|
1880
|
-
var __spreadArray = exports && exports.__spreadArray || function(to,
|
|
1881
|
-
for (var i = 0, il =
|
|
1882
|
-
to[j] =
|
|
1880
|
+
var __spreadArray = exports && exports.__spreadArray || function(to, from8) {
|
|
1881
|
+
for (var i = 0, il = from8.length, j = to.length; i < il; i++, j++)
|
|
1882
|
+
to[j] = from8[i];
|
|
1883
1883
|
return to;
|
|
1884
1884
|
};
|
|
1885
1885
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -2873,11 +2873,11 @@ var require_innerFrom = __commonJS({
|
|
|
2873
2873
|
"use strict";
|
|
2874
2874
|
var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
|
|
2875
2875
|
function adopt(value) {
|
|
2876
|
-
return value instanceof P ? value : new P(function(
|
|
2877
|
-
|
|
2876
|
+
return value instanceof P ? value : new P(function(resolve2) {
|
|
2877
|
+
resolve2(value);
|
|
2878
2878
|
});
|
|
2879
2879
|
}
|
|
2880
|
-
return new (P || (P = Promise))(function(
|
|
2880
|
+
return new (P || (P = Promise))(function(resolve2, reject) {
|
|
2881
2881
|
function fulfilled(value) {
|
|
2882
2882
|
try {
|
|
2883
2883
|
step(generator.next(value));
|
|
@@ -2893,7 +2893,7 @@ var require_innerFrom = __commonJS({
|
|
|
2893
2893
|
}
|
|
2894
2894
|
}
|
|
2895
2895
|
function step(result) {
|
|
2896
|
-
result.done ?
|
|
2896
|
+
result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
2897
2897
|
}
|
|
2898
2898
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2899
2899
|
});
|
|
@@ -2975,14 +2975,14 @@ var require_innerFrom = __commonJS({
|
|
|
2975
2975
|
}, i);
|
|
2976
2976
|
function verb(n) {
|
|
2977
2977
|
i[n] = o[n] && function(v) {
|
|
2978
|
-
return new Promise(function(
|
|
2979
|
-
v = o[n](v), settle(
|
|
2978
|
+
return new Promise(function(resolve2, reject) {
|
|
2979
|
+
v = o[n](v), settle(resolve2, reject, v.done, v.value);
|
|
2980
2980
|
});
|
|
2981
2981
|
};
|
|
2982
2982
|
}
|
|
2983
|
-
function settle(
|
|
2983
|
+
function settle(resolve2, reject, d, v) {
|
|
2984
2984
|
Promise.resolve(v).then(function(v2) {
|
|
2985
|
-
|
|
2985
|
+
resolve2({ value: v2, done: d });
|
|
2986
2986
|
}, reject);
|
|
2987
2987
|
}
|
|
2988
2988
|
};
|
|
@@ -3441,10 +3441,10 @@ var require_from = __commonJS({
|
|
|
3441
3441
|
exports.from = void 0;
|
|
3442
3442
|
var scheduled_1 = require_scheduled();
|
|
3443
3443
|
var innerFrom_1 = require_innerFrom();
|
|
3444
|
-
function
|
|
3444
|
+
function from8(input, scheduler) {
|
|
3445
3445
|
return scheduler ? scheduled_1.scheduled(input, scheduler) : innerFrom_1.innerFrom(input);
|
|
3446
3446
|
}
|
|
3447
|
-
exports.from =
|
|
3447
|
+
exports.from = from8;
|
|
3448
3448
|
}
|
|
3449
3449
|
});
|
|
3450
3450
|
|
|
@@ -3601,7 +3601,7 @@ var require_lastValueFrom = __commonJS({
|
|
|
3601
3601
|
var EmptyError_1 = require_EmptyError();
|
|
3602
3602
|
function lastValueFrom(source, config) {
|
|
3603
3603
|
var hasConfig = typeof config === "object";
|
|
3604
|
-
return new Promise(function(
|
|
3604
|
+
return new Promise(function(resolve2, reject) {
|
|
3605
3605
|
var _hasValue = false;
|
|
3606
3606
|
var _value;
|
|
3607
3607
|
source.subscribe({
|
|
@@ -3612,9 +3612,9 @@ var require_lastValueFrom = __commonJS({
|
|
|
3612
3612
|
error: reject,
|
|
3613
3613
|
complete: function() {
|
|
3614
3614
|
if (_hasValue) {
|
|
3615
|
-
|
|
3615
|
+
resolve2(_value);
|
|
3616
3616
|
} else if (hasConfig) {
|
|
3617
|
-
|
|
3617
|
+
resolve2(config.defaultValue);
|
|
3618
3618
|
} else {
|
|
3619
3619
|
reject(new EmptyError_1.EmptyError());
|
|
3620
3620
|
}
|
|
@@ -3636,16 +3636,16 @@ var require_firstValueFrom = __commonJS({
|
|
|
3636
3636
|
var Subscriber_1 = require_Subscriber();
|
|
3637
3637
|
function firstValueFrom5(source, config) {
|
|
3638
3638
|
var hasConfig = typeof config === "object";
|
|
3639
|
-
return new Promise(function(
|
|
3639
|
+
return new Promise(function(resolve2, reject) {
|
|
3640
3640
|
var subscriber = new Subscriber_1.SafeSubscriber({
|
|
3641
3641
|
next: function(value) {
|
|
3642
|
-
|
|
3642
|
+
resolve2(value);
|
|
3643
3643
|
subscriber.unsubscribe();
|
|
3644
3644
|
},
|
|
3645
3645
|
error: reject,
|
|
3646
3646
|
complete: function() {
|
|
3647
3647
|
if (hasConfig) {
|
|
3648
|
-
|
|
3648
|
+
resolve2(config.defaultValue);
|
|
3649
3649
|
} else {
|
|
3650
3650
|
reject(new EmptyError_1.EmptyError());
|
|
3651
3651
|
}
|
|
@@ -3832,9 +3832,9 @@ var require_mapOneOrManyArgs = __commonJS({
|
|
|
3832
3832
|
}
|
|
3833
3833
|
return ar;
|
|
3834
3834
|
};
|
|
3835
|
-
var __spreadArray = exports && exports.__spreadArray || function(to,
|
|
3836
|
-
for (var i = 0, il =
|
|
3837
|
-
to[j] =
|
|
3835
|
+
var __spreadArray = exports && exports.__spreadArray || function(to, from8) {
|
|
3836
|
+
for (var i = 0, il = from8.length, j = to.length; i < il; i++, j++)
|
|
3837
|
+
to[j] = from8[i];
|
|
3838
3838
|
return to;
|
|
3839
3839
|
};
|
|
3840
3840
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -3874,9 +3874,9 @@ var require_bindCallbackInternals = __commonJS({
|
|
|
3874
3874
|
}
|
|
3875
3875
|
return ar;
|
|
3876
3876
|
};
|
|
3877
|
-
var __spreadArray = exports && exports.__spreadArray || function(to,
|
|
3878
|
-
for (var i = 0, il =
|
|
3879
|
-
to[j] =
|
|
3877
|
+
var __spreadArray = exports && exports.__spreadArray || function(to, from8) {
|
|
3878
|
+
for (var i = 0, il = from8.length, j = to.length; i < il; i++, j++)
|
|
3879
|
+
to[j] = from8[i];
|
|
3880
3880
|
return to;
|
|
3881
3881
|
};
|
|
3882
3882
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5008,9 +5008,9 @@ var require_zip = __commonJS({
|
|
|
5008
5008
|
}
|
|
5009
5009
|
return ar;
|
|
5010
5010
|
};
|
|
5011
|
-
var __spreadArray = exports && exports.__spreadArray || function(to,
|
|
5012
|
-
for (var i = 0, il =
|
|
5013
|
-
to[j] =
|
|
5011
|
+
var __spreadArray = exports && exports.__spreadArray || function(to, from8) {
|
|
5012
|
+
for (var i = 0, il = from8.length, j = to.length; i < il; i++, j++)
|
|
5013
|
+
to[j] = from8[i];
|
|
5014
5014
|
return to;
|
|
5015
5015
|
};
|
|
5016
5016
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5638,9 +5638,9 @@ var require_combineLatest2 = __commonJS({
|
|
|
5638
5638
|
}
|
|
5639
5639
|
return ar;
|
|
5640
5640
|
};
|
|
5641
|
-
var __spreadArray = exports && exports.__spreadArray || function(to,
|
|
5642
|
-
for (var i = 0, il =
|
|
5643
|
-
to[j] =
|
|
5641
|
+
var __spreadArray = exports && exports.__spreadArray || function(to, from8) {
|
|
5642
|
+
for (var i = 0, il = from8.length, j = to.length; i < il; i++, j++)
|
|
5643
|
+
to[j] = from8[i];
|
|
5644
5644
|
return to;
|
|
5645
5645
|
};
|
|
5646
5646
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5686,9 +5686,9 @@ var require_combineLatestWith = __commonJS({
|
|
|
5686
5686
|
}
|
|
5687
5687
|
return ar;
|
|
5688
5688
|
};
|
|
5689
|
-
var __spreadArray = exports && exports.__spreadArray || function(to,
|
|
5690
|
-
for (var i = 0, il =
|
|
5691
|
-
to[j] =
|
|
5689
|
+
var __spreadArray = exports && exports.__spreadArray || function(to, from8) {
|
|
5690
|
+
for (var i = 0, il = from8.length, j = to.length; i < il; i++, j++)
|
|
5691
|
+
to[j] = from8[i];
|
|
5692
5692
|
return to;
|
|
5693
5693
|
};
|
|
5694
5694
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5760,9 +5760,9 @@ var require_concat2 = __commonJS({
|
|
|
5760
5760
|
}
|
|
5761
5761
|
return ar;
|
|
5762
5762
|
};
|
|
5763
|
-
var __spreadArray = exports && exports.__spreadArray || function(to,
|
|
5764
|
-
for (var i = 0, il =
|
|
5765
|
-
to[j] =
|
|
5763
|
+
var __spreadArray = exports && exports.__spreadArray || function(to, from8) {
|
|
5764
|
+
for (var i = 0, il = from8.length, j = to.length; i < il; i++, j++)
|
|
5765
|
+
to[j] = from8[i];
|
|
5766
5766
|
return to;
|
|
5767
5767
|
};
|
|
5768
5768
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -5806,9 +5806,9 @@ var require_concatWith = __commonJS({
|
|
|
5806
5806
|
}
|
|
5807
5807
|
return ar;
|
|
5808
5808
|
};
|
|
5809
|
-
var __spreadArray = exports && exports.__spreadArray || function(to,
|
|
5810
|
-
for (var i = 0, il =
|
|
5811
|
-
to[j] =
|
|
5809
|
+
var __spreadArray = exports && exports.__spreadArray || function(to, from8) {
|
|
5810
|
+
for (var i = 0, il = from8.length, j = to.length; i < il; i++, j++)
|
|
5811
|
+
to[j] = from8[i];
|
|
5812
5812
|
return to;
|
|
5813
5813
|
};
|
|
5814
5814
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -6299,9 +6299,9 @@ var require_endWith = __commonJS({
|
|
|
6299
6299
|
}
|
|
6300
6300
|
return ar;
|
|
6301
6301
|
};
|
|
6302
|
-
var __spreadArray = exports && exports.__spreadArray || function(to,
|
|
6303
|
-
for (var i = 0, il =
|
|
6304
|
-
to[j] =
|
|
6302
|
+
var __spreadArray = exports && exports.__spreadArray || function(to, from8) {
|
|
6303
|
+
for (var i = 0, il = from8.length, j = to.length; i < il; i++, j++)
|
|
6304
|
+
to[j] = from8[i];
|
|
6305
6305
|
return to;
|
|
6306
6306
|
};
|
|
6307
6307
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -6846,9 +6846,9 @@ var require_merge2 = __commonJS({
|
|
|
6846
6846
|
}
|
|
6847
6847
|
return ar;
|
|
6848
6848
|
};
|
|
6849
|
-
var __spreadArray = exports && exports.__spreadArray || function(to,
|
|
6850
|
-
for (var i = 0, il =
|
|
6851
|
-
to[j] =
|
|
6849
|
+
var __spreadArray = exports && exports.__spreadArray || function(to, from8) {
|
|
6850
|
+
for (var i = 0, il = from8.length, j = to.length; i < il; i++, j++)
|
|
6851
|
+
to[j] = from8[i];
|
|
6852
6852
|
return to;
|
|
6853
6853
|
};
|
|
6854
6854
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -6893,9 +6893,9 @@ var require_mergeWith = __commonJS({
|
|
|
6893
6893
|
}
|
|
6894
6894
|
return ar;
|
|
6895
6895
|
};
|
|
6896
|
-
var __spreadArray = exports && exports.__spreadArray || function(to,
|
|
6897
|
-
for (var i = 0, il =
|
|
6898
|
-
to[j] =
|
|
6896
|
+
var __spreadArray = exports && exports.__spreadArray || function(to, from8) {
|
|
6897
|
+
for (var i = 0, il = from8.length, j = to.length; i < il; i++, j++)
|
|
6898
|
+
to[j] = from8[i];
|
|
6899
6899
|
return to;
|
|
6900
6900
|
};
|
|
6901
6901
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -6978,9 +6978,9 @@ var require_onErrorResumeNextWith = __commonJS({
|
|
|
6978
6978
|
}
|
|
6979
6979
|
return ar;
|
|
6980
6980
|
};
|
|
6981
|
-
var __spreadArray = exports && exports.__spreadArray || function(to,
|
|
6982
|
-
for (var i = 0, il =
|
|
6983
|
-
to[j] =
|
|
6981
|
+
var __spreadArray = exports && exports.__spreadArray || function(to, from8) {
|
|
6982
|
+
for (var i = 0, il = from8.length, j = to.length; i < il; i++, j++)
|
|
6983
|
+
to[j] = from8[i];
|
|
6984
6984
|
return to;
|
|
6985
6985
|
};
|
|
6986
6986
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -7162,9 +7162,9 @@ var require_raceWith = __commonJS({
|
|
|
7162
7162
|
}
|
|
7163
7163
|
return ar;
|
|
7164
7164
|
};
|
|
7165
|
-
var __spreadArray = exports && exports.__spreadArray || function(to,
|
|
7166
|
-
for (var i = 0, il =
|
|
7167
|
-
to[j] =
|
|
7165
|
+
var __spreadArray = exports && exports.__spreadArray || function(to, from8) {
|
|
7166
|
+
for (var i = 0, il = from8.length, j = to.length; i < il; i++, j++)
|
|
7167
|
+
to[j] = from8[i];
|
|
7168
7168
|
return to;
|
|
7169
7169
|
};
|
|
7170
7170
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -7560,9 +7560,9 @@ var require_share = __commonJS({
|
|
|
7560
7560
|
}
|
|
7561
7561
|
return ar;
|
|
7562
7562
|
};
|
|
7563
|
-
var __spreadArray = exports && exports.__spreadArray || function(to,
|
|
7564
|
-
for (var i = 0, il =
|
|
7565
|
-
to[j] =
|
|
7563
|
+
var __spreadArray = exports && exports.__spreadArray || function(to, from8) {
|
|
7564
|
+
for (var i = 0, il = from8.length, j = to.length; i < il; i++, j++)
|
|
7565
|
+
to[j] = from8[i];
|
|
7566
7566
|
return to;
|
|
7567
7567
|
};
|
|
7568
7568
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -8562,9 +8562,9 @@ var require_withLatestFrom = __commonJS({
|
|
|
8562
8562
|
}
|
|
8563
8563
|
return ar;
|
|
8564
8564
|
};
|
|
8565
|
-
var __spreadArray = exports && exports.__spreadArray || function(to,
|
|
8566
|
-
for (var i = 0, il =
|
|
8567
|
-
to[j] =
|
|
8565
|
+
var __spreadArray = exports && exports.__spreadArray || function(to, from8) {
|
|
8566
|
+
for (var i = 0, il = from8.length, j = to.length; i < il; i++, j++)
|
|
8567
|
+
to[j] = from8[i];
|
|
8568
8568
|
return to;
|
|
8569
8569
|
};
|
|
8570
8570
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -8648,9 +8648,9 @@ var require_zip2 = __commonJS({
|
|
|
8648
8648
|
}
|
|
8649
8649
|
return ar;
|
|
8650
8650
|
};
|
|
8651
|
-
var __spreadArray = exports && exports.__spreadArray || function(to,
|
|
8652
|
-
for (var i = 0, il =
|
|
8653
|
-
to[j] =
|
|
8651
|
+
var __spreadArray = exports && exports.__spreadArray || function(to, from8) {
|
|
8652
|
+
for (var i = 0, il = from8.length, j = to.length; i < il; i++, j++)
|
|
8653
|
+
to[j] = from8[i];
|
|
8654
8654
|
return to;
|
|
8655
8655
|
};
|
|
8656
8656
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -8691,9 +8691,9 @@ var require_zipWith = __commonJS({
|
|
|
8691
8691
|
}
|
|
8692
8692
|
return ar;
|
|
8693
8693
|
};
|
|
8694
|
-
var __spreadArray = exports && exports.__spreadArray || function(to,
|
|
8695
|
-
for (var i = 0, il =
|
|
8696
|
-
to[j] =
|
|
8694
|
+
var __spreadArray = exports && exports.__spreadArray || function(to, from8) {
|
|
8695
|
+
for (var i = 0, il = from8.length, j = to.length; i < il; i++, j++)
|
|
8696
|
+
to[j] = from8[i];
|
|
8697
8697
|
return to;
|
|
8698
8698
|
};
|
|
8699
8699
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -9459,9 +9459,9 @@ var require_race2 = __commonJS({
|
|
|
9459
9459
|
}
|
|
9460
9460
|
return ar;
|
|
9461
9461
|
};
|
|
9462
|
-
var __spreadArray = exports && exports.__spreadArray || function(to,
|
|
9463
|
-
for (var i = 0, il =
|
|
9464
|
-
to[j] =
|
|
9462
|
+
var __spreadArray = exports && exports.__spreadArray || function(to, from8) {
|
|
9463
|
+
for (var i = 0, il = from8.length, j = to.length; i < il; i++, j++)
|
|
9464
|
+
to[j] = from8[i];
|
|
9465
9465
|
return to;
|
|
9466
9466
|
};
|
|
9467
9467
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -9977,8 +9977,8 @@ function inferenceConfigToGenerator(workerType, config) {
|
|
|
9977
9977
|
}
|
|
9978
9978
|
|
|
9979
9979
|
// src/service.ts
|
|
9980
|
-
var
|
|
9981
|
-
var
|
|
9980
|
+
var import_rxjs9 = __toESM(require_cjs(), 1);
|
|
9981
|
+
var import_operators9 = __toESM(require_operators(), 1);
|
|
9982
9982
|
import { Readable } from "stream";
|
|
9983
9983
|
import { createInferenceClient } from "@semiont/inference";
|
|
9984
9984
|
import { getGraphDatabase } from "@semiont/graph";
|
|
@@ -9991,6 +9991,10 @@ import {
|
|
|
9991
9991
|
TagAnnotationWorker
|
|
9992
9992
|
} from "@semiont/jobs";
|
|
9993
9993
|
|
|
9994
|
+
// src/knowledge-base.ts
|
|
9995
|
+
import { FilesystemViewStorage } from "@semiont/event-sourcing";
|
|
9996
|
+
import { WorkingTreeStore } from "@semiont/content";
|
|
9997
|
+
|
|
9994
9998
|
// src/graph/consumer.ts
|
|
9995
9999
|
var import_rxjs = __toESM(require_cjs(), 1);
|
|
9996
10000
|
var import_operators = __toESM(require_operators(), 1);
|
|
@@ -10400,76 +10404,26 @@ var GraphDBConsumer = class _GraphDBConsumer {
|
|
|
10400
10404
|
}
|
|
10401
10405
|
};
|
|
10402
10406
|
|
|
10403
|
-
// src/bootstrap/entity-types.ts
|
|
10404
|
-
var import_rxjs2 = __toESM(require_cjs(), 1);
|
|
10405
|
-
var import_operators2 = __toESM(require_operators(), 1);
|
|
10406
|
-
import { promises as fs } from "fs";
|
|
10407
|
-
import * as path from "path";
|
|
10408
|
-
import { DEFAULT_ENTITY_TYPES } from "@semiont/ontology";
|
|
10409
|
-
import { userId } from "@semiont/core";
|
|
10410
|
-
var bootstrapCompleted = false;
|
|
10411
|
-
async function bootstrapEntityTypes(eventBus, project, logger) {
|
|
10412
|
-
if (bootstrapCompleted) {
|
|
10413
|
-
logger?.debug("Entity types bootstrap already completed, skipping");
|
|
10414
|
-
return;
|
|
10415
|
-
}
|
|
10416
|
-
const projectionPath = path.join(
|
|
10417
|
-
project.stateDir,
|
|
10418
|
-
"projections",
|
|
10419
|
-
"__system__",
|
|
10420
|
-
"entitytypes.json"
|
|
10421
|
-
);
|
|
10422
|
-
try {
|
|
10423
|
-
await fs.access(projectionPath);
|
|
10424
|
-
logger?.info("Entity types projection already exists, skipping bootstrap");
|
|
10425
|
-
bootstrapCompleted = true;
|
|
10426
|
-
return;
|
|
10427
|
-
} catch (error) {
|
|
10428
|
-
if (error.code !== "ENOENT") {
|
|
10429
|
-
throw error;
|
|
10430
|
-
}
|
|
10431
|
-
logger?.info("Entity types projection does not exist, bootstrapping with DEFAULT_ENTITY_TYPES");
|
|
10432
|
-
}
|
|
10433
|
-
const SYSTEM_USER_ID = userId("00000000-0000-0000-0000-000000000000");
|
|
10434
|
-
for (const entityType of DEFAULT_ENTITY_TYPES) {
|
|
10435
|
-
logger?.debug("Adding entity type via EventBus", { entityType });
|
|
10436
|
-
const result$ = (0, import_rxjs2.race)(
|
|
10437
|
-
eventBus.get("mark:entity-type-added").pipe((0, import_operators2.take)(1), (0, import_operators2.map)(() => ({ ok: true }))),
|
|
10438
|
-
eventBus.get("mark:entity-type-add-failed").pipe((0, import_operators2.take)(1), (0, import_operators2.map)((f) => ({ ok: false, error: f.error }))),
|
|
10439
|
-
(0, import_rxjs2.timer)(1e4).pipe((0, import_operators2.map)(() => ({ ok: false, error: new Error(`Timeout adding entity type: ${entityType}`) })))
|
|
10440
|
-
);
|
|
10441
|
-
eventBus.get("mark:add-entity-type").next({ tag: entityType, userId: SYSTEM_USER_ID });
|
|
10442
|
-
const outcome = await (0, import_rxjs2.firstValueFrom)(result$);
|
|
10443
|
-
if (!outcome.ok) {
|
|
10444
|
-
throw outcome.error;
|
|
10445
|
-
}
|
|
10446
|
-
}
|
|
10447
|
-
logger?.info("Entity types bootstrap completed", { count: DEFAULT_ENTITY_TYPES.length });
|
|
10448
|
-
bootstrapCompleted = true;
|
|
10449
|
-
}
|
|
10450
|
-
function resetBootstrap() {
|
|
10451
|
-
bootstrapCompleted = false;
|
|
10452
|
-
}
|
|
10453
|
-
|
|
10454
10407
|
// src/knowledge-base.ts
|
|
10455
|
-
|
|
10456
|
-
import { WorkingTreeStore } from "@semiont/content";
|
|
10457
|
-
function createKnowledgeBase(eventStore, project, graphDb, logger) {
|
|
10408
|
+
async function createKnowledgeBase(eventStore, project, graphDb, logger) {
|
|
10458
10409
|
const views = new FilesystemViewStorage(project);
|
|
10459
10410
|
const content = new WorkingTreeStore(
|
|
10460
10411
|
project,
|
|
10461
10412
|
logger.child({ component: "working-tree-store" })
|
|
10462
10413
|
);
|
|
10463
|
-
|
|
10414
|
+
const graphConsumer = new GraphDBConsumer(
|
|
10415
|
+
eventStore,
|
|
10416
|
+
graphDb,
|
|
10417
|
+
logger.child({ component: "graph-consumer" })
|
|
10418
|
+
);
|
|
10419
|
+
await graphConsumer.initialize();
|
|
10420
|
+
return { eventStore, views, content, graph: graphDb, graphConsumer, projectionsDir: project.projectionsDir };
|
|
10464
10421
|
}
|
|
10465
10422
|
|
|
10466
10423
|
// src/gatherer.ts
|
|
10467
|
-
var
|
|
10468
|
-
var
|
|
10469
|
-
import { annotationId as makeAnnotationId2
|
|
10470
|
-
import { EventQuery as EventQuery2 } from "@semiont/event-sourcing";
|
|
10471
|
-
import { getResourceEntityTypes as getResourceEntityTypes4, getBodySource as getBodySource2 } from "@semiont/api-client";
|
|
10472
|
-
import { getEntityTypes as getEntityTypes2 } from "@semiont/ontology";
|
|
10424
|
+
var import_rxjs2 = __toESM(require_cjs(), 1);
|
|
10425
|
+
var import_operators2 = __toESM(require_operators(), 1);
|
|
10426
|
+
import { annotationId as makeAnnotationId2 } from "@semiont/core";
|
|
10473
10427
|
|
|
10474
10428
|
// src/generation/resource-generation.ts
|
|
10475
10429
|
async function generateResourceSummary(resourceName, content, entityTypes, client) {
|
|
@@ -11161,35 +11115,12 @@ var LLMContext = class {
|
|
|
11161
11115
|
}
|
|
11162
11116
|
};
|
|
11163
11117
|
|
|
11164
|
-
// src/views/entity-types-reader.ts
|
|
11165
|
-
import { promises as fs2 } from "fs";
|
|
11166
|
-
import * as path2 from "path";
|
|
11167
|
-
async function readEntityTypesProjection(project) {
|
|
11168
|
-
const entityTypesPath = path2.join(
|
|
11169
|
-
project.stateDir,
|
|
11170
|
-
"projections",
|
|
11171
|
-
"__system__",
|
|
11172
|
-
"entitytypes.json"
|
|
11173
|
-
);
|
|
11174
|
-
try {
|
|
11175
|
-
const content = await fs2.readFile(entityTypesPath, "utf-8");
|
|
11176
|
-
const projection = JSON.parse(content);
|
|
11177
|
-
return projection.entityTypes || [];
|
|
11178
|
-
} catch (error) {
|
|
11179
|
-
if (error.code === "ENOENT") {
|
|
11180
|
-
return [];
|
|
11181
|
-
}
|
|
11182
|
-
throw error;
|
|
11183
|
-
}
|
|
11184
|
-
}
|
|
11185
|
-
|
|
11186
11118
|
// src/gatherer.ts
|
|
11187
11119
|
var Gatherer = class {
|
|
11188
|
-
constructor(kb, eventBus, inferenceClient, logger
|
|
11120
|
+
constructor(kb, eventBus, inferenceClient, logger) {
|
|
11189
11121
|
this.kb = kb;
|
|
11190
11122
|
this.eventBus = eventBus;
|
|
11191
11123
|
this.inferenceClient = inferenceClient;
|
|
11192
|
-
this.project = project;
|
|
11193
11124
|
this.logger = logger;
|
|
11194
11125
|
}
|
|
11195
11126
|
subscriptions = [];
|
|
@@ -11198,52 +11129,24 @@ var Gatherer = class {
|
|
|
11198
11129
|
this.logger.info("Gatherer actor initialized");
|
|
11199
11130
|
const errorHandler = (err) => this.logger.error("Gatherer pipeline error", { error: err });
|
|
11200
11131
|
const annotationGather$ = this.eventBus.get("gather:requested").pipe(
|
|
11201
|
-
(0,
|
|
11202
|
-
(0,
|
|
11132
|
+
(0, import_operators2.groupBy)((event) => event.resourceId),
|
|
11133
|
+
(0, import_operators2.mergeMap)(
|
|
11203
11134
|
(group$) => group$.pipe(
|
|
11204
|
-
(0,
|
|
11135
|
+
(0, import_operators2.concatMap)((event) => (0, import_rxjs2.from)(this.handleAnnotationGather(event)))
|
|
11205
11136
|
)
|
|
11206
11137
|
)
|
|
11207
11138
|
);
|
|
11208
11139
|
const resourceGather$ = this.eventBus.get("gather:resource-requested").pipe(
|
|
11209
|
-
(0,
|
|
11210
|
-
(0,
|
|
11140
|
+
(0, import_operators2.groupBy)((event) => event.resourceId),
|
|
11141
|
+
(0, import_operators2.mergeMap)(
|
|
11211
11142
|
(group$) => group$.pipe(
|
|
11212
|
-
(0,
|
|
11143
|
+
(0, import_operators2.concatMap)((event) => (0, import_rxjs2.from)(this.handleResourceGather(event)))
|
|
11213
11144
|
)
|
|
11214
11145
|
)
|
|
11215
11146
|
);
|
|
11216
|
-
const browseResource$ = this.eventBus.get("browse:resource-requested").pipe(
|
|
11217
|
-
(0, import_operators3.mergeMap)((event) => (0, import_rxjs3.from)(this.handleBrowseResource(event)))
|
|
11218
|
-
);
|
|
11219
|
-
const browseResources$ = this.eventBus.get("browse:resources-requested").pipe(
|
|
11220
|
-
(0, import_operators3.mergeMap)((event) => (0, import_rxjs3.from)(this.handleBrowseResources(event)))
|
|
11221
|
-
);
|
|
11222
|
-
const browseAnnotations$ = this.eventBus.get("browse:annotations-requested").pipe(
|
|
11223
|
-
(0, import_operators3.mergeMap)((event) => (0, import_rxjs3.from)(this.handleBrowseAnnotations(event)))
|
|
11224
|
-
);
|
|
11225
|
-
const browseAnnotation$ = this.eventBus.get("browse:annotation-requested").pipe(
|
|
11226
|
-
(0, import_operators3.mergeMap)((event) => (0, import_rxjs3.from)(this.handleBrowseAnnotation(event)))
|
|
11227
|
-
);
|
|
11228
|
-
const browseEvents$ = this.eventBus.get("browse:events-requested").pipe(
|
|
11229
|
-
(0, import_operators3.mergeMap)((event) => (0, import_rxjs3.from)(this.handleBrowseEvents(event)))
|
|
11230
|
-
);
|
|
11231
|
-
const browseAnnotationHistory$ = this.eventBus.get("browse:annotation-history-requested").pipe(
|
|
11232
|
-
(0, import_operators3.mergeMap)((event) => (0, import_rxjs3.from)(this.handleBrowseAnnotationHistory(event)))
|
|
11233
|
-
);
|
|
11234
|
-
const markEntityTypes$ = this.eventBus.get("mark:entity-types-requested").pipe(
|
|
11235
|
-
(0, import_operators3.mergeMap)((event) => (0, import_rxjs3.from)(this.handleEntityTypes(event)))
|
|
11236
|
-
);
|
|
11237
11147
|
this.subscriptions.push(
|
|
11238
11148
|
annotationGather$.subscribe({ error: errorHandler }),
|
|
11239
|
-
resourceGather$.subscribe({ error: errorHandler })
|
|
11240
|
-
browseResource$.subscribe({ error: errorHandler }),
|
|
11241
|
-
browseResources$.subscribe({ error: errorHandler }),
|
|
11242
|
-
browseAnnotations$.subscribe({ error: errorHandler }),
|
|
11243
|
-
browseAnnotation$.subscribe({ error: errorHandler }),
|
|
11244
|
-
browseEvents$.subscribe({ error: errorHandler }),
|
|
11245
|
-
browseAnnotationHistory$.subscribe({ error: errorHandler }),
|
|
11246
|
-
markEntityTypes$.subscribe({ error: errorHandler })
|
|
11149
|
+
resourceGather$.subscribe({ error: errorHandler })
|
|
11247
11150
|
);
|
|
11248
11151
|
}
|
|
11249
11152
|
// ========================================================================
|
|
@@ -11304,308 +11207,79 @@ var Gatherer = class {
|
|
|
11304
11207
|
});
|
|
11305
11208
|
}
|
|
11306
11209
|
}
|
|
11307
|
-
|
|
11308
|
-
|
|
11309
|
-
|
|
11310
|
-
|
|
11311
|
-
|
|
11312
|
-
|
|
11313
|
-
|
|
11314
|
-
const stored = await this.kb.eventStore.views.materializer.materialize(events, event.resourceId);
|
|
11315
|
-
if (!stored) {
|
|
11316
|
-
this.eventBus.get("browse:resource-failed").next({
|
|
11317
|
-
correlationId: event.correlationId,
|
|
11318
|
-
error: new Error("Resource not found")
|
|
11319
|
-
});
|
|
11320
|
-
return;
|
|
11321
|
-
}
|
|
11322
|
-
const annotations = stored.annotations.annotations;
|
|
11323
|
-
const entityReferences = annotations.filter((a) => {
|
|
11324
|
-
if (a.motivation !== "linking") return false;
|
|
11325
|
-
return getEntityTypes2({ body: a.body }).length > 0;
|
|
11326
|
-
});
|
|
11327
|
-
this.eventBus.get("browse:resource-result").next({
|
|
11328
|
-
correlationId: event.correlationId,
|
|
11329
|
-
response: {
|
|
11330
|
-
resource: stored.resource,
|
|
11331
|
-
annotations,
|
|
11332
|
-
entityReferences
|
|
11333
|
-
}
|
|
11334
|
-
});
|
|
11335
|
-
} catch (error) {
|
|
11336
|
-
this.logger.error("Browse resource failed", { resourceId: event.resourceId, error });
|
|
11337
|
-
this.eventBus.get("browse:resource-failed").next({
|
|
11338
|
-
correlationId: event.correlationId,
|
|
11339
|
-
error: error instanceof Error ? error : new Error(String(error))
|
|
11340
|
-
});
|
|
11341
|
-
}
|
|
11210
|
+
async generateAnnotationSummary(annotationId2, resourceId4) {
|
|
11211
|
+
return AnnotationContext.generateAnnotationSummary(
|
|
11212
|
+
annotationId2,
|
|
11213
|
+
resourceId4,
|
|
11214
|
+
this.kb,
|
|
11215
|
+
this.inferenceClient
|
|
11216
|
+
);
|
|
11342
11217
|
}
|
|
11343
|
-
async
|
|
11344
|
-
|
|
11345
|
-
|
|
11346
|
-
search: event.search,
|
|
11347
|
-
archived: event.archived
|
|
11348
|
-
}, this.kb);
|
|
11349
|
-
if (event.entityType) {
|
|
11350
|
-
filteredDocs = filteredDocs.filter((doc) => getResourceEntityTypes4(doc).includes(event.entityType));
|
|
11351
|
-
}
|
|
11352
|
-
const offset = event.offset ?? 0;
|
|
11353
|
-
const limit = event.limit ?? 50;
|
|
11354
|
-
const paginatedDocs = filteredDocs.slice(offset, offset + limit);
|
|
11355
|
-
const formattedDocs = event.search ? await ResourceContext.addContentPreviews(paginatedDocs, this.kb) : paginatedDocs;
|
|
11356
|
-
this.eventBus.get("browse:resources-result").next({
|
|
11357
|
-
correlationId: event.correlationId,
|
|
11358
|
-
response: {
|
|
11359
|
-
resources: formattedDocs,
|
|
11360
|
-
total: filteredDocs.length,
|
|
11361
|
-
offset,
|
|
11362
|
-
limit
|
|
11363
|
-
}
|
|
11364
|
-
});
|
|
11365
|
-
} catch (error) {
|
|
11366
|
-
this.logger.error("Browse resources failed", { error });
|
|
11367
|
-
this.eventBus.get("browse:resources-failed").next({
|
|
11368
|
-
correlationId: event.correlationId,
|
|
11369
|
-
error: error instanceof Error ? error : new Error(String(error))
|
|
11370
|
-
});
|
|
11218
|
+
async stop() {
|
|
11219
|
+
for (const sub of this.subscriptions) {
|
|
11220
|
+
sub.unsubscribe();
|
|
11371
11221
|
}
|
|
11222
|
+
this.subscriptions = [];
|
|
11223
|
+
this.logger.info("Gatherer actor stopped");
|
|
11372
11224
|
}
|
|
11373
|
-
|
|
11374
|
-
|
|
11375
|
-
|
|
11376
|
-
|
|
11377
|
-
|
|
11378
|
-
|
|
11379
|
-
|
|
11380
|
-
|
|
11381
|
-
|
|
11382
|
-
|
|
11383
|
-
|
|
11384
|
-
|
|
11385
|
-
|
|
11386
|
-
correlationId: event.correlationId,
|
|
11387
|
-
error: error instanceof Error ? error : new Error(String(error))
|
|
11388
|
-
});
|
|
11389
|
-
}
|
|
11225
|
+
};
|
|
11226
|
+
|
|
11227
|
+
// src/matcher.ts
|
|
11228
|
+
var import_rxjs3 = __toESM(require_cjs(), 1);
|
|
11229
|
+
var import_operators3 = __toESM(require_operators(), 1);
|
|
11230
|
+
import { resourceId } from "@semiont/core";
|
|
11231
|
+
import { getResourceId as getResourceId4, getResourceEntityTypes as getResourceEntityTypes4 } from "@semiont/api-client";
|
|
11232
|
+
var Matcher = class {
|
|
11233
|
+
constructor(kb, eventBus, logger, inferenceClient) {
|
|
11234
|
+
this.kb = kb;
|
|
11235
|
+
this.eventBus = eventBus;
|
|
11236
|
+
this.inferenceClient = inferenceClient;
|
|
11237
|
+
this.logger = logger;
|
|
11390
11238
|
}
|
|
11391
|
-
|
|
11239
|
+
subscriptions = [];
|
|
11240
|
+
logger;
|
|
11241
|
+
async initialize() {
|
|
11242
|
+
this.logger.info("Matcher actor initialized");
|
|
11243
|
+
const errorHandler = (err) => this.logger.error("Matcher pipeline error", { error: err });
|
|
11244
|
+
const search$ = this.eventBus.get("match:search-requested").pipe(
|
|
11245
|
+
(0, import_operators3.concatMap)((event) => (0, import_rxjs3.from)(this.handleSearch(event)))
|
|
11246
|
+
);
|
|
11247
|
+
this.subscriptions.push(
|
|
11248
|
+
search$.subscribe({ error: errorHandler })
|
|
11249
|
+
);
|
|
11250
|
+
}
|
|
11251
|
+
async handleSearch(event) {
|
|
11392
11252
|
try {
|
|
11393
|
-
const
|
|
11394
|
-
|
|
11395
|
-
|
|
11396
|
-
|
|
11397
|
-
|
|
11398
|
-
|
|
11399
|
-
|
|
11400
|
-
|
|
11401
|
-
|
|
11402
|
-
|
|
11403
|
-
const
|
|
11404
|
-
|
|
11405
|
-
|
|
11406
|
-
|
|
11407
|
-
|
|
11408
|
-
|
|
11409
|
-
|
|
11410
|
-
|
|
11411
|
-
|
|
11412
|
-
|
|
11413
|
-
}
|
|
11253
|
+
const context = event.context;
|
|
11254
|
+
const selectedText = context.sourceContext?.selected ?? "";
|
|
11255
|
+
const userHint = context.userHint ?? "";
|
|
11256
|
+
const searchTerm = [selectedText, userHint].filter(Boolean).join(" ");
|
|
11257
|
+
this.logger.debug("Searching for binding candidates", {
|
|
11258
|
+
referenceId: event.referenceId,
|
|
11259
|
+
searchTerm,
|
|
11260
|
+
limit: event.limit,
|
|
11261
|
+
useSemanticScoring: event.useSemanticScoring
|
|
11262
|
+
});
|
|
11263
|
+
const scored = await this.contextDrivenSearch(
|
|
11264
|
+
searchTerm,
|
|
11265
|
+
context,
|
|
11266
|
+
event.useSemanticScoring
|
|
11267
|
+
);
|
|
11268
|
+
const limited = event.limit ? scored.slice(0, event.limit) : scored;
|
|
11269
|
+
this.eventBus.get("match:search-results").next({
|
|
11270
|
+
referenceId: event.referenceId,
|
|
11271
|
+
results: limited,
|
|
11272
|
+
correlationId: event.correlationId
|
|
11414
11273
|
});
|
|
11415
11274
|
} catch (error) {
|
|
11416
|
-
this.logger.error("
|
|
11417
|
-
|
|
11418
|
-
|
|
11419
|
-
|
|
11420
|
-
|
|
11421
|
-
|
|
11422
|
-
|
|
11423
|
-
|
|
11424
|
-
try {
|
|
11425
|
-
const eventQuery = new EventQuery2(this.kb.eventStore.log.storage);
|
|
11426
|
-
const filters = {
|
|
11427
|
-
resourceId: event.resourceId
|
|
11428
|
-
};
|
|
11429
|
-
if (event.type) {
|
|
11430
|
-
filters.eventTypes = [event.type];
|
|
11431
|
-
}
|
|
11432
|
-
if (event.userId) {
|
|
11433
|
-
filters.userId = event.userId;
|
|
11434
|
-
}
|
|
11435
|
-
if (event.limit) {
|
|
11436
|
-
filters.limit = event.limit;
|
|
11437
|
-
}
|
|
11438
|
-
const storedEvents = await eventQuery.queryEvents(filters);
|
|
11439
|
-
const events = storedEvents.map((stored) => ({
|
|
11440
|
-
event: {
|
|
11441
|
-
id: stored.event.id,
|
|
11442
|
-
type: stored.event.type,
|
|
11443
|
-
timestamp: stored.event.timestamp,
|
|
11444
|
-
userId: stored.event.userId,
|
|
11445
|
-
resourceId: stored.event.resourceId,
|
|
11446
|
-
payload: stored.event.payload
|
|
11447
|
-
},
|
|
11448
|
-
metadata: {
|
|
11449
|
-
sequenceNumber: stored.metadata.sequenceNumber,
|
|
11450
|
-
prevEventHash: stored.metadata.prevEventHash,
|
|
11451
|
-
checksum: stored.metadata.checksum
|
|
11452
|
-
}
|
|
11453
|
-
}));
|
|
11454
|
-
this.eventBus.get("browse:events-result").next({
|
|
11455
|
-
correlationId: event.correlationId,
|
|
11456
|
-
response: {
|
|
11457
|
-
events,
|
|
11458
|
-
total: events.length,
|
|
11459
|
-
resourceId: event.resourceId
|
|
11460
|
-
}
|
|
11461
|
-
});
|
|
11462
|
-
} catch (error) {
|
|
11463
|
-
this.logger.error("Browse events failed", { resourceId: event.resourceId, error });
|
|
11464
|
-
this.eventBus.get("browse:events-failed").next({
|
|
11465
|
-
correlationId: event.correlationId,
|
|
11466
|
-
error: error instanceof Error ? error : new Error(String(error))
|
|
11467
|
-
});
|
|
11468
|
-
}
|
|
11469
|
-
}
|
|
11470
|
-
async handleBrowseAnnotationHistory(event) {
|
|
11471
|
-
try {
|
|
11472
|
-
const annotation = await AnnotationContext.getAnnotation(event.annotationId, event.resourceId, this.kb);
|
|
11473
|
-
if (!annotation) {
|
|
11474
|
-
this.eventBus.get("browse:annotation-history-failed").next({
|
|
11475
|
-
correlationId: event.correlationId,
|
|
11476
|
-
error: new Error("Annotation not found")
|
|
11477
|
-
});
|
|
11478
|
-
return;
|
|
11479
|
-
}
|
|
11480
|
-
const eventQuery = new EventQuery2(this.kb.eventStore.log.storage);
|
|
11481
|
-
const allEvents = await eventQuery.queryEvents({ resourceId: event.resourceId });
|
|
11482
|
-
const annotationEvents = allEvents.filter((stored) => {
|
|
11483
|
-
const ev = stored.event;
|
|
11484
|
-
if ("highlightId" in ev.payload && ev.payload.highlightId === event.annotationId) return true;
|
|
11485
|
-
if ("referenceId" in ev.payload && ev.payload.referenceId === event.annotationId) return true;
|
|
11486
|
-
return false;
|
|
11487
|
-
});
|
|
11488
|
-
const events = annotationEvents.map((stored) => ({
|
|
11489
|
-
id: stored.event.id,
|
|
11490
|
-
type: stored.event.type,
|
|
11491
|
-
timestamp: stored.event.timestamp,
|
|
11492
|
-
userId: stored.event.userId,
|
|
11493
|
-
resourceId: stored.event.resourceId,
|
|
11494
|
-
payload: stored.event.payload,
|
|
11495
|
-
metadata: {
|
|
11496
|
-
sequenceNumber: stored.metadata.sequenceNumber,
|
|
11497
|
-
prevEventHash: stored.metadata.prevEventHash,
|
|
11498
|
-
checksum: stored.metadata.checksum
|
|
11499
|
-
}
|
|
11500
|
-
}));
|
|
11501
|
-
events.sort((a, b) => a.metadata.sequenceNumber - b.metadata.sequenceNumber);
|
|
11502
|
-
this.eventBus.get("browse:annotation-history-result").next({
|
|
11503
|
-
correlationId: event.correlationId,
|
|
11504
|
-
response: {
|
|
11505
|
-
events,
|
|
11506
|
-
total: events.length,
|
|
11507
|
-
annotationId: event.annotationId,
|
|
11508
|
-
resourceId: event.resourceId
|
|
11509
|
-
}
|
|
11510
|
-
});
|
|
11511
|
-
} catch (error) {
|
|
11512
|
-
this.logger.error("Browse annotation history failed", { resourceId: event.resourceId, annotationId: event.annotationId, error });
|
|
11513
|
-
this.eventBus.get("browse:annotation-history-failed").next({
|
|
11514
|
-
correlationId: event.correlationId,
|
|
11515
|
-
error: error instanceof Error ? error : new Error(String(error))
|
|
11516
|
-
});
|
|
11517
|
-
}
|
|
11518
|
-
}
|
|
11519
|
-
// ========================================================================
|
|
11520
|
-
// Mark handlers (entity type reads)
|
|
11521
|
-
// ========================================================================
|
|
11522
|
-
async handleEntityTypes(event) {
|
|
11523
|
-
try {
|
|
11524
|
-
if (!this.project) {
|
|
11525
|
-
throw new Error("SemiontProject required for entity type reads");
|
|
11526
|
-
}
|
|
11527
|
-
const entityTypes = await readEntityTypesProjection(this.project);
|
|
11528
|
-
this.eventBus.get("mark:entity-types-result").next({
|
|
11529
|
-
correlationId: event.correlationId,
|
|
11530
|
-
response: { entityTypes }
|
|
11531
|
-
});
|
|
11532
|
-
} catch (error) {
|
|
11533
|
-
this.logger.error("Entity types read failed", { error });
|
|
11534
|
-
this.eventBus.get("mark:entity-types-failed").next({
|
|
11535
|
-
correlationId: event.correlationId,
|
|
11536
|
-
error: error instanceof Error ? error : new Error(String(error))
|
|
11537
|
-
});
|
|
11538
|
-
}
|
|
11539
|
-
}
|
|
11540
|
-
async stop() {
|
|
11541
|
-
for (const sub of this.subscriptions) {
|
|
11542
|
-
sub.unsubscribe();
|
|
11543
|
-
}
|
|
11544
|
-
this.subscriptions = [];
|
|
11545
|
-
this.logger.info("Gatherer actor stopped");
|
|
11546
|
-
}
|
|
11547
|
-
};
|
|
11548
|
-
|
|
11549
|
-
// src/matcher.ts
|
|
11550
|
-
var import_rxjs4 = __toESM(require_cjs(), 1);
|
|
11551
|
-
var import_operators4 = __toESM(require_operators(), 1);
|
|
11552
|
-
import { resourceId as resourceId2 } from "@semiont/core";
|
|
11553
|
-
import { getExactText, getResourceId as getResourceId4, getResourceEntityTypes as getResourceEntityTypes5, getTargetSource as getTargetSource2, getTargetSelector as getTargetSelector2 } from "@semiont/api-client";
|
|
11554
|
-
var Matcher = class {
|
|
11555
|
-
constructor(kb, eventBus, logger, inferenceClient) {
|
|
11556
|
-
this.kb = kb;
|
|
11557
|
-
this.eventBus = eventBus;
|
|
11558
|
-
this.inferenceClient = inferenceClient;
|
|
11559
|
-
this.logger = logger;
|
|
11560
|
-
}
|
|
11561
|
-
subscriptions = [];
|
|
11562
|
-
logger;
|
|
11563
|
-
async initialize() {
|
|
11564
|
-
this.logger.info("Matcher actor initialized");
|
|
11565
|
-
const errorHandler = (err) => this.logger.error("Matcher pipeline error", { error: err });
|
|
11566
|
-
const search$ = this.eventBus.get("bind:search-requested").pipe(
|
|
11567
|
-
(0, import_operators4.concatMap)((event) => (0, import_rxjs4.from)(this.handleSearch(event)))
|
|
11568
|
-
);
|
|
11569
|
-
const referencedBy$ = this.eventBus.get("bind:referenced-by-requested").pipe(
|
|
11570
|
-
(0, import_operators4.mergeMap)((event) => (0, import_rxjs4.from)(this.handleReferencedBy(event)))
|
|
11571
|
-
);
|
|
11572
|
-
this.subscriptions.push(
|
|
11573
|
-
search$.subscribe({ error: errorHandler }),
|
|
11574
|
-
referencedBy$.subscribe({ error: errorHandler })
|
|
11575
|
-
);
|
|
11576
|
-
}
|
|
11577
|
-
async handleSearch(event) {
|
|
11578
|
-
try {
|
|
11579
|
-
const context = event.context;
|
|
11580
|
-
const selectedText = context.sourceContext?.selected ?? "";
|
|
11581
|
-
const userHint = context.userHint ?? "";
|
|
11582
|
-
const searchTerm = [selectedText, userHint].filter(Boolean).join(" ");
|
|
11583
|
-
this.logger.debug("Searching for binding candidates", {
|
|
11584
|
-
referenceId: event.referenceId,
|
|
11585
|
-
searchTerm,
|
|
11586
|
-
limit: event.limit,
|
|
11587
|
-
useSemanticScoring: event.useSemanticScoring
|
|
11588
|
-
});
|
|
11589
|
-
const scored = await this.contextDrivenSearch(
|
|
11590
|
-
searchTerm,
|
|
11591
|
-
context,
|
|
11592
|
-
event.useSemanticScoring
|
|
11593
|
-
);
|
|
11594
|
-
const limited = event.limit ? scored.slice(0, event.limit) : scored;
|
|
11595
|
-
this.eventBus.get("bind:search-results").next({
|
|
11596
|
-
referenceId: event.referenceId,
|
|
11597
|
-
results: limited,
|
|
11598
|
-
correlationId: event.correlationId
|
|
11599
|
-
});
|
|
11600
|
-
} catch (error) {
|
|
11601
|
-
this.logger.error("Bind search failed", {
|
|
11602
|
-
referenceId: event.referenceId,
|
|
11603
|
-
error
|
|
11604
|
-
});
|
|
11605
|
-
this.eventBus.get("bind:search-failed").next({
|
|
11606
|
-
referenceId: event.referenceId,
|
|
11607
|
-
error: error instanceof Error ? error : new Error(String(error)),
|
|
11608
|
-
correlationId: event.correlationId
|
|
11275
|
+
this.logger.error("Bind search failed", {
|
|
11276
|
+
referenceId: event.referenceId,
|
|
11277
|
+
error
|
|
11278
|
+
});
|
|
11279
|
+
this.eventBus.get("match:search-failed").next({
|
|
11280
|
+
referenceId: event.referenceId,
|
|
11281
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
11282
|
+
correlationId: event.correlationId
|
|
11609
11283
|
});
|
|
11610
11284
|
}
|
|
11611
11285
|
}
|
|
@@ -11633,7 +11307,7 @@ var Matcher = class {
|
|
|
11633
11307
|
]);
|
|
11634
11308
|
const neighborResources = await Promise.all(
|
|
11635
11309
|
connections.map(
|
|
11636
|
-
(conn) => this.kb.graph.getResource(
|
|
11310
|
+
(conn) => this.kb.graph.getResource(resourceId(conn.resourceId)).catch(() => null)
|
|
11637
11311
|
)
|
|
11638
11312
|
);
|
|
11639
11313
|
const candidateMap = /* @__PURE__ */ new Map();
|
|
@@ -11666,7 +11340,7 @@ var Matcher = class {
|
|
|
11666
11340
|
const searchTermLower = searchTerm.toLowerCase();
|
|
11667
11341
|
const scored = Array.from(candidateMap.values()).map(({ resource, sources }) => {
|
|
11668
11342
|
const id = getResourceId4(resource) ?? "";
|
|
11669
|
-
const candidateEntityTypes =
|
|
11343
|
+
const candidateEntityTypes = getResourceEntityTypes4(resource);
|
|
11670
11344
|
const reasons = [];
|
|
11671
11345
|
let score = 0;
|
|
11672
11346
|
if (annotationEntityTypes.length > 0 && candidateEntityTypes.length > 0) {
|
|
@@ -11722,7 +11396,7 @@ var Matcher = class {
|
|
|
11722
11396
|
matchReason: reasons.join("; ") || "candidate"
|
|
11723
11397
|
};
|
|
11724
11398
|
});
|
|
11725
|
-
if (
|
|
11399
|
+
if (scored.length > 0 && useSemanticScoring !== false) {
|
|
11726
11400
|
try {
|
|
11727
11401
|
const inferenceScores = await this.inferenceSemanticScore(
|
|
11728
11402
|
searchTerm,
|
|
@@ -11762,14 +11436,13 @@ var Matcher = class {
|
|
|
11762
11436
|
* @returns Map of resourceId → score (0-1)
|
|
11763
11437
|
*/
|
|
11764
11438
|
async inferenceSemanticScore(searchTerm, context, candidates) {
|
|
11765
|
-
if (!this.inferenceClient) return /* @__PURE__ */ new Map();
|
|
11766
11439
|
const passage = [context.sourceContext?.selected, context.userHint].filter(Boolean).join(" \u2014 ") || searchTerm;
|
|
11767
11440
|
const entityTypes = context.metadata?.entityTypes ?? [];
|
|
11768
11441
|
const graphConnections = context.graphContext?.connections;
|
|
11769
11442
|
const connections = graphConnections ?? [];
|
|
11770
11443
|
const candidateLines = candidates.map((c, i) => {
|
|
11771
11444
|
const id = getResourceId4(c) ?? "";
|
|
11772
|
-
const cEntityTypes =
|
|
11445
|
+
const cEntityTypes = getResourceEntityTypes4(c);
|
|
11773
11446
|
return `${i + 1}. "${c.name}" (id: ${id}, types: ${cEntityTypes.join(", ") || "none"})`;
|
|
11774
11447
|
}).join("\n");
|
|
11775
11448
|
const contextParts = [];
|
|
@@ -11824,51 +11497,6 @@ No explanations.`;
|
|
|
11824
11497
|
});
|
|
11825
11498
|
return scores;
|
|
11826
11499
|
}
|
|
11827
|
-
async handleReferencedBy(event) {
|
|
11828
|
-
try {
|
|
11829
|
-
this.logger.debug("Looking for annotations referencing resource", {
|
|
11830
|
-
resourceId: event.resourceId,
|
|
11831
|
-
motivation: event.motivation || "all"
|
|
11832
|
-
});
|
|
11833
|
-
const references = await this.kb.graph.getResourceReferencedBy(event.resourceId, event.motivation);
|
|
11834
|
-
const sourceIds = [...new Set(references.map((ref) => getTargetSource2(ref.target)))];
|
|
11835
|
-
const resources = await Promise.all(sourceIds.map((id) => this.kb.graph.getResource(resourceId2(id))));
|
|
11836
|
-
for (let i = 0; i < sourceIds.length; i++) {
|
|
11837
|
-
if (resources[i] === null) {
|
|
11838
|
-
this.logger.warn("Referenced resource not found in graph", { resourceId: sourceIds[i] });
|
|
11839
|
-
}
|
|
11840
|
-
}
|
|
11841
|
-
const docMap = new Map(resources.filter((doc) => doc !== null).map((doc) => [doc["@id"], doc]));
|
|
11842
|
-
const referencedBy = references.map((ref) => {
|
|
11843
|
-
const targetSource = getTargetSource2(ref.target);
|
|
11844
|
-
const targetSelector = getTargetSelector2(ref.target);
|
|
11845
|
-
const doc = docMap.get(targetSource);
|
|
11846
|
-
return {
|
|
11847
|
-
id: ref.id,
|
|
11848
|
-
resourceName: doc?.name || "Untitled Resource",
|
|
11849
|
-
target: {
|
|
11850
|
-
source: targetSource,
|
|
11851
|
-
selector: {
|
|
11852
|
-
exact: targetSelector ? getExactText(targetSelector) : ""
|
|
11853
|
-
}
|
|
11854
|
-
}
|
|
11855
|
-
};
|
|
11856
|
-
});
|
|
11857
|
-
this.eventBus.get("bind:referenced-by-result").next({
|
|
11858
|
-
correlationId: event.correlationId,
|
|
11859
|
-
response: { referencedBy }
|
|
11860
|
-
});
|
|
11861
|
-
} catch (error) {
|
|
11862
|
-
this.logger.error("Referenced-by query failed", {
|
|
11863
|
-
resourceId: event.resourceId,
|
|
11864
|
-
error
|
|
11865
|
-
});
|
|
11866
|
-
this.eventBus.get("bind:referenced-by-failed").next({
|
|
11867
|
-
correlationId: event.correlationId,
|
|
11868
|
-
error: error instanceof Error ? error : new Error(String(error))
|
|
11869
|
-
});
|
|
11870
|
-
}
|
|
11871
|
-
}
|
|
11872
11500
|
async stop() {
|
|
11873
11501
|
for (const sub of this.subscriptions) {
|
|
11874
11502
|
sub.unsubscribe();
|
|
@@ -11879,10 +11507,10 @@ No explanations.`;
|
|
|
11879
11507
|
};
|
|
11880
11508
|
|
|
11881
11509
|
// src/stower.ts
|
|
11882
|
-
var
|
|
11883
|
-
var
|
|
11884
|
-
import { promises as
|
|
11885
|
-
import { resourceId as
|
|
11510
|
+
var import_rxjs4 = __toESM(require_cjs(), 1);
|
|
11511
|
+
var import_operators4 = __toESM(require_operators(), 1);
|
|
11512
|
+
import { promises as fs } from "fs";
|
|
11513
|
+
import { resourceId as resourceId2, annotationId as makeAnnotationId3, CREATION_METHODS, generateUuid } from "@semiont/core";
|
|
11886
11514
|
import { resolveStorageUri } from "@semiont/event-sourcing";
|
|
11887
11515
|
import { getExtensionForMimeType } from "@semiont/content";
|
|
11888
11516
|
var Stower = class {
|
|
@@ -11895,8 +11523,8 @@ var Stower = class {
|
|
|
11895
11523
|
logger;
|
|
11896
11524
|
async initialize() {
|
|
11897
11525
|
this.logger.info("Stower actor initialized");
|
|
11898
|
-
const pipe = (event, handler) => this.eventBus.get(event).pipe((0,
|
|
11899
|
-
this.subscription = (0,
|
|
11526
|
+
const pipe = (event, handler) => this.eventBus.get(event).pipe((0, import_operators4.concatMap)((e) => (0, import_rxjs4.from)(handler(e))));
|
|
11527
|
+
this.subscription = (0, import_rxjs4.merge)(
|
|
11900
11528
|
pipe("yield:create", (e) => this.handleYieldCreate(e)),
|
|
11901
11529
|
pipe("yield:update", (e) => this.handleYieldUpdate(e)),
|
|
11902
11530
|
pipe("yield:mv", (e) => this.handleYieldMv(e)),
|
|
@@ -11920,7 +11548,7 @@ var Stower = class {
|
|
|
11920
11548
|
// ========================================================================
|
|
11921
11549
|
async handleYieldCreate(event) {
|
|
11922
11550
|
try {
|
|
11923
|
-
const rId =
|
|
11551
|
+
const rId = resourceId2(generateUuid());
|
|
11924
11552
|
let checksum;
|
|
11925
11553
|
let byteSize;
|
|
11926
11554
|
const resolvedStorageUri = event.storageUri ?? deriveStorageUri(event.name, event.format);
|
|
@@ -11954,7 +11582,8 @@ var Stower = class {
|
|
|
11954
11582
|
language: event.language || void 0,
|
|
11955
11583
|
isDraft: event.isDraft ?? false,
|
|
11956
11584
|
generatedFrom: event.generatedFrom,
|
|
11957
|
-
generationPrompt: event.generationPrompt
|
|
11585
|
+
generationPrompt: event.generationPrompt,
|
|
11586
|
+
generator: event.generator
|
|
11958
11587
|
}
|
|
11959
11588
|
});
|
|
11960
11589
|
const resource = {
|
|
@@ -12095,148 +11724,581 @@ var Stower = class {
|
|
|
12095
11724
|
version: 1,
|
|
12096
11725
|
payload: { annotationId: event.annotationId, operations: event.operations }
|
|
12097
11726
|
});
|
|
12098
|
-
this.eventBus.get("mark:body-updated").next(stored.event);
|
|
11727
|
+
this.eventBus.get("mark:body-updated").next(stored.event);
|
|
11728
|
+
} catch (error) {
|
|
11729
|
+
this.logger.error("Failed to update annotation body", { error });
|
|
11730
|
+
this.eventBus.get("mark:body-update-failed").next({
|
|
11731
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
11732
|
+
});
|
|
11733
|
+
}
|
|
11734
|
+
}
|
|
11735
|
+
async handleMarkArchive(event) {
|
|
11736
|
+
if (!event || typeof event !== "object" || !("userId" in event) || !("resourceId" in event) || !event.resourceId) {
|
|
11737
|
+
return;
|
|
11738
|
+
}
|
|
11739
|
+
if (event.storageUri) {
|
|
11740
|
+
await this.kb.content.remove(event.storageUri, { keepFile: event.keepFile, noGit: event.noGit });
|
|
11741
|
+
}
|
|
11742
|
+
await this.kb.eventStore.appendEvent({
|
|
11743
|
+
type: "resource.archived",
|
|
11744
|
+
resourceId: event.resourceId,
|
|
11745
|
+
userId: event.userId,
|
|
11746
|
+
version: 1,
|
|
11747
|
+
payload: { reason: void 0 }
|
|
11748
|
+
});
|
|
11749
|
+
}
|
|
11750
|
+
async handleMarkUnarchive(event) {
|
|
11751
|
+
if (!event || typeof event !== "object" || !("userId" in event) || !("resourceId" in event) || !event.resourceId) {
|
|
11752
|
+
return;
|
|
11753
|
+
}
|
|
11754
|
+
if (event.storageUri) {
|
|
11755
|
+
const absPath = this.kb.content.resolveUri(event.storageUri);
|
|
11756
|
+
try {
|
|
11757
|
+
await fs.access(absPath);
|
|
11758
|
+
} catch {
|
|
11759
|
+
this.logger.warn("Unarchive failed: file not found at storageUri", { storageUri: event.storageUri });
|
|
11760
|
+
return;
|
|
11761
|
+
}
|
|
11762
|
+
}
|
|
11763
|
+
await this.kb.eventStore.appendEvent({
|
|
11764
|
+
type: "resource.unarchived",
|
|
11765
|
+
resourceId: event.resourceId,
|
|
11766
|
+
userId: event.userId,
|
|
11767
|
+
version: 1,
|
|
11768
|
+
payload: {}
|
|
11769
|
+
});
|
|
11770
|
+
}
|
|
11771
|
+
async handleAddEntityType(event) {
|
|
11772
|
+
try {
|
|
11773
|
+
await this.kb.eventStore.appendEvent({
|
|
11774
|
+
type: "entitytype.added",
|
|
11775
|
+
userId: event.userId,
|
|
11776
|
+
version: 1,
|
|
11777
|
+
payload: { entityType: event.tag }
|
|
11778
|
+
});
|
|
11779
|
+
this.eventBus.get("mark:entity-type-added").next({ tag: event.tag });
|
|
11780
|
+
} catch (error) {
|
|
11781
|
+
this.logger.error("Failed to add entity type", { error });
|
|
11782
|
+
this.eventBus.get("mark:entity-type-add-failed").next({
|
|
11783
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
11784
|
+
});
|
|
11785
|
+
}
|
|
11786
|
+
}
|
|
11787
|
+
async handleUpdateEntityTypes(event) {
|
|
11788
|
+
const added = event.updatedEntityTypes.filter((et) => !event.currentEntityTypes.includes(et));
|
|
11789
|
+
const removed = event.currentEntityTypes.filter((et) => !event.updatedEntityTypes.includes(et));
|
|
11790
|
+
for (const entityType of added) {
|
|
11791
|
+
await this.kb.eventStore.appendEvent({
|
|
11792
|
+
type: "entitytag.added",
|
|
11793
|
+
resourceId: event.resourceId,
|
|
11794
|
+
userId: event.userId,
|
|
11795
|
+
version: 1,
|
|
11796
|
+
payload: { entityType }
|
|
11797
|
+
});
|
|
11798
|
+
}
|
|
11799
|
+
for (const entityType of removed) {
|
|
11800
|
+
await this.kb.eventStore.appendEvent({
|
|
11801
|
+
type: "entitytag.removed",
|
|
11802
|
+
resourceId: event.resourceId,
|
|
11803
|
+
userId: event.userId,
|
|
11804
|
+
version: 1,
|
|
11805
|
+
payload: { entityType }
|
|
11806
|
+
});
|
|
11807
|
+
}
|
|
11808
|
+
}
|
|
11809
|
+
async handleJobStart(event) {
|
|
11810
|
+
await this.kb.eventStore.appendEvent({
|
|
11811
|
+
type: "job.started",
|
|
11812
|
+
resourceId: event.resourceId,
|
|
11813
|
+
userId: event.userId,
|
|
11814
|
+
version: 1,
|
|
11815
|
+
payload: { jobId: event.jobId, jobType: event.jobType }
|
|
11816
|
+
});
|
|
11817
|
+
}
|
|
11818
|
+
async handleJobReportProgress(event) {
|
|
11819
|
+
await this.kb.eventStore.appendEvent({
|
|
11820
|
+
type: "job.progress",
|
|
11821
|
+
resourceId: event.resourceId,
|
|
11822
|
+
userId: event.userId,
|
|
11823
|
+
version: 1,
|
|
11824
|
+
payload: {
|
|
11825
|
+
jobId: event.jobId,
|
|
11826
|
+
jobType: event.jobType,
|
|
11827
|
+
percentage: event.percentage,
|
|
11828
|
+
progress: event.progress
|
|
11829
|
+
}
|
|
11830
|
+
});
|
|
11831
|
+
}
|
|
11832
|
+
async handleJobComplete(event) {
|
|
11833
|
+
await this.kb.eventStore.appendEvent({
|
|
11834
|
+
type: "job.completed",
|
|
11835
|
+
resourceId: event.resourceId,
|
|
11836
|
+
userId: event.userId,
|
|
11837
|
+
version: 1,
|
|
11838
|
+
payload: {
|
|
11839
|
+
jobId: event.jobId,
|
|
11840
|
+
jobType: event.jobType,
|
|
11841
|
+
result: event.result
|
|
11842
|
+
}
|
|
11843
|
+
});
|
|
11844
|
+
}
|
|
11845
|
+
async handleJobFail(event) {
|
|
11846
|
+
await this.kb.eventStore.appendEvent({
|
|
11847
|
+
type: "job.failed",
|
|
11848
|
+
resourceId: event.resourceId,
|
|
11849
|
+
userId: event.userId,
|
|
11850
|
+
version: 1,
|
|
11851
|
+
payload: {
|
|
11852
|
+
jobId: event.jobId,
|
|
11853
|
+
jobType: event.jobType,
|
|
11854
|
+
error: event.error
|
|
11855
|
+
}
|
|
11856
|
+
});
|
|
11857
|
+
}
|
|
11858
|
+
async stop() {
|
|
11859
|
+
this.subscription?.unsubscribe();
|
|
11860
|
+
this.subscription = null;
|
|
11861
|
+
this.logger.info("Stower actor stopped");
|
|
11862
|
+
}
|
|
11863
|
+
};
|
|
11864
|
+
function deriveStorageUri(name, format) {
|
|
11865
|
+
const slug = name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
11866
|
+
const ext = getExtensionForMimeType(format);
|
|
11867
|
+
return `file://${slug}${ext}`;
|
|
11868
|
+
}
|
|
11869
|
+
|
|
11870
|
+
// src/browser.ts
|
|
11871
|
+
var import_rxjs5 = __toESM(require_cjs(), 1);
|
|
11872
|
+
var import_operators5 = __toESM(require_operators(), 1);
|
|
11873
|
+
import { promises as fs3 } from "fs";
|
|
11874
|
+
import * as path2 from "path";
|
|
11875
|
+
import { resourceId as resourceId3 } from "@semiont/core";
|
|
11876
|
+
import { getExactText, getTargetSource as getTargetSource2, getTargetSelector as getTargetSelector2, getResourceEntityTypes as getResourceEntityTypes5, getBodySource as getBodySource2 } from "@semiont/api-client";
|
|
11877
|
+
import { EventQuery as EventQuery2 } from "@semiont/event-sourcing";
|
|
11878
|
+
import { getEntityTypes as getEntityTypes2 } from "@semiont/ontology";
|
|
11879
|
+
|
|
11880
|
+
// src/views/entity-types-reader.ts
|
|
11881
|
+
import { promises as fs2 } from "fs";
|
|
11882
|
+
import * as path from "path";
|
|
11883
|
+
async function readEntityTypesProjection(project) {
|
|
11884
|
+
const entityTypesPath = path.join(
|
|
11885
|
+
project.stateDir,
|
|
11886
|
+
"projections",
|
|
11887
|
+
"__system__",
|
|
11888
|
+
"entitytypes.json"
|
|
11889
|
+
);
|
|
11890
|
+
try {
|
|
11891
|
+
const content = await fs2.readFile(entityTypesPath, "utf-8");
|
|
11892
|
+
const projection = JSON.parse(content);
|
|
11893
|
+
return projection.entityTypes || [];
|
|
11894
|
+
} catch (error) {
|
|
11895
|
+
if (error.code === "ENOENT") {
|
|
11896
|
+
return [];
|
|
11897
|
+
}
|
|
11898
|
+
throw error;
|
|
11899
|
+
}
|
|
11900
|
+
}
|
|
11901
|
+
|
|
11902
|
+
// src/browser.ts
|
|
11903
|
+
var Browser = class {
|
|
11904
|
+
constructor(views, kb, eventBus, project, logger) {
|
|
11905
|
+
this.views = views;
|
|
11906
|
+
this.kb = kb;
|
|
11907
|
+
this.eventBus = eventBus;
|
|
11908
|
+
this.project = project;
|
|
11909
|
+
this.logger = logger;
|
|
11910
|
+
}
|
|
11911
|
+
subscriptions = [];
|
|
11912
|
+
logger;
|
|
11913
|
+
async initialize() {
|
|
11914
|
+
this.logger.info("Browser actor initialized");
|
|
11915
|
+
const errorHandler = (err) => this.logger.error("Browser pipeline error", { error: err });
|
|
11916
|
+
const pipe = (name, handler) => this.eventBus.get(name).pipe((0, import_operators5.mergeMap)((event) => (0, import_rxjs5.from)(handler(event))));
|
|
11917
|
+
this.subscriptions.push(
|
|
11918
|
+
pipe("browse:resource-requested", (e) => this.handleBrowseResource(e)).subscribe({ error: errorHandler }),
|
|
11919
|
+
pipe("browse:resources-requested", (e) => this.handleBrowseResources(e)).subscribe({ error: errorHandler }),
|
|
11920
|
+
pipe("browse:annotations-requested", (e) => this.handleBrowseAnnotations(e)).subscribe({ error: errorHandler }),
|
|
11921
|
+
pipe("browse:annotation-requested", (e) => this.handleBrowseAnnotation(e)).subscribe({ error: errorHandler }),
|
|
11922
|
+
pipe("browse:events-requested", (e) => this.handleBrowseEvents(e)).subscribe({ error: errorHandler }),
|
|
11923
|
+
pipe("browse:annotation-history-requested", (e) => this.handleBrowseAnnotationHistory(e)).subscribe({ error: errorHandler }),
|
|
11924
|
+
pipe("browse:referenced-by-requested", (e) => this.handleReferencedBy(e)).subscribe({ error: errorHandler }),
|
|
11925
|
+
pipe("browse:entity-types-requested", (e) => this.handleEntityTypes(e)).subscribe({ error: errorHandler }),
|
|
11926
|
+
pipe("browse:directory-requested", (e) => this.handleBrowseDirectory(e)).subscribe({ error: errorHandler })
|
|
11927
|
+
);
|
|
11928
|
+
}
|
|
11929
|
+
// ========================================================================
|
|
11930
|
+
// KB read handlers
|
|
11931
|
+
// ========================================================================
|
|
11932
|
+
async handleBrowseResource(event) {
|
|
11933
|
+
try {
|
|
11934
|
+
const eventQuery = new EventQuery2(this.kb.eventStore.log.storage);
|
|
11935
|
+
const events = await eventQuery.getResourceEvents(event.resourceId);
|
|
11936
|
+
const stored = await this.kb.eventStore.views.materializer.materialize(events, event.resourceId);
|
|
11937
|
+
if (!stored) {
|
|
11938
|
+
this.eventBus.get("browse:resource-failed").next({
|
|
11939
|
+
correlationId: event.correlationId,
|
|
11940
|
+
error: new Error("Resource not found")
|
|
11941
|
+
});
|
|
11942
|
+
return;
|
|
11943
|
+
}
|
|
11944
|
+
const annotations = stored.annotations.annotations;
|
|
11945
|
+
const entityReferences = annotations.filter((a) => {
|
|
11946
|
+
if (a.motivation !== "linking") return false;
|
|
11947
|
+
return getEntityTypes2({ body: a.body }).length > 0;
|
|
11948
|
+
});
|
|
11949
|
+
this.eventBus.get("browse:resource-result").next({
|
|
11950
|
+
correlationId: event.correlationId,
|
|
11951
|
+
response: {
|
|
11952
|
+
resource: stored.resource,
|
|
11953
|
+
annotations,
|
|
11954
|
+
entityReferences
|
|
11955
|
+
}
|
|
11956
|
+
});
|
|
11957
|
+
} catch (error) {
|
|
11958
|
+
this.logger.error("Browse resource failed", { resourceId: event.resourceId, error });
|
|
11959
|
+
this.eventBus.get("browse:resource-failed").next({
|
|
11960
|
+
correlationId: event.correlationId,
|
|
11961
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
11962
|
+
});
|
|
11963
|
+
}
|
|
11964
|
+
}
|
|
11965
|
+
async handleBrowseResources(event) {
|
|
11966
|
+
try {
|
|
11967
|
+
let filteredDocs = await ResourceContext.listResources({
|
|
11968
|
+
search: event.search,
|
|
11969
|
+
archived: event.archived
|
|
11970
|
+
}, this.kb);
|
|
11971
|
+
if (event.entityType) {
|
|
11972
|
+
filteredDocs = filteredDocs.filter((doc) => getResourceEntityTypes5(doc).includes(event.entityType));
|
|
11973
|
+
}
|
|
11974
|
+
const offset = event.offset ?? 0;
|
|
11975
|
+
const limit = event.limit ?? 50;
|
|
11976
|
+
const paginatedDocs = filteredDocs.slice(offset, offset + limit);
|
|
11977
|
+
const formattedDocs = event.search ? await ResourceContext.addContentPreviews(paginatedDocs, this.kb) : paginatedDocs;
|
|
11978
|
+
this.eventBus.get("browse:resources-result").next({
|
|
11979
|
+
correlationId: event.correlationId,
|
|
11980
|
+
response: {
|
|
11981
|
+
resources: formattedDocs,
|
|
11982
|
+
total: filteredDocs.length,
|
|
11983
|
+
offset,
|
|
11984
|
+
limit
|
|
11985
|
+
}
|
|
11986
|
+
});
|
|
11987
|
+
} catch (error) {
|
|
11988
|
+
this.logger.error("Browse resources failed", { error });
|
|
11989
|
+
this.eventBus.get("browse:resources-failed").next({
|
|
11990
|
+
correlationId: event.correlationId,
|
|
11991
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
11992
|
+
});
|
|
11993
|
+
}
|
|
11994
|
+
}
|
|
11995
|
+
async handleBrowseAnnotations(event) {
|
|
11996
|
+
try {
|
|
11997
|
+
const annotations = await AnnotationContext.getAllAnnotations(event.resourceId, this.kb);
|
|
11998
|
+
this.eventBus.get("browse:annotations-result").next({
|
|
11999
|
+
correlationId: event.correlationId,
|
|
12000
|
+
response: {
|
|
12001
|
+
annotations,
|
|
12002
|
+
total: annotations.length
|
|
12003
|
+
}
|
|
12004
|
+
});
|
|
12005
|
+
} catch (error) {
|
|
12006
|
+
this.logger.error("Browse annotations failed", { resourceId: event.resourceId, error });
|
|
12007
|
+
this.eventBus.get("browse:annotations-failed").next({
|
|
12008
|
+
correlationId: event.correlationId,
|
|
12009
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
12010
|
+
});
|
|
12011
|
+
}
|
|
12012
|
+
}
|
|
12013
|
+
async handleBrowseAnnotation(event) {
|
|
12014
|
+
try {
|
|
12015
|
+
const annotation = await AnnotationContext.getAnnotation(event.annotationId, event.resourceId, this.kb);
|
|
12016
|
+
if (!annotation) {
|
|
12017
|
+
this.eventBus.get("browse:annotation-failed").next({
|
|
12018
|
+
correlationId: event.correlationId,
|
|
12019
|
+
error: new Error("Annotation not found")
|
|
12020
|
+
});
|
|
12021
|
+
return;
|
|
12022
|
+
}
|
|
12023
|
+
const resource = await ResourceContext.getResourceMetadata(event.resourceId, this.kb);
|
|
12024
|
+
let resolvedResource = null;
|
|
12025
|
+
const bodySource = getBodySource2(annotation.body);
|
|
12026
|
+
if (bodySource) {
|
|
12027
|
+
resolvedResource = await ResourceContext.getResourceMetadata(resourceId3(bodySource), this.kb);
|
|
12028
|
+
}
|
|
12029
|
+
this.eventBus.get("browse:annotation-result").next({
|
|
12030
|
+
correlationId: event.correlationId,
|
|
12031
|
+
response: {
|
|
12032
|
+
annotation,
|
|
12033
|
+
resource,
|
|
12034
|
+
resolvedResource
|
|
12035
|
+
}
|
|
12036
|
+
});
|
|
12037
|
+
} catch (error) {
|
|
12038
|
+
this.logger.error("Browse annotation failed", { resourceId: event.resourceId, annotationId: event.annotationId, error });
|
|
12039
|
+
this.eventBus.get("browse:annotation-failed").next({
|
|
12040
|
+
correlationId: event.correlationId,
|
|
12041
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
12042
|
+
});
|
|
12043
|
+
}
|
|
12044
|
+
}
|
|
12045
|
+
async handleBrowseEvents(event) {
|
|
12046
|
+
try {
|
|
12047
|
+
const eventQuery = new EventQuery2(this.kb.eventStore.log.storage);
|
|
12048
|
+
const filters = {
|
|
12049
|
+
resourceId: event.resourceId
|
|
12050
|
+
};
|
|
12051
|
+
if (event.type) {
|
|
12052
|
+
filters.eventTypes = [event.type];
|
|
12053
|
+
}
|
|
12054
|
+
if (event.userId) {
|
|
12055
|
+
filters.userId = event.userId;
|
|
12056
|
+
}
|
|
12057
|
+
if (event.limit) {
|
|
12058
|
+
filters.limit = event.limit;
|
|
12059
|
+
}
|
|
12060
|
+
const storedEvents = await eventQuery.queryEvents(filters);
|
|
12061
|
+
const events = storedEvents.map((stored) => ({
|
|
12062
|
+
event: {
|
|
12063
|
+
id: stored.event.id,
|
|
12064
|
+
type: stored.event.type,
|
|
12065
|
+
timestamp: stored.event.timestamp,
|
|
12066
|
+
userId: stored.event.userId,
|
|
12067
|
+
resourceId: stored.event.resourceId,
|
|
12068
|
+
payload: stored.event.payload
|
|
12069
|
+
},
|
|
12070
|
+
metadata: {
|
|
12071
|
+
sequenceNumber: stored.metadata.sequenceNumber,
|
|
12072
|
+
prevEventHash: stored.metadata.prevEventHash,
|
|
12073
|
+
checksum: stored.metadata.checksum
|
|
12074
|
+
}
|
|
12075
|
+
}));
|
|
12076
|
+
this.eventBus.get("browse:events-result").next({
|
|
12077
|
+
correlationId: event.correlationId,
|
|
12078
|
+
response: {
|
|
12079
|
+
events,
|
|
12080
|
+
total: events.length,
|
|
12081
|
+
resourceId: event.resourceId
|
|
12082
|
+
}
|
|
12083
|
+
});
|
|
12084
|
+
} catch (error) {
|
|
12085
|
+
this.logger.error("Browse events failed", { resourceId: event.resourceId, error });
|
|
12086
|
+
this.eventBus.get("browse:events-failed").next({
|
|
12087
|
+
correlationId: event.correlationId,
|
|
12088
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
12089
|
+
});
|
|
12090
|
+
}
|
|
12091
|
+
}
|
|
12092
|
+
async handleBrowseAnnotationHistory(event) {
|
|
12093
|
+
try {
|
|
12094
|
+
const annotation = await AnnotationContext.getAnnotation(event.annotationId, event.resourceId, this.kb);
|
|
12095
|
+
if (!annotation) {
|
|
12096
|
+
this.eventBus.get("browse:annotation-history-failed").next({
|
|
12097
|
+
correlationId: event.correlationId,
|
|
12098
|
+
error: new Error("Annotation not found")
|
|
12099
|
+
});
|
|
12100
|
+
return;
|
|
12101
|
+
}
|
|
12102
|
+
const eventQuery = new EventQuery2(this.kb.eventStore.log.storage);
|
|
12103
|
+
const allEvents = await eventQuery.queryEvents({ resourceId: event.resourceId });
|
|
12104
|
+
const annotationEvents = allEvents.filter((stored) => {
|
|
12105
|
+
const ev = stored.event;
|
|
12106
|
+
if ("highlightId" in ev.payload && ev.payload.highlightId === event.annotationId) return true;
|
|
12107
|
+
if ("referenceId" in ev.payload && ev.payload.referenceId === event.annotationId) return true;
|
|
12108
|
+
return false;
|
|
12109
|
+
});
|
|
12110
|
+
const events = annotationEvents.map((stored) => ({
|
|
12111
|
+
id: stored.event.id,
|
|
12112
|
+
type: stored.event.type,
|
|
12113
|
+
timestamp: stored.event.timestamp,
|
|
12114
|
+
userId: stored.event.userId,
|
|
12115
|
+
resourceId: stored.event.resourceId,
|
|
12116
|
+
payload: stored.event.payload,
|
|
12117
|
+
metadata: {
|
|
12118
|
+
sequenceNumber: stored.metadata.sequenceNumber,
|
|
12119
|
+
prevEventHash: stored.metadata.prevEventHash,
|
|
12120
|
+
checksum: stored.metadata.checksum
|
|
12121
|
+
}
|
|
12122
|
+
}));
|
|
12123
|
+
events.sort((a, b) => a.metadata.sequenceNumber - b.metadata.sequenceNumber);
|
|
12124
|
+
this.eventBus.get("browse:annotation-history-result").next({
|
|
12125
|
+
correlationId: event.correlationId,
|
|
12126
|
+
response: {
|
|
12127
|
+
events,
|
|
12128
|
+
total: events.length,
|
|
12129
|
+
annotationId: event.annotationId,
|
|
12130
|
+
resourceId: event.resourceId
|
|
12131
|
+
}
|
|
12132
|
+
});
|
|
12133
|
+
} catch (error) {
|
|
12134
|
+
this.logger.error("Browse annotation history failed", { resourceId: event.resourceId, annotationId: event.annotationId, error });
|
|
12135
|
+
this.eventBus.get("browse:annotation-history-failed").next({
|
|
12136
|
+
correlationId: event.correlationId,
|
|
12137
|
+
error: error instanceof Error ? error : new Error(String(error))
|
|
12138
|
+
});
|
|
12139
|
+
}
|
|
12140
|
+
}
|
|
12141
|
+
async handleReferencedBy(event) {
|
|
12142
|
+
try {
|
|
12143
|
+
this.logger.debug("Looking for annotations referencing resource", {
|
|
12144
|
+
resourceId: event.resourceId,
|
|
12145
|
+
motivation: event.motivation || "all"
|
|
12146
|
+
});
|
|
12147
|
+
const references = await this.kb.graph.getResourceReferencedBy(event.resourceId, event.motivation);
|
|
12148
|
+
const sourceIds = [...new Set(references.map((ref) => getTargetSource2(ref.target)))];
|
|
12149
|
+
const resources = await Promise.all(sourceIds.map((id) => this.kb.graph.getResource(resourceId3(id))));
|
|
12150
|
+
for (let i = 0; i < sourceIds.length; i++) {
|
|
12151
|
+
if (resources[i] === null) {
|
|
12152
|
+
this.logger.warn("Referenced resource not found in graph", { resourceId: sourceIds[i] });
|
|
12153
|
+
}
|
|
12154
|
+
}
|
|
12155
|
+
const docMap = new Map(resources.filter((doc) => doc !== null).map((doc) => [doc["@id"], doc]));
|
|
12156
|
+
const referencedBy = references.map((ref) => {
|
|
12157
|
+
const targetSource = getTargetSource2(ref.target);
|
|
12158
|
+
const targetSelector = getTargetSelector2(ref.target);
|
|
12159
|
+
const doc = docMap.get(targetSource);
|
|
12160
|
+
return {
|
|
12161
|
+
id: ref.id,
|
|
12162
|
+
resourceName: doc?.name || "Untitled Resource",
|
|
12163
|
+
target: {
|
|
12164
|
+
source: targetSource,
|
|
12165
|
+
selector: {
|
|
12166
|
+
exact: targetSelector ? getExactText(targetSelector) : ""
|
|
12167
|
+
}
|
|
12168
|
+
}
|
|
12169
|
+
};
|
|
12170
|
+
});
|
|
12171
|
+
this.eventBus.get("browse:referenced-by-result").next({
|
|
12172
|
+
correlationId: event.correlationId,
|
|
12173
|
+
response: { referencedBy }
|
|
12174
|
+
});
|
|
12099
12175
|
} catch (error) {
|
|
12100
|
-
this.logger.error("
|
|
12101
|
-
this.eventBus.get("
|
|
12176
|
+
this.logger.error("Referenced-by query failed", { resourceId: event.resourceId, error });
|
|
12177
|
+
this.eventBus.get("browse:referenced-by-failed").next({
|
|
12178
|
+
correlationId: event.correlationId,
|
|
12102
12179
|
error: error instanceof Error ? error : new Error(String(error))
|
|
12103
12180
|
});
|
|
12104
12181
|
}
|
|
12105
12182
|
}
|
|
12106
|
-
async
|
|
12107
|
-
if (!event || typeof event !== "object" || !("userId" in event) || !("resourceId" in event) || !event.resourceId) {
|
|
12108
|
-
return;
|
|
12109
|
-
}
|
|
12110
|
-
if (event.storageUri) {
|
|
12111
|
-
await this.kb.content.remove(event.storageUri, { keepFile: event.keepFile, noGit: event.noGit });
|
|
12112
|
-
}
|
|
12113
|
-
await this.kb.eventStore.appendEvent({
|
|
12114
|
-
type: "resource.archived",
|
|
12115
|
-
resourceId: event.resourceId,
|
|
12116
|
-
userId: event.userId,
|
|
12117
|
-
version: 1,
|
|
12118
|
-
payload: { reason: void 0 }
|
|
12119
|
-
});
|
|
12120
|
-
}
|
|
12121
|
-
async handleMarkUnarchive(event) {
|
|
12122
|
-
if (!event || typeof event !== "object" || !("userId" in event) || !("resourceId" in event) || !event.resourceId) {
|
|
12123
|
-
return;
|
|
12124
|
-
}
|
|
12125
|
-
if (event.storageUri) {
|
|
12126
|
-
const absPath = this.kb.content.resolveUri(event.storageUri);
|
|
12127
|
-
try {
|
|
12128
|
-
await fs3.access(absPath);
|
|
12129
|
-
} catch {
|
|
12130
|
-
this.logger.warn("Unarchive failed: file not found at storageUri", { storageUri: event.storageUri });
|
|
12131
|
-
return;
|
|
12132
|
-
}
|
|
12133
|
-
}
|
|
12134
|
-
await this.kb.eventStore.appendEvent({
|
|
12135
|
-
type: "resource.unarchived",
|
|
12136
|
-
resourceId: event.resourceId,
|
|
12137
|
-
userId: event.userId,
|
|
12138
|
-
version: 1,
|
|
12139
|
-
payload: {}
|
|
12140
|
-
});
|
|
12141
|
-
}
|
|
12142
|
-
async handleAddEntityType(event) {
|
|
12183
|
+
async handleEntityTypes(event) {
|
|
12143
12184
|
try {
|
|
12144
|
-
await this.
|
|
12145
|
-
|
|
12146
|
-
|
|
12147
|
-
|
|
12148
|
-
payload: { entityType: event.tag }
|
|
12185
|
+
const entityTypes = await readEntityTypesProjection(this.project);
|
|
12186
|
+
this.eventBus.get("browse:entity-types-result").next({
|
|
12187
|
+
correlationId: event.correlationId,
|
|
12188
|
+
response: { entityTypes }
|
|
12149
12189
|
});
|
|
12150
|
-
this.eventBus.get("mark:entity-type-added").next({ tag: event.tag });
|
|
12151
12190
|
} catch (error) {
|
|
12152
|
-
this.logger.error("
|
|
12153
|
-
this.eventBus.get("
|
|
12191
|
+
this.logger.error("Entity types read failed", { error });
|
|
12192
|
+
this.eventBus.get("browse:entity-types-failed").next({
|
|
12193
|
+
correlationId: event.correlationId,
|
|
12154
12194
|
error: error instanceof Error ? error : new Error(String(error))
|
|
12155
12195
|
});
|
|
12156
12196
|
}
|
|
12157
12197
|
}
|
|
12158
|
-
|
|
12159
|
-
|
|
12160
|
-
|
|
12161
|
-
|
|
12162
|
-
|
|
12163
|
-
|
|
12164
|
-
|
|
12165
|
-
|
|
12166
|
-
|
|
12167
|
-
|
|
12198
|
+
// ========================================================================
|
|
12199
|
+
// Filesystem read handler
|
|
12200
|
+
// ========================================================================
|
|
12201
|
+
async handleBrowseDirectory(event) {
|
|
12202
|
+
const { correlationId, path: reqPath, sort = "name" } = event;
|
|
12203
|
+
const projectRoot = this.project.root;
|
|
12204
|
+
const resolved = path2.resolve(projectRoot, reqPath);
|
|
12205
|
+
if (!resolved.startsWith(projectRoot + path2.sep) && resolved !== projectRoot) {
|
|
12206
|
+
this.eventBus.get("browse:directory-failed").next({
|
|
12207
|
+
correlationId,
|
|
12208
|
+
path: reqPath,
|
|
12209
|
+
error: new Error("path escapes project root")
|
|
12168
12210
|
});
|
|
12211
|
+
return;
|
|
12169
12212
|
}
|
|
12170
|
-
|
|
12171
|
-
|
|
12172
|
-
|
|
12173
|
-
|
|
12174
|
-
|
|
12175
|
-
|
|
12176
|
-
|
|
12213
|
+
let dirents;
|
|
12214
|
+
try {
|
|
12215
|
+
dirents = await fs3.readdir(resolved, { withFileTypes: true, encoding: "utf8" });
|
|
12216
|
+
} catch (err) {
|
|
12217
|
+
const msg = err.code === "ENOENT" ? "path not found" : String(err);
|
|
12218
|
+
this.eventBus.get("browse:directory-failed").next({
|
|
12219
|
+
correlationId,
|
|
12220
|
+
path: reqPath,
|
|
12221
|
+
error: new Error(msg)
|
|
12177
12222
|
});
|
|
12223
|
+
return;
|
|
12178
12224
|
}
|
|
12179
|
-
|
|
12180
|
-
|
|
12181
|
-
|
|
12182
|
-
|
|
12183
|
-
|
|
12184
|
-
|
|
12185
|
-
|
|
12186
|
-
|
|
12187
|
-
|
|
12188
|
-
|
|
12189
|
-
|
|
12190
|
-
|
|
12191
|
-
|
|
12192
|
-
|
|
12193
|
-
|
|
12194
|
-
|
|
12195
|
-
|
|
12196
|
-
|
|
12197
|
-
|
|
12198
|
-
|
|
12199
|
-
|
|
12225
|
+
const visible = dirents.filter((d) => d.name !== ".semiont" && !d.name.startsWith("."));
|
|
12226
|
+
const allViews = await this.views.getAll();
|
|
12227
|
+
const prefix = `file://${resolved}`;
|
|
12228
|
+
const viewsByUri = new Map(
|
|
12229
|
+
allViews.filter((v) => v.resource.storageUri?.startsWith(prefix + "/") || v.resource.storageUri?.startsWith(prefix + path2.sep)).map((v) => [v.resource.storageUri, v])
|
|
12230
|
+
);
|
|
12231
|
+
const entries = [];
|
|
12232
|
+
for (const dirent of visible) {
|
|
12233
|
+
const entryPath = path2.join(resolved, dirent.name);
|
|
12234
|
+
const relPath = path2.relative(projectRoot, entryPath);
|
|
12235
|
+
if (dirent.isDirectory()) {
|
|
12236
|
+
let mtime = (/* @__PURE__ */ new Date(0)).toISOString();
|
|
12237
|
+
try {
|
|
12238
|
+
const stat = await fs3.stat(entryPath);
|
|
12239
|
+
mtime = stat.mtime.toISOString();
|
|
12240
|
+
} catch {
|
|
12241
|
+
}
|
|
12242
|
+
const entry = { type: "dir", name: dirent.name, path: relPath, mtime };
|
|
12243
|
+
entries.push(entry);
|
|
12244
|
+
} else if (dirent.isFile()) {
|
|
12245
|
+
let size = 0;
|
|
12246
|
+
let mtime = (/* @__PURE__ */ new Date(0)).toISOString();
|
|
12247
|
+
try {
|
|
12248
|
+
const stat = await fs3.stat(entryPath);
|
|
12249
|
+
size = stat.size;
|
|
12250
|
+
mtime = stat.mtime.toISOString();
|
|
12251
|
+
} catch {
|
|
12252
|
+
}
|
|
12253
|
+
const storageUri = `file://${entryPath}`;
|
|
12254
|
+
const view = viewsByUri.get(storageUri);
|
|
12255
|
+
let entry;
|
|
12256
|
+
if (view) {
|
|
12257
|
+
const annotations = view.annotations.annotations ?? [];
|
|
12258
|
+
entry = {
|
|
12259
|
+
type: "file",
|
|
12260
|
+
name: dirent.name,
|
|
12261
|
+
path: relPath,
|
|
12262
|
+
size,
|
|
12263
|
+
mtime,
|
|
12264
|
+
tracked: true,
|
|
12265
|
+
resourceId: view.resource["@id"],
|
|
12266
|
+
entityTypes: view.resource.entityTypes ?? [],
|
|
12267
|
+
annotationCount: annotations.length,
|
|
12268
|
+
creator: (() => {
|
|
12269
|
+
const a = view.resource.wasAttributedTo;
|
|
12270
|
+
return Array.isArray(a) ? a[0]?.["@id"] : a?.["@id"];
|
|
12271
|
+
})()
|
|
12272
|
+
};
|
|
12273
|
+
} else {
|
|
12274
|
+
entry = { type: "file", name: dirent.name, path: relPath, size, mtime, tracked: false };
|
|
12275
|
+
}
|
|
12276
|
+
entries.push(entry);
|
|
12200
12277
|
}
|
|
12201
|
-
}
|
|
12202
|
-
|
|
12203
|
-
|
|
12204
|
-
|
|
12205
|
-
type: "job.completed",
|
|
12206
|
-
resourceId: event.resourceId,
|
|
12207
|
-
userId: event.userId,
|
|
12208
|
-
version: 1,
|
|
12209
|
-
payload: {
|
|
12210
|
-
jobId: event.jobId,
|
|
12211
|
-
jobType: event.jobType,
|
|
12212
|
-
result: event.result
|
|
12278
|
+
}
|
|
12279
|
+
entries.sort((a, b) => {
|
|
12280
|
+
if (sort === "mtime") {
|
|
12281
|
+
return (b.mtime ?? "").localeCompare(a.mtime ?? "");
|
|
12213
12282
|
}
|
|
12214
|
-
|
|
12215
|
-
|
|
12216
|
-
|
|
12217
|
-
await this.kb.eventStore.appendEvent({
|
|
12218
|
-
type: "job.failed",
|
|
12219
|
-
resourceId: event.resourceId,
|
|
12220
|
-
userId: event.userId,
|
|
12221
|
-
version: 1,
|
|
12222
|
-
payload: {
|
|
12223
|
-
jobId: event.jobId,
|
|
12224
|
-
jobType: event.jobType,
|
|
12225
|
-
error: event.error
|
|
12283
|
+
if (sort === "annotationCount") {
|
|
12284
|
+
const ac = (e) => e.type === "file" ? e.annotationCount ?? 0 : 0;
|
|
12285
|
+
return ac(b) - ac(a);
|
|
12226
12286
|
}
|
|
12287
|
+
return a.name.localeCompare(b.name);
|
|
12288
|
+
});
|
|
12289
|
+
this.eventBus.get("browse:directory-result").next({
|
|
12290
|
+
correlationId,
|
|
12291
|
+
response: { path: reqPath, entries }
|
|
12227
12292
|
});
|
|
12228
12293
|
}
|
|
12229
12294
|
async stop() {
|
|
12230
|
-
this.
|
|
12231
|
-
|
|
12232
|
-
|
|
12295
|
+
for (const sub of this.subscriptions) {
|
|
12296
|
+
sub.unsubscribe();
|
|
12297
|
+
}
|
|
12298
|
+
this.subscriptions = [];
|
|
12299
|
+
this.logger.info("Browser actor stopped");
|
|
12233
12300
|
}
|
|
12234
12301
|
};
|
|
12235
|
-
function deriveStorageUri(name, format) {
|
|
12236
|
-
const slug = name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
12237
|
-
const ext = getExtensionForMimeType(format);
|
|
12238
|
-
return `file://${slug}${ext}`;
|
|
12239
|
-
}
|
|
12240
12302
|
|
|
12241
12303
|
// src/clone-token-manager.ts
|
|
12242
12304
|
var import_rxjs7 = __toESM(require_cjs(), 1);
|
|
@@ -12495,24 +12557,79 @@ var CloneTokenManager = class {
|
|
|
12495
12557
|
}
|
|
12496
12558
|
};
|
|
12497
12559
|
|
|
12498
|
-
// src/
|
|
12499
|
-
|
|
12500
|
-
|
|
12501
|
-
|
|
12502
|
-
|
|
12560
|
+
// src/bootstrap/entity-types.ts
|
|
12561
|
+
var import_rxjs8 = __toESM(require_cjs(), 1);
|
|
12562
|
+
var import_operators8 = __toESM(require_operators(), 1);
|
|
12563
|
+
import { promises as fs4 } from "fs";
|
|
12564
|
+
import * as path3 from "path";
|
|
12565
|
+
import { DEFAULT_ENTITY_TYPES } from "@semiont/ontology";
|
|
12566
|
+
import { userId } from "@semiont/core";
|
|
12567
|
+
var bootstrapCompleted = false;
|
|
12568
|
+
async function bootstrapEntityTypes(eventBus, project, logger) {
|
|
12569
|
+
if (bootstrapCompleted) {
|
|
12570
|
+
logger?.debug("Entity types bootstrap already completed, skipping");
|
|
12571
|
+
return;
|
|
12503
12572
|
}
|
|
12573
|
+
const projectionPath = path3.join(
|
|
12574
|
+
project.stateDir,
|
|
12575
|
+
"projections",
|
|
12576
|
+
"__system__",
|
|
12577
|
+
"entitytypes.json"
|
|
12578
|
+
);
|
|
12579
|
+
try {
|
|
12580
|
+
await fs4.access(projectionPath);
|
|
12581
|
+
logger?.info("Entity types projection already exists, skipping bootstrap");
|
|
12582
|
+
bootstrapCompleted = true;
|
|
12583
|
+
return;
|
|
12584
|
+
} catch (error) {
|
|
12585
|
+
if (error.code !== "ENOENT") {
|
|
12586
|
+
throw error;
|
|
12587
|
+
}
|
|
12588
|
+
logger?.info("Entity types projection does not exist, bootstrapping with DEFAULT_ENTITY_TYPES");
|
|
12589
|
+
}
|
|
12590
|
+
const SYSTEM_USER_ID = userId("00000000-0000-0000-0000-000000000000");
|
|
12591
|
+
for (const entityType of DEFAULT_ENTITY_TYPES) {
|
|
12592
|
+
logger?.debug("Adding entity type via EventBus", { entityType });
|
|
12593
|
+
const result$ = (0, import_rxjs8.race)(
|
|
12594
|
+
eventBus.get("mark:entity-type-added").pipe((0, import_operators8.take)(1), (0, import_operators8.map)(() => ({ ok: true }))),
|
|
12595
|
+
eventBus.get("mark:entity-type-add-failed").pipe((0, import_operators8.take)(1), (0, import_operators8.map)((f) => ({ ok: false, error: f.error }))),
|
|
12596
|
+
(0, import_rxjs8.timer)(1e4).pipe((0, import_operators8.map)(() => ({ ok: false, error: new Error(`Timeout adding entity type: ${entityType}`) })))
|
|
12597
|
+
);
|
|
12598
|
+
eventBus.get("mark:add-entity-type").next({ tag: entityType, userId: SYSTEM_USER_ID });
|
|
12599
|
+
const outcome = await (0, import_rxjs8.firstValueFrom)(result$);
|
|
12600
|
+
if (!outcome.ok) {
|
|
12601
|
+
throw outcome.error;
|
|
12602
|
+
}
|
|
12603
|
+
}
|
|
12604
|
+
logger?.info("Entity types bootstrap completed", { count: DEFAULT_ENTITY_TYPES.length });
|
|
12605
|
+
bootstrapCompleted = true;
|
|
12606
|
+
}
|
|
12607
|
+
function resetBootstrap() {
|
|
12608
|
+
bootstrapCompleted = false;
|
|
12609
|
+
}
|
|
12610
|
+
|
|
12611
|
+
// src/knowledge-system.ts
|
|
12612
|
+
async function stopKnowledgeSystem(ks) {
|
|
12613
|
+
await ks.gatherer.stop();
|
|
12614
|
+
await ks.matcher.stop();
|
|
12615
|
+
await ks.browser.stop();
|
|
12616
|
+
await ks.cloneTokenManager.stop();
|
|
12617
|
+
await ks.stower.stop();
|
|
12618
|
+
await ks.kb.graphConsumer.stop();
|
|
12619
|
+
await ks.kb.graph.disconnect();
|
|
12620
|
+
}
|
|
12621
|
+
|
|
12622
|
+
// src/service.ts
|
|
12623
|
+
async function createJobQueue(project, eventBus, logger) {
|
|
12504
12624
|
const jobQueueLogger = logger.child({ component: "job-queue" });
|
|
12505
12625
|
const jobQueue = new JobQueue(project, jobQueueLogger, eventBus);
|
|
12506
12626
|
await jobQueue.initialize();
|
|
12507
12627
|
const jobStatusSubscription = eventBus.get("job:status-requested").pipe(
|
|
12508
|
-
(0,
|
|
12628
|
+
(0, import_operators9.mergeMap)((event) => (0, import_rxjs9.from)((async () => {
|
|
12509
12629
|
try {
|
|
12510
12630
|
const job = await jobQueue.getJob(event.jobId);
|
|
12511
12631
|
if (!job) {
|
|
12512
|
-
eventBus.get("job:status-failed").next({
|
|
12513
|
-
correlationId: event.correlationId,
|
|
12514
|
-
error: new Error("Job not found")
|
|
12515
|
-
});
|
|
12632
|
+
eventBus.get("job:status-failed").next({ correlationId: event.correlationId, error: new Error("Job not found") });
|
|
12516
12633
|
return;
|
|
12517
12634
|
}
|
|
12518
12635
|
eventBus.get("job:status-result").next({
|
|
@@ -12540,122 +12657,106 @@ async function startMakeMeaning(project, config, eventBus, logger) {
|
|
|
12540
12657
|
).subscribe({
|
|
12541
12658
|
error: (err) => jobQueueLogger.error("Job status pipeline error", { error: err })
|
|
12542
12659
|
});
|
|
12543
|
-
|
|
12544
|
-
|
|
12545
|
-
|
|
12546
|
-
|
|
12547
|
-
logger.child({ component: "inference-client-gatherer" })
|
|
12548
|
-
);
|
|
12549
|
-
const matcherInferenceClient = createInferenceClient(
|
|
12550
|
-
resolveActorInference(config, "matcher"),
|
|
12551
|
-
logger.child({ component: "inference-client-matcher" })
|
|
12552
|
-
);
|
|
12553
|
-
const detectionInferenceCfg = resolveWorkerInference(config, "reference-annotation");
|
|
12554
|
-
const detectionInferenceClient = createInferenceClient(detectionInferenceCfg, logger.child({ component: "inference-client-reference-annotation" }));
|
|
12555
|
-
const detectionGenerator = inferenceConfigToGenerator("Reference Worker", detectionInferenceCfg);
|
|
12556
|
-
const generationInferenceClient = createInferenceClient(
|
|
12557
|
-
resolveWorkerInference(config, "generation"),
|
|
12558
|
-
logger.child({ component: "inference-client-generation" })
|
|
12559
|
-
);
|
|
12560
|
-
const highlightInferenceCfg = resolveWorkerInference(config, "highlight-annotation");
|
|
12561
|
-
const highlightInferenceClient = createInferenceClient(highlightInferenceCfg, logger.child({ component: "inference-client-highlight-annotation" }));
|
|
12562
|
-
const highlightGenerator = inferenceConfigToGenerator("Highlight Worker", highlightInferenceCfg);
|
|
12563
|
-
const assessmentInferenceCfg = resolveWorkerInference(config, "assessment-annotation");
|
|
12564
|
-
const assessmentInferenceClient = createInferenceClient(assessmentInferenceCfg, logger.child({ component: "inference-client-assessment-annotation" }));
|
|
12565
|
-
const assessmentGenerator = inferenceConfigToGenerator("Assessment Worker", assessmentInferenceCfg);
|
|
12566
|
-
const commentInferenceCfg = resolveWorkerInference(config, "comment-annotation");
|
|
12567
|
-
const commentInferenceClient = createInferenceClient(commentInferenceCfg, logger.child({ component: "inference-client-comment-annotation" }));
|
|
12568
|
-
const commentGenerator = inferenceConfigToGenerator("Comment Worker", commentInferenceCfg);
|
|
12569
|
-
const tagInferenceCfg = resolveWorkerInference(config, "tag-annotation");
|
|
12570
|
-
const tagInferenceClient = createInferenceClient(tagInferenceCfg, logger.child({ component: "inference-client-tag-annotation" }));
|
|
12571
|
-
const tagGenerator = inferenceConfigToGenerator("Tag Worker", tagInferenceCfg);
|
|
12660
|
+
return { jobQueue, jobStatusSubscription };
|
|
12661
|
+
}
|
|
12662
|
+
async function createKnowledgeSystemFromConfig(project, config, eventBus, logger) {
|
|
12663
|
+
const graphConfig = config.services.graph;
|
|
12572
12664
|
const graphDb = await getGraphDatabase(graphConfig);
|
|
12573
|
-
const
|
|
12574
|
-
const
|
|
12575
|
-
const
|
|
12576
|
-
await graphConsumer.initialize();
|
|
12577
|
-
const stowerLogger = logger.child({ component: "stower" });
|
|
12578
|
-
const stower = new Stower(kb, eventBus, stowerLogger);
|
|
12665
|
+
const eventStore = createEventStoreCore(project, eventBus, logger.child({ component: "event-store" }));
|
|
12666
|
+
const kb = await createKnowledgeBase(eventStore, project, graphDb, logger);
|
|
12667
|
+
const stower = new Stower(kb, eventBus, logger.child({ component: "stower" }));
|
|
12579
12668
|
await stower.initialize();
|
|
12580
|
-
|
|
12581
|
-
|
|
12582
|
-
|
|
12583
|
-
|
|
12669
|
+
await bootstrapEntityTypes(eventBus, project, logger.child({ component: "entity-types-bootstrap" }));
|
|
12670
|
+
const gatherer = new Gatherer(
|
|
12671
|
+
kb,
|
|
12672
|
+
eventBus,
|
|
12673
|
+
createInferenceClient(resolveActorInference(config, "gatherer"), logger.child({ component: "inference-client-gatherer" })),
|
|
12674
|
+
logger.child({ component: "gatherer" })
|
|
12675
|
+
);
|
|
12584
12676
|
await gatherer.initialize();
|
|
12585
|
-
const
|
|
12586
|
-
|
|
12677
|
+
const matcher = new Matcher(
|
|
12678
|
+
kb,
|
|
12679
|
+
eventBus,
|
|
12680
|
+
logger.child({ component: "matcher" }),
|
|
12681
|
+
createInferenceClient(resolveActorInference(config, "matcher"), logger.child({ component: "inference-client-matcher" }))
|
|
12682
|
+
);
|
|
12587
12683
|
await matcher.initialize();
|
|
12588
|
-
const
|
|
12589
|
-
|
|
12684
|
+
const browser = new Browser(kb.views, kb, eventBus, project, logger.child({ component: "browser" }));
|
|
12685
|
+
await browser.initialize();
|
|
12686
|
+
const cloneTokenManager = new CloneTokenManager(kb, eventBus, logger.child({ component: "clone-token-manager" }));
|
|
12590
12687
|
await cloneTokenManager.initialize();
|
|
12591
|
-
const
|
|
12592
|
-
|
|
12688
|
+
const ks = { kb, stower, gatherer, matcher, browser, cloneTokenManager, stop: () => stopKnowledgeSystem(ks) };
|
|
12689
|
+
return ks;
|
|
12690
|
+
}
|
|
12691
|
+
function createContentFetcher(ks) {
|
|
12692
|
+
return async (resourceId4) => {
|
|
12693
|
+
const view = await ks.kb.views.get(resourceId4);
|
|
12593
12694
|
if (!view?.resource.storageUri) return null;
|
|
12594
|
-
const buffer = await kb.content.retrieve(view.resource.storageUri);
|
|
12695
|
+
const buffer = await ks.kb.content.retrieve(view.resource.storageUri);
|
|
12595
12696
|
if (!buffer) return null;
|
|
12596
12697
|
return Readable.from([buffer]);
|
|
12597
12698
|
};
|
|
12598
|
-
|
|
12599
|
-
|
|
12600
|
-
const
|
|
12601
|
-
|
|
12602
|
-
|
|
12603
|
-
|
|
12604
|
-
const
|
|
12605
|
-
|
|
12606
|
-
|
|
12607
|
-
|
|
12608
|
-
|
|
12609
|
-
|
|
12610
|
-
|
|
12611
|
-
};
|
|
12612
|
-
|
|
12613
|
-
|
|
12614
|
-
|
|
12615
|
-
|
|
12616
|
-
|
|
12617
|
-
|
|
12618
|
-
|
|
12619
|
-
|
|
12620
|
-
|
|
12621
|
-
|
|
12622
|
-
|
|
12623
|
-
});
|
|
12624
|
-
|
|
12625
|
-
|
|
12626
|
-
|
|
12627
|
-
|
|
12628
|
-
|
|
12629
|
-
|
|
12699
|
+
}
|
|
12700
|
+
function createWorkers(jobQueue, contentFetcher, eventBus, config, logger) {
|
|
12701
|
+
const detection = (() => {
|
|
12702
|
+
const cfg = resolveWorkerInference(config, "reference-annotation");
|
|
12703
|
+
return new ReferenceAnnotationWorker(jobQueue, createInferenceClient(cfg, logger.child({ component: "inference-client-reference-annotation" })), inferenceConfigToGenerator("Reference Worker", cfg), eventBus, contentFetcher, logger.child({ component: "reference-detection-worker" }));
|
|
12704
|
+
})();
|
|
12705
|
+
const generation = (() => {
|
|
12706
|
+
const cfg = resolveWorkerInference(config, "generation");
|
|
12707
|
+
return new GenerationWorker(jobQueue, createInferenceClient(cfg, logger.child({ component: "inference-client-generation" })), inferenceConfigToGenerator("Generation Worker", cfg), eventBus, logger.child({ component: "generation-worker" }));
|
|
12708
|
+
})();
|
|
12709
|
+
const highlight = (() => {
|
|
12710
|
+
const cfg = resolveWorkerInference(config, "highlight-annotation");
|
|
12711
|
+
return new HighlightAnnotationWorker(jobQueue, createInferenceClient(cfg, logger.child({ component: "inference-client-highlight-annotation" })), inferenceConfigToGenerator("Highlight Worker", cfg), eventBus, contentFetcher, logger.child({ component: "highlight-detection-worker" }));
|
|
12712
|
+
})();
|
|
12713
|
+
const assessment = (() => {
|
|
12714
|
+
const cfg = resolveWorkerInference(config, "assessment-annotation");
|
|
12715
|
+
return new AssessmentAnnotationWorker(jobQueue, createInferenceClient(cfg, logger.child({ component: "inference-client-assessment-annotation" })), inferenceConfigToGenerator("Assessment Worker", cfg), eventBus, contentFetcher, logger.child({ component: "assessment-detection-worker" }));
|
|
12716
|
+
})();
|
|
12717
|
+
const comment = (() => {
|
|
12718
|
+
const cfg = resolveWorkerInference(config, "comment-annotation");
|
|
12719
|
+
return new CommentAnnotationWorker(jobQueue, createInferenceClient(cfg, logger.child({ component: "inference-client-comment-annotation" })), inferenceConfigToGenerator("Comment Worker", cfg), eventBus, contentFetcher, logger.child({ component: "comment-detection-worker" }));
|
|
12720
|
+
})();
|
|
12721
|
+
const tag = (() => {
|
|
12722
|
+
const cfg = resolveWorkerInference(config, "tag-annotation");
|
|
12723
|
+
return new TagAnnotationWorker(jobQueue, createInferenceClient(cfg, logger.child({ component: "inference-client-tag-annotation" })), inferenceConfigToGenerator("Tag Worker", cfg), eventBus, contentFetcher, logger.child({ component: "tag-detection-worker" }));
|
|
12724
|
+
})();
|
|
12725
|
+
return { detection, generation, highlight, assessment, comment, tag };
|
|
12726
|
+
}
|
|
12727
|
+
function startWorkers(workers, logger) {
|
|
12728
|
+
const entries = [
|
|
12729
|
+
["detection", "reference-detection-worker"],
|
|
12730
|
+
["generation", "generation-worker"],
|
|
12731
|
+
["highlight", "highlight-detection-worker"],
|
|
12732
|
+
["assessment", "assessment-detection-worker"],
|
|
12733
|
+
["comment", "comment-detection-worker"],
|
|
12734
|
+
["tag", "tag-detection-worker"]
|
|
12735
|
+
];
|
|
12736
|
+
for (const [key, component] of entries) {
|
|
12737
|
+
workers[key].start().catch((error) => {
|
|
12738
|
+
logger.child({ component }).error("Worker stopped unexpectedly", { error });
|
|
12739
|
+
});
|
|
12740
|
+
}
|
|
12741
|
+
}
|
|
12742
|
+
async function startMakeMeaning(project, config, eventBus, logger) {
|
|
12743
|
+
if (!config.services?.graph) {
|
|
12744
|
+
throw new Error("services.graph is required for make-meaning service");
|
|
12745
|
+
}
|
|
12746
|
+
const { jobQueue, jobStatusSubscription } = await createJobQueue(project, eventBus, logger);
|
|
12747
|
+
const knowledgeSystem = await createKnowledgeSystemFromConfig(project, config, eventBus, logger);
|
|
12748
|
+
const contentFetcher = createContentFetcher(knowledgeSystem);
|
|
12749
|
+
const workers = createWorkers(jobQueue, contentFetcher, eventBus, config, logger);
|
|
12750
|
+
startWorkers(workers, logger);
|
|
12630
12751
|
return {
|
|
12631
|
-
|
|
12752
|
+
knowledgeSystem,
|
|
12632
12753
|
jobQueue,
|
|
12633
|
-
eventStore,
|
|
12634
|
-
graphDb,
|
|
12635
|
-
gathererInferenceClient,
|
|
12636
12754
|
workers,
|
|
12637
|
-
graphConsumer,
|
|
12638
|
-
stower,
|
|
12639
|
-
gatherer,
|
|
12640
|
-
matcher,
|
|
12641
|
-
cloneTokenManager,
|
|
12642
12755
|
stop: async () => {
|
|
12643
12756
|
logger.info("Stopping Make-Meaning service");
|
|
12644
|
-
await Promise.all(
|
|
12645
|
-
workers.detection.stop(),
|
|
12646
|
-
workers.generation.stop(),
|
|
12647
|
-
workers.highlight.stop(),
|
|
12648
|
-
workers.assessment.stop(),
|
|
12649
|
-
workers.comment.stop(),
|
|
12650
|
-
workers.tag.stop()
|
|
12651
|
-
]);
|
|
12652
|
-
await gatherer.stop();
|
|
12653
|
-
await matcher.stop();
|
|
12757
|
+
await Promise.all(Object.values(workers).map((w) => w.stop()));
|
|
12654
12758
|
jobStatusSubscription.unsubscribe();
|
|
12655
|
-
await
|
|
12656
|
-
await stower.stop();
|
|
12657
|
-
await graphConsumer.stop();
|
|
12658
|
-
await graphDb.disconnect();
|
|
12759
|
+
await knowledgeSystem.stop();
|
|
12659
12760
|
logger.info("Make-Meaning service stopped");
|
|
12660
12761
|
}
|
|
12661
12762
|
};
|
|
@@ -12715,9 +12816,9 @@ async function writeTarGz(entries, output) {
|
|
|
12715
12816
|
async function decompressStream(input) {
|
|
12716
12817
|
const gunzip = createGunzip();
|
|
12717
12818
|
const chunks = [];
|
|
12718
|
-
return new Promise((
|
|
12819
|
+
return new Promise((resolve2, reject) => {
|
|
12719
12820
|
gunzip.on("data", (chunk) => chunks.push(chunk));
|
|
12720
|
-
gunzip.on("end", () =>
|
|
12821
|
+
gunzip.on("end", () => resolve2(Buffer.concat(chunks)));
|
|
12721
12822
|
gunzip.on("error", reject);
|
|
12722
12823
|
input.on("error", reject);
|
|
12723
12824
|
input.pipe(gunzip);
|
|
@@ -12854,8 +12955,8 @@ function collectContentRefs(streamData) {
|
|
|
12854
12955
|
}
|
|
12855
12956
|
|
|
12856
12957
|
// src/exchange/replay.ts
|
|
12857
|
-
var
|
|
12858
|
-
var
|
|
12958
|
+
var import_rxjs10 = __toESM(require_cjs(), 1);
|
|
12959
|
+
var import_operators10 = __toESM(require_operators(), 1);
|
|
12859
12960
|
var REPLAY_TIMEOUT_MS = 3e4;
|
|
12860
12961
|
async function replayEventStream(jsonl, eventBus, resolveBlob, logger) {
|
|
12861
12962
|
const lines = jsonl.trim().split("\n").filter((l) => l.length > 0);
|
|
@@ -12934,12 +13035,12 @@ async function replayEvent(event, eventBus, resolveBlob, stats, logger) {
|
|
|
12934
13035
|
}
|
|
12935
13036
|
}
|
|
12936
13037
|
async function replayEntityTypeAdded(event, eventBus, logger) {
|
|
12937
|
-
const result$ = (0,
|
|
12938
|
-
eventBus.get("mark:entity-type-added").pipe((0,
|
|
12939
|
-
eventBus.get("mark:entity-type-add-failed").pipe((0,
|
|
13038
|
+
const result$ = (0, import_rxjs10.race)(
|
|
13039
|
+
eventBus.get("mark:entity-type-added").pipe((0, import_operators10.map)(() => "ok")),
|
|
13040
|
+
eventBus.get("mark:entity-type-add-failed").pipe((0, import_operators10.map)((e) => {
|
|
12940
13041
|
throw e.error;
|
|
12941
13042
|
})),
|
|
12942
|
-
(0,
|
|
13043
|
+
(0, import_rxjs10.timer)(REPLAY_TIMEOUT_MS).pipe((0, import_operators10.map)(() => {
|
|
12943
13044
|
throw new Error("Timeout waiting for mark:entity-type-added");
|
|
12944
13045
|
}))
|
|
12945
13046
|
);
|
|
@@ -12947,7 +13048,7 @@ async function replayEntityTypeAdded(event, eventBus, logger) {
|
|
|
12947
13048
|
tag: event.payload.entityType,
|
|
12948
13049
|
userId: event.userId
|
|
12949
13050
|
});
|
|
12950
|
-
await (0,
|
|
13051
|
+
await (0, import_rxjs10.firstValueFrom)(result$);
|
|
12951
13052
|
logger?.debug("Replayed entitytype.added", { entityType: event.payload.entityType });
|
|
12952
13053
|
}
|
|
12953
13054
|
async function replayResourceCreated(event, eventBus, resolveBlob, logger) {
|
|
@@ -12956,12 +13057,12 @@ async function replayResourceCreated(event, eventBus, resolveBlob, logger) {
|
|
|
12956
13057
|
if (!blob) {
|
|
12957
13058
|
throw new Error(`Missing content blob for checksum ${payload.contentChecksum}`);
|
|
12958
13059
|
}
|
|
12959
|
-
const result$ = (0,
|
|
12960
|
-
eventBus.get("yield:created").pipe((0,
|
|
12961
|
-
eventBus.get("yield:create-failed").pipe((0,
|
|
13060
|
+
const result$ = (0, import_rxjs10.race)(
|
|
13061
|
+
eventBus.get("yield:created").pipe((0, import_operators10.map)((r) => r)),
|
|
13062
|
+
eventBus.get("yield:create-failed").pipe((0, import_operators10.map)((e) => {
|
|
12962
13063
|
throw e.error;
|
|
12963
13064
|
})),
|
|
12964
|
-
(0,
|
|
13065
|
+
(0, import_rxjs10.timer)(REPLAY_TIMEOUT_MS).pipe((0, import_operators10.map)(() => {
|
|
12965
13066
|
throw new Error("Timeout waiting for yield:created");
|
|
12966
13067
|
}))
|
|
12967
13068
|
);
|
|
@@ -12977,16 +13078,16 @@ async function replayResourceCreated(event, eventBus, resolveBlob, logger) {
|
|
|
12977
13078
|
generatedFrom: payload.generatedFrom,
|
|
12978
13079
|
generationPrompt: payload.generationPrompt
|
|
12979
13080
|
});
|
|
12980
|
-
await (0,
|
|
13081
|
+
await (0, import_rxjs10.firstValueFrom)(result$);
|
|
12981
13082
|
logger?.debug("Replayed resource.created", { name: payload.name });
|
|
12982
13083
|
}
|
|
12983
13084
|
async function replayAnnotationAdded(event, eventBus, logger) {
|
|
12984
|
-
const result$ = (0,
|
|
12985
|
-
eventBus.get("mark:created").pipe((0,
|
|
12986
|
-
eventBus.get("mark:create-failed").pipe((0,
|
|
13085
|
+
const result$ = (0, import_rxjs10.race)(
|
|
13086
|
+
eventBus.get("mark:created").pipe((0, import_operators10.map)(() => "ok")),
|
|
13087
|
+
eventBus.get("mark:create-failed").pipe((0, import_operators10.map)((e) => {
|
|
12987
13088
|
throw e.error;
|
|
12988
13089
|
})),
|
|
12989
|
-
(0,
|
|
13090
|
+
(0, import_rxjs10.timer)(REPLAY_TIMEOUT_MS).pipe((0, import_operators10.map)(() => {
|
|
12990
13091
|
throw new Error("Timeout waiting for mark:created");
|
|
12991
13092
|
}))
|
|
12992
13093
|
);
|
|
@@ -12995,16 +13096,16 @@ async function replayAnnotationAdded(event, eventBus, logger) {
|
|
|
12995
13096
|
userId: event.userId,
|
|
12996
13097
|
resourceId: event.resourceId
|
|
12997
13098
|
});
|
|
12998
|
-
await (0,
|
|
13099
|
+
await (0, import_rxjs10.firstValueFrom)(result$);
|
|
12999
13100
|
logger?.debug("Replayed annotation.added", { annotationId: event.payload.annotation.id });
|
|
13000
13101
|
}
|
|
13001
13102
|
async function replayAnnotationBodyUpdated(event, eventBus, logger) {
|
|
13002
|
-
const result$ = (0,
|
|
13003
|
-
eventBus.get("mark:body-updated").pipe((0,
|
|
13004
|
-
eventBus.get("mark:body-update-failed").pipe((0,
|
|
13103
|
+
const result$ = (0, import_rxjs10.race)(
|
|
13104
|
+
eventBus.get("mark:body-updated").pipe((0, import_operators10.map)(() => "ok")),
|
|
13105
|
+
eventBus.get("mark:body-update-failed").pipe((0, import_operators10.map)((e) => {
|
|
13005
13106
|
throw e.error;
|
|
13006
13107
|
})),
|
|
13007
|
-
(0,
|
|
13108
|
+
(0, import_rxjs10.timer)(REPLAY_TIMEOUT_MS).pipe((0, import_operators10.map)(() => {
|
|
13008
13109
|
throw new Error("Timeout waiting for mark:body-updated");
|
|
13009
13110
|
}))
|
|
13010
13111
|
);
|
|
@@ -13014,16 +13115,16 @@ async function replayAnnotationBodyUpdated(event, eventBus, logger) {
|
|
|
13014
13115
|
resourceId: event.resourceId,
|
|
13015
13116
|
operations: event.payload.operations
|
|
13016
13117
|
});
|
|
13017
|
-
await (0,
|
|
13118
|
+
await (0, import_rxjs10.firstValueFrom)(result$);
|
|
13018
13119
|
logger?.debug("Replayed annotation.body.updated", { annotationId: event.payload.annotationId });
|
|
13019
13120
|
}
|
|
13020
13121
|
async function replayAnnotationRemoved(event, eventBus, logger) {
|
|
13021
|
-
const result$ = (0,
|
|
13022
|
-
eventBus.get("mark:deleted").pipe((0,
|
|
13023
|
-
eventBus.get("mark:delete-failed").pipe((0,
|
|
13122
|
+
const result$ = (0, import_rxjs10.race)(
|
|
13123
|
+
eventBus.get("mark:deleted").pipe((0, import_operators10.map)(() => "ok")),
|
|
13124
|
+
eventBus.get("mark:delete-failed").pipe((0, import_operators10.map)((e) => {
|
|
13024
13125
|
throw e.error;
|
|
13025
13126
|
})),
|
|
13026
|
-
(0,
|
|
13127
|
+
(0, import_rxjs10.timer)(REPLAY_TIMEOUT_MS).pipe((0, import_operators10.map)(() => {
|
|
13027
13128
|
throw new Error("Timeout waiting for mark:deleted");
|
|
13028
13129
|
}))
|
|
13029
13130
|
);
|
|
@@ -13032,7 +13133,7 @@ async function replayAnnotationRemoved(event, eventBus, logger) {
|
|
|
13032
13133
|
userId: event.userId,
|
|
13033
13134
|
resourceId: event.resourceId
|
|
13034
13135
|
});
|
|
13035
|
-
await (0,
|
|
13136
|
+
await (0, import_rxjs10.firstValueFrom)(result$);
|
|
13036
13137
|
logger?.debug("Replayed annotation.removed", { annotationId: event.payload.annotationId });
|
|
13037
13138
|
}
|
|
13038
13139
|
async function replayResourceArchived(event, eventBus, logger) {
|
|
@@ -13323,8 +13424,8 @@ function collectContentRefsFromResource(resource, refs) {
|
|
|
13323
13424
|
}
|
|
13324
13425
|
|
|
13325
13426
|
// src/exchange/linked-data-importer.ts
|
|
13326
|
-
var
|
|
13327
|
-
var
|
|
13427
|
+
var import_rxjs11 = __toESM(require_cjs(), 1);
|
|
13428
|
+
var import_operators11 = __toESM(require_operators(), 1);
|
|
13328
13429
|
var IMPORT_TIMEOUT_MS = 3e4;
|
|
13329
13430
|
function stripUriToId(uri) {
|
|
13330
13431
|
if (!uri.includes("/")) return uri;
|
|
@@ -13426,12 +13527,12 @@ async function importLinkedData(archive, options) {
|
|
|
13426
13527
|
};
|
|
13427
13528
|
}
|
|
13428
13529
|
async function addEntityType(entityType, userId2, eventBus, logger) {
|
|
13429
|
-
const result$ = (0,
|
|
13430
|
-
eventBus.get("mark:entity-type-added").pipe((0,
|
|
13431
|
-
eventBus.get("mark:entity-type-add-failed").pipe((0,
|
|
13530
|
+
const result$ = (0, import_rxjs11.race)(
|
|
13531
|
+
eventBus.get("mark:entity-type-added").pipe((0, import_operators11.map)(() => "ok")),
|
|
13532
|
+
eventBus.get("mark:entity-type-add-failed").pipe((0, import_operators11.map)((e) => {
|
|
13432
13533
|
throw e.error;
|
|
13433
13534
|
})),
|
|
13434
|
-
(0,
|
|
13535
|
+
(0, import_rxjs11.timer)(IMPORT_TIMEOUT_MS).pipe((0, import_operators11.map)(() => {
|
|
13435
13536
|
throw new Error("Timeout waiting for mark:entity-type-added");
|
|
13436
13537
|
}))
|
|
13437
13538
|
);
|
|
@@ -13439,7 +13540,7 @@ async function addEntityType(entityType, userId2, eventBus, logger) {
|
|
|
13439
13540
|
tag: entityType,
|
|
13440
13541
|
userId: userId2
|
|
13441
13542
|
});
|
|
13442
|
-
await (0,
|
|
13543
|
+
await (0, import_rxjs11.firstValueFrom)(result$);
|
|
13443
13544
|
logger?.debug("Added entity type", { entityType });
|
|
13444
13545
|
}
|
|
13445
13546
|
async function importResource(doc, userId2, eventBus, resolveBlob, logger) {
|
|
@@ -13464,12 +13565,12 @@ async function importResource(doc, userId2, eventBus, resolveBlob, logger) {
|
|
|
13464
13565
|
if (!blob) {
|
|
13465
13566
|
throw new Error(`Missing content blob for checksum ${contentChecksum} (resource "${name}")`);
|
|
13466
13567
|
}
|
|
13467
|
-
const createResult$ = (0,
|
|
13468
|
-
eventBus.get("yield:created").pipe((0,
|
|
13469
|
-
eventBus.get("yield:create-failed").pipe((0,
|
|
13568
|
+
const createResult$ = (0, import_rxjs11.race)(
|
|
13569
|
+
eventBus.get("yield:created").pipe((0, import_operators11.map)((r) => r)),
|
|
13570
|
+
eventBus.get("yield:create-failed").pipe((0, import_operators11.map)((e) => {
|
|
13470
13571
|
throw e.error;
|
|
13471
13572
|
})),
|
|
13472
|
-
(0,
|
|
13573
|
+
(0, import_rxjs11.timer)(IMPORT_TIMEOUT_MS).pipe((0, import_operators11.map)(() => {
|
|
13473
13574
|
throw new Error("Timeout waiting for yield:created");
|
|
13474
13575
|
}))
|
|
13475
13576
|
);
|
|
@@ -13482,7 +13583,7 @@ async function importResource(doc, userId2, eventBus, resolveBlob, logger) {
|
|
|
13482
13583
|
entityTypes: entityTypes ?? [],
|
|
13483
13584
|
creationMethod
|
|
13484
13585
|
});
|
|
13485
|
-
const created = await (0,
|
|
13586
|
+
const created = await (0, import_rxjs11.firstValueFrom)(createResult$);
|
|
13486
13587
|
const resourceId4 = created.resourceId;
|
|
13487
13588
|
logger?.debug("Created resource from JSON-LD", { name, resourceId: resourceId4 });
|
|
13488
13589
|
let annotationsCreated = 0;
|
|
@@ -13495,12 +13596,12 @@ async function importResource(doc, userId2, eventBus, resolveBlob, logger) {
|
|
|
13495
13596
|
return { annotationsCreated };
|
|
13496
13597
|
}
|
|
13497
13598
|
async function createAnnotation(annotation, resourceId4, userId2, eventBus, logger) {
|
|
13498
|
-
const result$ = (0,
|
|
13499
|
-
eventBus.get("mark:created").pipe((0,
|
|
13500
|
-
eventBus.get("mark:create-failed").pipe((0,
|
|
13599
|
+
const result$ = (0, import_rxjs11.race)(
|
|
13600
|
+
eventBus.get("mark:created").pipe((0, import_operators11.map)(() => "ok")),
|
|
13601
|
+
eventBus.get("mark:create-failed").pipe((0, import_operators11.map)((e) => {
|
|
13501
13602
|
throw e.error;
|
|
13502
13603
|
})),
|
|
13503
|
-
(0,
|
|
13604
|
+
(0, import_rxjs11.timer)(IMPORT_TIMEOUT_MS).pipe((0, import_operators11.map)(() => {
|
|
13504
13605
|
throw new Error("Timeout waiting for mark:created");
|
|
13505
13606
|
}))
|
|
13506
13607
|
);
|
|
@@ -13509,7 +13610,7 @@ async function createAnnotation(annotation, resourceId4, userId2, eventBus, logg
|
|
|
13509
13610
|
userId: userId2,
|
|
13510
13611
|
resourceId: resourceId4
|
|
13511
13612
|
});
|
|
13512
|
-
await (0,
|
|
13613
|
+
await (0, import_rxjs11.firstValueFrom)(result$);
|
|
13513
13614
|
logger?.debug("Created annotation", { annotationId: annotation.id });
|
|
13514
13615
|
}
|
|
13515
13616
|
|
|
@@ -13589,11 +13690,11 @@ export {
|
|
|
13589
13690
|
AnnotationContext,
|
|
13590
13691
|
AnnotationOperations,
|
|
13591
13692
|
BACKUP_FORMAT,
|
|
13693
|
+
Browser,
|
|
13592
13694
|
CloneTokenManager,
|
|
13593
13695
|
FORMAT_VERSION,
|
|
13594
13696
|
Gatherer,
|
|
13595
13697
|
GraphContext,
|
|
13596
|
-
GraphDBConsumer,
|
|
13597
13698
|
LLMContext,
|
|
13598
13699
|
Matcher,
|
|
13599
13700
|
PACKAGE_NAME,
|
|
@@ -13615,6 +13716,7 @@ export {
|
|
|
13615
13716
|
readEntityTypesProjection,
|
|
13616
13717
|
resetBootstrap,
|
|
13617
13718
|
startMakeMeaning,
|
|
13719
|
+
stopKnowledgeSystem,
|
|
13618
13720
|
validateManifestVersion
|
|
13619
13721
|
};
|
|
13620
13722
|
//# sourceMappingURL=index.js.map
|