@semiont/cli 0.5.0 → 0.5.2
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/dist/cli.mjs +596 -389
- package/dist/frontend/dist/assets/{CookiePreferences-CPbRK2Nf.js → CookiePreferences-5feiOAX4.js} +2 -2
- package/dist/frontend/dist/assets/{CookiePreferences-CPbRK2Nf.js.map → CookiePreferences-5feiOAX4.js.map} +1 -1
- package/dist/frontend/dist/assets/{PdfAnnotationCanvas.client-5QESNO5H-CprYrfHh.js → PdfAnnotationCanvas.client-5QESNO5H-Cxm4Es_X.js} +2 -2
- package/dist/frontend/dist/assets/{PdfAnnotationCanvas.client-5QESNO5H-CprYrfHh.js.map → PdfAnnotationCanvas.client-5QESNO5H-Cxm4Es_X.js.map} +1 -1
- package/dist/frontend/dist/assets/ToolbarPanels-D5L18Wxk.js +2 -0
- package/dist/frontend/dist/assets/ToolbarPanels-D5L18Wxk.js.map +1 -0
- package/dist/frontend/dist/assets/client-BmABw25x.js +2 -0
- package/dist/frontend/dist/assets/client-BmABw25x.js.map +1 -0
- package/dist/frontend/dist/assets/client-CTyYgbIC.js +2 -0
- package/dist/frontend/dist/assets/client-CTyYgbIC.js.map +1 -0
- package/dist/frontend/dist/assets/client-Cjf1Te8y.js +2 -0
- package/dist/frontend/dist/assets/client-Cjf1Te8y.js.map +1 -0
- package/dist/frontend/dist/assets/client-D7w_vlsg.js +2 -0
- package/dist/frontend/dist/assets/client-D7w_vlsg.js.map +1 -0
- package/dist/frontend/dist/assets/index-BVOR3arc.js +169 -0
- package/dist/frontend/dist/assets/index-BVOR3arc.js.map +1 -0
- package/dist/frontend/dist/assets/{index-fHqJXd_A.css → index-Dg-Pampr.css} +1 -1
- package/dist/frontend/dist/assets/{layout-w9wtEpkI.js → layout-B1HJjFMW.js} +2 -2
- package/dist/frontend/dist/assets/layout-B1HJjFMW.js.map +1 -0
- package/dist/frontend/dist/assets/layout-B7mIcfJU.js +2 -0
- package/dist/frontend/dist/assets/layout-B7mIcfJU.js.map +1 -0
- package/dist/frontend/dist/assets/{layout-B-lufx1s.js → layout-BK6OF3Hx.js} +2 -2
- package/dist/frontend/dist/assets/{layout-B-lufx1s.js.map → layout-BK6OF3Hx.js.map} +1 -1
- package/dist/frontend/dist/assets/{layout-BWesrQWr.js → layout-Cw-T4GPy.js} +2 -2
- package/dist/frontend/dist/assets/{layout-BWesrQWr.js.map → layout-Cw-T4GPy.js.map} +1 -1
- package/dist/frontend/dist/assets/{not-found-C0HTZoKU.js → not-found-uRBdv-bF.js} +2 -2
- package/dist/frontend/dist/assets/{not-found-C0HTZoKU.js.map → not-found-uRBdv-bF.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-haUujHsJ.js → page-5wC1as95.js} +2 -2
- package/dist/frontend/dist/assets/{page-haUujHsJ.js.map → page-5wC1as95.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-CN1zC8Ky.js → page-B6XEk2Ue.js} +2 -2
- package/dist/frontend/dist/assets/{page-CN1zC8Ky.js.map → page-B6XEk2Ue.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-BMeXKClk.js → page-BLt9SJto.js} +2 -2
- package/dist/frontend/dist/assets/page-BLt9SJto.js.map +1 -0
- package/dist/frontend/dist/assets/{page-DYOj954J.js → page-BNaAGnc3.js} +2 -2
- package/dist/frontend/dist/assets/{page-DYOj954J.js.map → page-BNaAGnc3.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-CPL87vBZ.js → page-Bcljtfsa.js} +2 -2
- package/dist/frontend/dist/assets/{page-CPL87vBZ.js.map → page-Bcljtfsa.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-Dvw2I_gp.js → page-Bf4MMijQ.js} +2 -2
- package/dist/frontend/dist/assets/{page-Dvw2I_gp.js.map → page-Bf4MMijQ.js.map} +1 -1
- package/dist/frontend/dist/assets/page-BlU7QK_-.js +2 -0
- package/dist/frontend/dist/assets/page-BlU7QK_-.js.map +1 -0
- package/dist/frontend/dist/assets/{page-BIyG0SOs.js → page-Bnawjb1Y.js} +2 -2
- package/dist/frontend/dist/assets/{page-BIyG0SOs.js.map → page-Bnawjb1Y.js.map} +1 -1
- package/dist/frontend/dist/assets/page-C7vfVcap.js +2 -0
- package/dist/frontend/dist/assets/{page-Du1JP0jA.js.map → page-C7vfVcap.js.map} +1 -1
- package/dist/frontend/dist/assets/page-CBL0MuAo.js +2 -0
- package/dist/frontend/dist/assets/page-CBL0MuAo.js.map +1 -0
- package/dist/frontend/dist/assets/page-CKCKmPQO.js +2 -0
- package/dist/frontend/dist/assets/page-CKCKmPQO.js.map +1 -0
- package/dist/frontend/dist/assets/page-CdqGKYBH.js +2 -0
- package/dist/frontend/dist/assets/page-CdqGKYBH.js.map +1 -0
- package/dist/frontend/dist/assets/{page-CryPHwXI.js → page-CfMLSllg.js} +2 -2
- package/dist/frontend/dist/assets/{page-CryPHwXI.js.map → page-CfMLSllg.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-BoFYscYi.js → page-D7w7NNd7.js} +2 -2
- package/dist/frontend/dist/assets/{page-BoFYscYi.js.map → page-D7w7NNd7.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-BkEdFy5p.js → page-DAH06BM4.js} +2 -2
- package/dist/frontend/dist/assets/{page-BkEdFy5p.js.map → page-DAH06BM4.js.map} +1 -1
- package/dist/frontend/dist/assets/page-Dgqi9Orl.js +2 -0
- package/dist/frontend/dist/assets/page-Dgqi9Orl.js.map +1 -0
- package/dist/frontend/dist/assets/{page-CHCWv8gH.js → page-SrDV7XYv.js} +2 -2
- package/dist/frontend/dist/assets/{page-CHCWv8gH.js.map → page-SrDV7XYv.js.map} +1 -1
- package/dist/frontend/dist/assets/{page--QmNUvGH.js → page-wxqWVnqc.js} +2 -2
- package/dist/frontend/dist/assets/page-wxqWVnqc.js.map +1 -0
- package/dist/frontend/dist/assets/{privacy-CZ8NTWnp.js → privacy-Kk_oWnpO.js} +2 -2
- package/dist/frontend/dist/assets/{privacy-CZ8NTWnp.js.map → privacy-Kk_oWnpO.js.map} +1 -1
- package/dist/frontend/dist/assets/{routing-DCIgrT7s.js → routing-CGghUc0N.js} +2 -2
- package/dist/frontend/dist/assets/{routing-DCIgrT7s.js.map → routing-CGghUc0N.js.map} +1 -1
- package/dist/frontend/dist/assets/{routing-D4iNsc7y.js → routing-CKNCPdYO.js} +2 -2
- package/dist/frontend/dist/assets/{routing-D4iNsc7y.js.map → routing-CKNCPdYO.js.map} +1 -1
- package/dist/frontend/dist/assets/{web-Ua5dIRkZ.js → web-DdXPBk3h.js} +2 -2
- package/dist/frontend/dist/assets/{web-Ua5dIRkZ.js.map → web-DdXPBk3h.js.map} +1 -1
- package/dist/frontend/dist/index.html +2 -2
- package/dist/frontend/package.json +1 -1
- package/package.json +8 -8
- package/dist/frontend/dist/assets/ToolbarPanels-CPoZvoTB.js +0 -2
- package/dist/frontend/dist/assets/ToolbarPanels-CPoZvoTB.js.map +0 -1
- package/dist/frontend/dist/assets/client-CCxdaxo8.js +0 -2
- package/dist/frontend/dist/assets/client-CCxdaxo8.js.map +0 -1
- package/dist/frontend/dist/assets/client-CPOjL49o.js +0 -2
- package/dist/frontend/dist/assets/client-CPOjL49o.js.map +0 -1
- package/dist/frontend/dist/assets/client-D04WIU14.js +0 -2
- package/dist/frontend/dist/assets/client-D04WIU14.js.map +0 -1
- package/dist/frontend/dist/assets/client-kS15_T5U.js +0 -2
- package/dist/frontend/dist/assets/client-kS15_T5U.js.map +0 -1
- package/dist/frontend/dist/assets/index-Bsr9DJ3G.js +0 -169
- package/dist/frontend/dist/assets/index-Bsr9DJ3G.js.map +0 -1
- package/dist/frontend/dist/assets/layout-DqFHhLVw.js +0 -2
- package/dist/frontend/dist/assets/layout-DqFHhLVw.js.map +0 -1
- package/dist/frontend/dist/assets/layout-w9wtEpkI.js.map +0 -1
- package/dist/frontend/dist/assets/page--QmNUvGH.js.map +0 -1
- package/dist/frontend/dist/assets/page-BMeXKClk.js.map +0 -1
- package/dist/frontend/dist/assets/page-BS88Xh4W.js +0 -2
- package/dist/frontend/dist/assets/page-BS88Xh4W.js.map +0 -1
- package/dist/frontend/dist/assets/page-BzkBmeDS.js +0 -2
- package/dist/frontend/dist/assets/page-BzkBmeDS.js.map +0 -1
- package/dist/frontend/dist/assets/page-C43cKrO_.js +0 -2
- package/dist/frontend/dist/assets/page-C43cKrO_.js.map +0 -1
- package/dist/frontend/dist/assets/page-CU11Rd_F.js +0 -2
- package/dist/frontend/dist/assets/page-CU11Rd_F.js.map +0 -1
- package/dist/frontend/dist/assets/page-Du1JP0jA.js +0 -2
- package/dist/frontend/dist/assets/page-JI9gNkHU.js +0 -2
- package/dist/frontend/dist/assets/page-JI9gNkHU.js.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -8378,26 +8378,26 @@ var require_BehaviorSubject = __commonJS({
|
|
|
8378
8378
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8379
8379
|
exports.BehaviorSubject = void 0;
|
|
8380
8380
|
var Subject_1 = require_Subject();
|
|
8381
|
-
var
|
|
8382
|
-
__extends(
|
|
8383
|
-
function
|
|
8381
|
+
var BehaviorSubject2 = (function(_super) {
|
|
8382
|
+
__extends(BehaviorSubject3, _super);
|
|
8383
|
+
function BehaviorSubject3(_value) {
|
|
8384
8384
|
var _this = _super.call(this) || this;
|
|
8385
8385
|
_this._value = _value;
|
|
8386
8386
|
return _this;
|
|
8387
8387
|
}
|
|
8388
|
-
Object.defineProperty(
|
|
8388
|
+
Object.defineProperty(BehaviorSubject3.prototype, "value", {
|
|
8389
8389
|
get: function() {
|
|
8390
8390
|
return this.getValue();
|
|
8391
8391
|
},
|
|
8392
8392
|
enumerable: false,
|
|
8393
8393
|
configurable: true
|
|
8394
8394
|
});
|
|
8395
|
-
|
|
8395
|
+
BehaviorSubject3.prototype._subscribe = function(subscriber) {
|
|
8396
8396
|
var subscription = _super.prototype._subscribe.call(this, subscriber);
|
|
8397
8397
|
!subscription.closed && subscriber.next(this._value);
|
|
8398
8398
|
return subscription;
|
|
8399
8399
|
};
|
|
8400
|
-
|
|
8400
|
+
BehaviorSubject3.prototype.getValue = function() {
|
|
8401
8401
|
var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, _value = _a._value;
|
|
8402
8402
|
if (hasError) {
|
|
8403
8403
|
throw thrownError;
|
|
@@ -8405,12 +8405,12 @@ var require_BehaviorSubject = __commonJS({
|
|
|
8405
8405
|
this._throwIfClosed();
|
|
8406
8406
|
return _value;
|
|
8407
8407
|
};
|
|
8408
|
-
|
|
8408
|
+
BehaviorSubject3.prototype.next = function(value) {
|
|
8409
8409
|
_super.prototype.next.call(this, this._value = value);
|
|
8410
8410
|
};
|
|
8411
|
-
return
|
|
8411
|
+
return BehaviorSubject3;
|
|
8412
8412
|
})(Subject_1.Subject);
|
|
8413
|
-
exports.BehaviorSubject =
|
|
8413
|
+
exports.BehaviorSubject = BehaviorSubject2;
|
|
8414
8414
|
}
|
|
8415
8415
|
});
|
|
8416
8416
|
|
|
@@ -10455,7 +10455,7 @@ var require_throwError = __commonJS({
|
|
|
10455
10455
|
exports.throwError = void 0;
|
|
10456
10456
|
var Observable_1 = require_Observable();
|
|
10457
10457
|
var isFunction_1 = require_isFunction();
|
|
10458
|
-
function
|
|
10458
|
+
function throwError3(errorOrErrorFactory, scheduler) {
|
|
10459
10459
|
var errorFactory = isFunction_1.isFunction(errorOrErrorFactory) ? errorOrErrorFactory : function() {
|
|
10460
10460
|
return errorOrErrorFactory;
|
|
10461
10461
|
};
|
|
@@ -10466,7 +10466,7 @@ var require_throwError = __commonJS({
|
|
|
10466
10466
|
return scheduler.schedule(init2, 0, subscriber);
|
|
10467
10467
|
} : init2);
|
|
10468
10468
|
}
|
|
10469
|
-
exports.throwError =
|
|
10469
|
+
exports.throwError = throwError3;
|
|
10470
10470
|
}
|
|
10471
10471
|
});
|
|
10472
10472
|
|
|
@@ -10578,7 +10578,7 @@ var require_lastValueFrom = __commonJS({
|
|
|
10578
10578
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10579
10579
|
exports.lastValueFrom = void 0;
|
|
10580
10580
|
var EmptyError_1 = require_EmptyError();
|
|
10581
|
-
function
|
|
10581
|
+
function lastValueFrom6(source, config) {
|
|
10582
10582
|
var hasConfig = typeof config === "object";
|
|
10583
10583
|
return new Promise(function(resolve9, reject) {
|
|
10584
10584
|
var _hasValue = false;
|
|
@@ -10601,7 +10601,7 @@ var require_lastValueFrom = __commonJS({
|
|
|
10601
10601
|
});
|
|
10602
10602
|
});
|
|
10603
10603
|
}
|
|
10604
|
-
exports.lastValueFrom =
|
|
10604
|
+
exports.lastValueFrom = lastValueFrom6;
|
|
10605
10605
|
}
|
|
10606
10606
|
});
|
|
10607
10607
|
|
|
@@ -12463,13 +12463,13 @@ var require_catchError = __commonJS({
|
|
|
12463
12463
|
var innerFrom_1 = require_innerFrom();
|
|
12464
12464
|
var OperatorSubscriber_1 = require_OperatorSubscriber();
|
|
12465
12465
|
var lift_1 = require_lift();
|
|
12466
|
-
function
|
|
12466
|
+
function catchError2(selector) {
|
|
12467
12467
|
return lift_1.operate(function(source, subscriber) {
|
|
12468
12468
|
var innerSub = null;
|
|
12469
12469
|
var syncUnsub = false;
|
|
12470
12470
|
var handledResult;
|
|
12471
12471
|
innerSub = source.subscribe(OperatorSubscriber_1.createOperatorSubscriber(subscriber, void 0, void 0, function(err) {
|
|
12472
|
-
handledResult = innerFrom_1.innerFrom(selector(err,
|
|
12472
|
+
handledResult = innerFrom_1.innerFrom(selector(err, catchError2(selector)(source)));
|
|
12473
12473
|
if (innerSub) {
|
|
12474
12474
|
innerSub.unsubscribe();
|
|
12475
12475
|
innerSub = null;
|
|
@@ -12485,7 +12485,7 @@ var require_catchError = __commonJS({
|
|
|
12485
12485
|
}
|
|
12486
12486
|
});
|
|
12487
12487
|
}
|
|
12488
|
-
exports.catchError =
|
|
12488
|
+
exports.catchError = catchError2;
|
|
12489
12489
|
}
|
|
12490
12490
|
});
|
|
12491
12491
|
|
|
@@ -16922,9 +16922,10 @@ var require_operators = __commonJS({
|
|
|
16922
16922
|
});
|
|
16923
16923
|
|
|
16924
16924
|
// ../../packages/sdk/dist/index.js
|
|
16925
|
-
import { annotationId, resourceId, email, googleCredential, refreshToken, EventBus,
|
|
16926
|
-
import {
|
|
16927
|
-
import {
|
|
16925
|
+
import { SemiontError, annotationId, resourceId, email, googleCredential, refreshToken, EventBus, baseUrl, accessToken, searchQuery } from "@semiont/core";
|
|
16926
|
+
import { SemiontError as SemiontError2, accessToken as accessToken2, annotationId as annotationId2, baseUrl as baseUrl2, entityType, refreshToken as refreshToken2, resourceId as resourceId2, userId } from "@semiont/core";
|
|
16927
|
+
import { HttpTransport, HttpContentTransport, APIError } from "@semiont/api-client";
|
|
16928
|
+
import { APIError as APIError2, HttpContentTransport as HttpContentTransport2, HttpTransport as HttpTransport2 } from "@semiont/api-client";
|
|
16928
16929
|
async function busRequest(bus, emitChannel, payload, resultChannel, failureChannel, timeoutMs = 3e4) {
|
|
16929
16930
|
const correlationId = crypto.randomUUID();
|
|
16930
16931
|
const fullPayload = { ...payload, correlationId };
|
|
@@ -16935,9 +16936,31 @@ async function busRequest(bus, emitChannel, payload, resultChannel, failureChann
|
|
|
16935
16936
|
),
|
|
16936
16937
|
bus.stream(failureChannel).pipe(
|
|
16937
16938
|
(0, import_operators.filter)((e) => e.correlationId === correlationId),
|
|
16938
|
-
(0, import_operators.map)((e) => ({
|
|
16939
|
+
(0, import_operators.map)((e) => ({
|
|
16940
|
+
ok: false,
|
|
16941
|
+
error: new BusRequestError(e.message ?? "Bus request rejected", "bus.rejected", {
|
|
16942
|
+
channel: failureChannel,
|
|
16943
|
+
correlationId,
|
|
16944
|
+
payload: e
|
|
16945
|
+
})
|
|
16946
|
+
}))
|
|
16939
16947
|
)
|
|
16940
|
-
).pipe(
|
|
16948
|
+
).pipe(
|
|
16949
|
+
(0, import_operators.take)(1),
|
|
16950
|
+
(0, import_operators.timeout)(timeoutMs),
|
|
16951
|
+
(0, import_operators.catchError)((err) => {
|
|
16952
|
+
if (err instanceof import_rxjs.TimeoutError) {
|
|
16953
|
+
return (0, import_rxjs.throwError)(
|
|
16954
|
+
() => new BusRequestError(
|
|
16955
|
+
`Bus request timed out after ${timeoutMs}ms on ${resultChannel}`,
|
|
16956
|
+
"bus.timeout",
|
|
16957
|
+
{ channel: emitChannel, resultChannel, correlationId, timeoutMs }
|
|
16958
|
+
)
|
|
16959
|
+
);
|
|
16960
|
+
}
|
|
16961
|
+
return (0, import_rxjs.throwError)(() => err);
|
|
16962
|
+
})
|
|
16963
|
+
);
|
|
16941
16964
|
const resultPromise = (0, import_rxjs.firstValueFrom)(result$);
|
|
16942
16965
|
await bus.emit(emitChannel, fullPayload);
|
|
16943
16966
|
const result = await resultPromise;
|
|
@@ -17012,15 +17035,71 @@ function createCache(fetchFn) {
|
|
|
17012
17035
|
}
|
|
17013
17036
|
};
|
|
17014
17037
|
}
|
|
17015
|
-
|
|
17038
|
+
function wrapAsStream(source) {
|
|
17039
|
+
return new StreamObservable((subscriber) => {
|
|
17040
|
+
const sub = source.subscribe({
|
|
17041
|
+
next: (v) => subscriber.next(v),
|
|
17042
|
+
error: (e) => subscriber.error(e),
|
|
17043
|
+
complete: () => subscriber.complete()
|
|
17044
|
+
});
|
|
17045
|
+
return () => sub.unsubscribe();
|
|
17046
|
+
});
|
|
17047
|
+
}
|
|
17048
|
+
var import_rxjs, import_operators, StreamObservable, CacheObservable, wrapperCache, UploadObservable, BusRequestError, ENTITY_TYPES_KEY, BrowseNamespace, MarkNamespace, BindNamespace, GatherNamespace, MatchNamespace, YieldNamespace, BeckonNamespace, FrameNamespace, JobNamespace, AuthNamespace, AdminNamespace, SemiontClient, REFRESH_BEFORE_EXP_MS;
|
|
17016
17049
|
var init_dist = __esm({
|
|
17017
17050
|
"../../packages/sdk/dist/index.js"() {
|
|
17018
17051
|
"use strict";
|
|
17019
17052
|
import_rxjs = __toESM(require_cjs(), 1);
|
|
17020
17053
|
import_operators = __toESM(require_operators(), 1);
|
|
17021
|
-
|
|
17022
|
-
|
|
17023
|
-
|
|
17054
|
+
StreamObservable = class _StreamObservable extends import_rxjs.Observable {
|
|
17055
|
+
then(onfulfilled, onrejected) {
|
|
17056
|
+
return (0, import_rxjs.lastValueFrom)(this).then(onfulfilled, onrejected);
|
|
17057
|
+
}
|
|
17058
|
+
/** Wrap an existing Observable's subscribe behavior in a StreamObservable. */
|
|
17059
|
+
static from(source) {
|
|
17060
|
+
return new _StreamObservable((subscriber) => source.subscribe(subscriber));
|
|
17061
|
+
}
|
|
17062
|
+
};
|
|
17063
|
+
CacheObservable = class _CacheObservable extends import_rxjs.Observable {
|
|
17064
|
+
then(onfulfilled, onrejected) {
|
|
17065
|
+
return (0, import_rxjs.firstValueFrom)(this.pipe((0, import_operators.filter)((v) => v !== void 0))).then(onfulfilled, onrejected);
|
|
17066
|
+
}
|
|
17067
|
+
/**
|
|
17068
|
+
* Wrap an existing Observable's subscribe behavior in a `CacheObservable`.
|
|
17069
|
+
*
|
|
17070
|
+
* Memoizes on source identity: passing the same `source` returns the same
|
|
17071
|
+
* wrapper instance. The Browse cache primitive already returns a stable
|
|
17072
|
+
* Observable per key (its B4 contract), so this preserves that contract
|
|
17073
|
+
* through the awaitable wrapping. Without the memo, every public-method
|
|
17074
|
+
* call would produce a fresh wrapper and break referential-equality
|
|
17075
|
+
* guarantees that hook-style reactive consumers depend on.
|
|
17076
|
+
*
|
|
17077
|
+
* Backed by a `WeakMap`, so wrappers are GC'd when their source is.
|
|
17078
|
+
*/
|
|
17079
|
+
static from(source) {
|
|
17080
|
+
let wrapper = wrapperCache.get(source);
|
|
17081
|
+
if (!wrapper) {
|
|
17082
|
+
wrapper = new _CacheObservable((subscriber) => source.subscribe(subscriber));
|
|
17083
|
+
wrapperCache.set(source, wrapper);
|
|
17084
|
+
}
|
|
17085
|
+
return wrapper;
|
|
17086
|
+
}
|
|
17087
|
+
};
|
|
17088
|
+
wrapperCache = /* @__PURE__ */ new WeakMap();
|
|
17089
|
+
UploadObservable = class extends import_rxjs.Observable {
|
|
17090
|
+
then(onfulfilled, onrejected) {
|
|
17091
|
+
return (0, import_rxjs.lastValueFrom)(this).then((v) => {
|
|
17092
|
+
if (v.phase !== "finished") {
|
|
17093
|
+
throw new Error(`UploadObservable resolved on a non-finished event: ${v.phase}`);
|
|
17094
|
+
}
|
|
17095
|
+
const result = { resourceId: v.resourceId };
|
|
17096
|
+
return onfulfilled ? onfulfilled(result) : result;
|
|
17097
|
+
}, onrejected);
|
|
17098
|
+
}
|
|
17099
|
+
};
|
|
17100
|
+
BusRequestError = class extends SemiontError {
|
|
17101
|
+
constructor(message, code, details) {
|
|
17102
|
+
super(message, code, details);
|
|
17024
17103
|
this.name = "BusRequestError";
|
|
17025
17104
|
}
|
|
17026
17105
|
};
|
|
@@ -17030,11 +17109,6 @@ var init_dist = __esm({
|
|
|
17030
17109
|
this.transport = transport;
|
|
17031
17110
|
this.bus = bus;
|
|
17032
17111
|
this.content = content;
|
|
17033
|
-
const g = globalThis;
|
|
17034
|
-
g.__SEMIONT_BROWSE_INSTANCES__ = (g.__SEMIONT_BROWSE_INSTANCES__ ?? 0) + 1;
|
|
17035
|
-
const browseSerial = g.__SEMIONT_BROWSE_INSTANCES__;
|
|
17036
|
-
this.__serial__ = browseSerial;
|
|
17037
|
-
console.debug(`[diag] BrowseNamespace #${browseSerial} constructed`);
|
|
17038
17112
|
this.resourceCache = createCache(async (id) => {
|
|
17039
17113
|
const result = await busRequest(
|
|
17040
17114
|
this.transport,
|
|
@@ -17057,32 +17131,30 @@ var init_dist = __esm({
|
|
|
17057
17131
|
);
|
|
17058
17132
|
return result.resources;
|
|
17059
17133
|
});
|
|
17060
|
-
this.annotationListCache = createCache(async (
|
|
17134
|
+
this.annotationListCache = createCache(async (resourceId22) => {
|
|
17061
17135
|
return busRequest(
|
|
17062
17136
|
this.transport,
|
|
17063
17137
|
"browse:annotations-requested",
|
|
17064
|
-
{ resourceId:
|
|
17138
|
+
{ resourceId: resourceId22 },
|
|
17065
17139
|
"browse:annotations-result",
|
|
17066
17140
|
"browse:annotations-failed"
|
|
17067
17141
|
);
|
|
17068
17142
|
});
|
|
17069
|
-
this.annotationDetailCache = createCache(async (
|
|
17070
|
-
const
|
|
17071
|
-
if (!
|
|
17072
|
-
throw new Error(`Cannot fetch annotation ${
|
|
17143
|
+
this.annotationDetailCache = createCache(async (annotationId22) => {
|
|
17144
|
+
const resourceId22 = this.annotationResources.get(annotationId22);
|
|
17145
|
+
if (!resourceId22) {
|
|
17146
|
+
throw new Error(`Cannot fetch annotation ${annotationId22}: no resourceId known`);
|
|
17073
17147
|
}
|
|
17074
17148
|
const result = await busRequest(
|
|
17075
17149
|
this.transport,
|
|
17076
17150
|
"browse:annotation-requested",
|
|
17077
|
-
{ resourceId:
|
|
17151
|
+
{ resourceId: resourceId22, annotationId: annotationId22 },
|
|
17078
17152
|
"browse:annotation-result",
|
|
17079
17153
|
"browse:annotation-failed"
|
|
17080
17154
|
);
|
|
17081
17155
|
return result.annotation;
|
|
17082
17156
|
});
|
|
17083
17157
|
this.entityTypesCache = createCache(async () => {
|
|
17084
|
-
const serial = this.__serial__;
|
|
17085
|
-
console.debug(`[diag] BrowseNamespace#${serial} entityTypes fetchFn START`);
|
|
17086
17158
|
const result = await busRequest(
|
|
17087
17159
|
this.transport,
|
|
17088
17160
|
"browse:entity-types-requested",
|
|
@@ -17090,24 +17162,23 @@ var init_dist = __esm({
|
|
|
17090
17162
|
"browse:entity-types-result",
|
|
17091
17163
|
"browse:entity-types-failed"
|
|
17092
17164
|
);
|
|
17093
|
-
console.debug(`[diag] BrowseNamespace#${serial} entityTypes fetchFn RESOLVE`, JSON.stringify(result.entityTypes).slice(0, 200));
|
|
17094
17165
|
return result.entityTypes;
|
|
17095
17166
|
});
|
|
17096
|
-
this.referencedByCache = createCache(async (
|
|
17167
|
+
this.referencedByCache = createCache(async (resourceId22) => {
|
|
17097
17168
|
const result = await busRequest(
|
|
17098
17169
|
this.transport,
|
|
17099
17170
|
"browse:referenced-by-requested",
|
|
17100
|
-
{ resourceId:
|
|
17171
|
+
{ resourceId: resourceId22 },
|
|
17101
17172
|
"browse:referenced-by-result",
|
|
17102
17173
|
"browse:referenced-by-failed"
|
|
17103
17174
|
);
|
|
17104
17175
|
return result.referencedBy;
|
|
17105
17176
|
});
|
|
17106
|
-
this.resourceEventsCache = createCache(async (
|
|
17177
|
+
this.resourceEventsCache = createCache(async (resourceId22) => {
|
|
17107
17178
|
const result = await busRequest(
|
|
17108
17179
|
this.transport,
|
|
17109
17180
|
"browse:events-requested",
|
|
17110
|
-
{ resourceId:
|
|
17181
|
+
{ resourceId: resourceId22 },
|
|
17111
17182
|
"browse:events-result",
|
|
17112
17183
|
"browse:events-failed"
|
|
17113
17184
|
);
|
|
@@ -17119,7 +17190,7 @@ var init_dist = __esm({
|
|
|
17119
17190
|
//
|
|
17120
17191
|
// Each cache encapsulates the BehaviorSubject store, in-flight guard,
|
|
17121
17192
|
// and per-key observable memoization that was previously open-coded
|
|
17122
|
-
// here. Behavioral contract: `packages/
|
|
17193
|
+
// here. Behavioral contract: `packages/sdk/docs/CACHE-SEMANTICS.md`.
|
|
17123
17194
|
//
|
|
17124
17195
|
// Public surface (`resource()`, `annotations()`, etc.) is unchanged;
|
|
17125
17196
|
// the caches are an implementation detail of this namespace.
|
|
@@ -17151,71 +17222,66 @@ var init_dist = __esm({
|
|
|
17151
17222
|
*/
|
|
17152
17223
|
annotationListObs = /* @__PURE__ */ new Map();
|
|
17153
17224
|
// ── Live queries ────────────────────────────────────────────────────────
|
|
17154
|
-
|
|
17155
|
-
|
|
17225
|
+
//
|
|
17226
|
+
// These return `CacheObservable<T>`: subscribers see `T | undefined`
|
|
17227
|
+
// (with `undefined` during initial load), and `await` resolves to the
|
|
17228
|
+
// first non-undefined value.
|
|
17229
|
+
resource(resourceId22) {
|
|
17230
|
+
return CacheObservable.from(this.resourceCache.observe(resourceId22));
|
|
17156
17231
|
}
|
|
17157
17232
|
resources(filters) {
|
|
17158
17233
|
const key = JSON.stringify(filters ?? {});
|
|
17159
17234
|
this.resourceListFilters.set(key, filters ?? {});
|
|
17160
|
-
return this.resourceListCache.observe(key);
|
|
17235
|
+
return CacheObservable.from(this.resourceListCache.observe(key));
|
|
17161
17236
|
}
|
|
17162
|
-
annotations(
|
|
17163
|
-
let obs = this.annotationListObs.get(
|
|
17237
|
+
annotations(resourceId22) {
|
|
17238
|
+
let obs = this.annotationListObs.get(resourceId22);
|
|
17164
17239
|
if (!obs) {
|
|
17165
|
-
obs = this.annotationListCache.observe(
|
|
17166
|
-
this.annotationListObs.set(
|
|
17240
|
+
obs = this.annotationListCache.observe(resourceId22).pipe((0, import_rxjs.map)((r) => r?.annotations));
|
|
17241
|
+
this.annotationListObs.set(resourceId22, obs);
|
|
17167
17242
|
}
|
|
17168
|
-
return obs;
|
|
17243
|
+
return CacheObservable.from(obs);
|
|
17169
17244
|
}
|
|
17170
|
-
annotation(
|
|
17171
|
-
this.annotationResources.set(
|
|
17172
|
-
return this.annotationDetailCache.observe(
|
|
17245
|
+
annotation(resourceId22, annotationId22) {
|
|
17246
|
+
this.annotationResources.set(annotationId22, resourceId22);
|
|
17247
|
+
return CacheObservable.from(this.annotationDetailCache.observe(annotationId22));
|
|
17173
17248
|
}
|
|
17174
17249
|
entityTypes() {
|
|
17175
|
-
|
|
17176
|
-
console.debug(`[diag] BrowseNamespace#${serial} entityTypes() called`);
|
|
17177
|
-
const self = this;
|
|
17178
|
-
if (!self.__entityTypesDiag__) {
|
|
17179
|
-
self.__entityTypesDiag__ = this.entityTypesCache.observe(ENTITY_TYPES_KEY).pipe((0, import_rxjs.map)((v) => {
|
|
17180
|
-
console.debug(`[diag] BrowseNamespace#${serial} entityTypes$ EMIT`, v === void 0 ? "undefined" : JSON.stringify(v).slice(0, 200));
|
|
17181
|
-
return v;
|
|
17182
|
-
}));
|
|
17183
|
-
}
|
|
17184
|
-
return self.__entityTypesDiag__;
|
|
17250
|
+
return CacheObservable.from(this.entityTypesCache.observe(ENTITY_TYPES_KEY));
|
|
17185
17251
|
}
|
|
17186
|
-
referencedBy(
|
|
17187
|
-
return this.referencedByCache.observe(
|
|
17252
|
+
referencedBy(resourceId22) {
|
|
17253
|
+
return CacheObservable.from(this.referencedByCache.observe(resourceId22));
|
|
17188
17254
|
}
|
|
17189
|
-
events(
|
|
17190
|
-
return this.resourceEventsCache.observe(
|
|
17255
|
+
events(resourceId22) {
|
|
17256
|
+
return CacheObservable.from(this.resourceEventsCache.observe(resourceId22));
|
|
17191
17257
|
}
|
|
17192
17258
|
// ── One-shot reads ──────────────────────────────────────────────────────
|
|
17193
|
-
async resourceContent(
|
|
17194
|
-
const result = await this.content.getBinary(
|
|
17259
|
+
async resourceContent(resourceId22) {
|
|
17260
|
+
const result = await this.content.getBinary(resourceId22, { accept: "text/plain" });
|
|
17195
17261
|
const decoder = new TextDecoder();
|
|
17196
17262
|
return decoder.decode(result.data);
|
|
17197
17263
|
}
|
|
17198
|
-
async resourceRepresentation(
|
|
17199
|
-
return this.content.getBinary(
|
|
17264
|
+
async resourceRepresentation(resourceId22, options) {
|
|
17265
|
+
return this.content.getBinary(resourceId22, options?.accept ? { accept: options.accept } : void 0);
|
|
17200
17266
|
}
|
|
17201
|
-
async resourceRepresentationStream(
|
|
17202
|
-
return this.content.getBinaryStream(
|
|
17267
|
+
async resourceRepresentationStream(resourceId22, options) {
|
|
17268
|
+
return this.content.getBinaryStream(resourceId22, options?.accept ? { accept: options.accept } : void 0);
|
|
17203
17269
|
}
|
|
17204
|
-
async resourceEvents(
|
|
17270
|
+
async resourceEvents(resourceId22) {
|
|
17205
17271
|
const result = await busRequest(
|
|
17206
17272
|
this.transport,
|
|
17207
17273
|
"browse:events-requested",
|
|
17208
|
-
{ resourceId:
|
|
17274
|
+
{ resourceId: resourceId22 },
|
|
17209
17275
|
"browse:events-result",
|
|
17210
17276
|
"browse:events-failed"
|
|
17211
17277
|
);
|
|
17212
17278
|
return result.events;
|
|
17213
17279
|
}
|
|
17214
|
-
async annotationHistory(
|
|
17280
|
+
async annotationHistory(resourceId22, annotationId22) {
|
|
17215
17281
|
return busRequest(
|
|
17216
17282
|
this.transport,
|
|
17217
17283
|
"browse:annotation-history-requested",
|
|
17218
|
-
{ resourceId:
|
|
17284
|
+
{ resourceId: resourceId22, annotationId: annotationId22 },
|
|
17219
17285
|
"browse:annotation-history-result",
|
|
17220
17286
|
"browse:annotation-history-failed"
|
|
17221
17287
|
);
|
|
@@ -17239,11 +17305,11 @@ var init_dist = __esm({
|
|
|
17239
17305
|
);
|
|
17240
17306
|
}
|
|
17241
17307
|
// ── UI signals (local bus fan-out) ────────────────────────────────────
|
|
17242
|
-
click(
|
|
17243
|
-
this.bus.get("browse:click").next({ annotationId:
|
|
17308
|
+
click(annotationId22, motivation) {
|
|
17309
|
+
this.bus.get("browse:click").next({ annotationId: annotationId22, motivation });
|
|
17244
17310
|
}
|
|
17245
|
-
navigateReference(
|
|
17246
|
-
this.bus.get("browse:reference-navigate").next({ resourceId:
|
|
17311
|
+
navigateReference(resourceId22) {
|
|
17312
|
+
this.bus.get("browse:reference-navigate").next({ resourceId: resourceId22 });
|
|
17247
17313
|
}
|
|
17248
17314
|
// ── Cache-mutation API (used by the bus-event subscribers below and by
|
|
17249
17315
|
// other namespaces that know about specific updates) ─────────────────
|
|
@@ -17251,12 +17317,12 @@ var init_dist = __esm({
|
|
|
17251
17317
|
// - `invalidate*` — SWR refetch (B7). Keeps prior value visible.
|
|
17252
17318
|
// - `removeAnnotationDetail` — drops the entry (B13a: entity gone).
|
|
17253
17319
|
// - `updateAnnotationInPlace` — write-through (B13b: new value known).
|
|
17254
|
-
invalidateAnnotationList(
|
|
17255
|
-
this.annotationListCache.invalidate(
|
|
17320
|
+
invalidateAnnotationList(resourceId22) {
|
|
17321
|
+
this.annotationListCache.invalidate(resourceId22);
|
|
17256
17322
|
}
|
|
17257
|
-
removeAnnotationDetail(
|
|
17258
|
-
this.annotationDetailCache.remove(
|
|
17259
|
-
this.annotationResources.delete(
|
|
17323
|
+
removeAnnotationDetail(annotationId22) {
|
|
17324
|
+
this.annotationDetailCache.remove(annotationId22);
|
|
17325
|
+
this.annotationResources.delete(annotationId22);
|
|
17260
17326
|
}
|
|
17261
17327
|
invalidateResourceDetail(id) {
|
|
17262
17328
|
this.resourceCache.invalidate(id);
|
|
@@ -17267,21 +17333,21 @@ var init_dist = __esm({
|
|
|
17267
17333
|
invalidateEntityTypes() {
|
|
17268
17334
|
this.entityTypesCache.invalidate(ENTITY_TYPES_KEY);
|
|
17269
17335
|
}
|
|
17270
|
-
invalidateReferencedBy(
|
|
17271
|
-
this.referencedByCache.invalidate(
|
|
17336
|
+
invalidateReferencedBy(resourceId22) {
|
|
17337
|
+
this.referencedByCache.invalidate(resourceId22);
|
|
17272
17338
|
}
|
|
17273
|
-
invalidateResourceEvents(
|
|
17274
|
-
this.resourceEventsCache.invalidate(
|
|
17339
|
+
invalidateResourceEvents(resourceId22) {
|
|
17340
|
+
this.resourceEventsCache.invalidate(resourceId22);
|
|
17275
17341
|
}
|
|
17276
|
-
updateAnnotationInPlace(
|
|
17277
|
-
const currentList = this.annotationListCache.get(
|
|
17342
|
+
updateAnnotationInPlace(resourceId22, annotation) {
|
|
17343
|
+
const currentList = this.annotationListCache.get(resourceId22);
|
|
17278
17344
|
if (currentList) {
|
|
17279
17345
|
const idx = currentList.annotations.findIndex((a) => a.id === annotation.id);
|
|
17280
17346
|
const nextAnnotations = idx >= 0 ? currentList.annotations.map((a, i) => i === idx ? annotation : a) : [...currentList.annotations, annotation];
|
|
17281
|
-
this.annotationListCache.set(
|
|
17347
|
+
this.annotationListCache.set(resourceId22, { ...currentList, annotations: nextAnnotations });
|
|
17282
17348
|
}
|
|
17283
17349
|
const aId = annotationId(annotation.id);
|
|
17284
|
-
this.annotationResources.set(aId,
|
|
17350
|
+
this.annotationResources.set(aId, resourceId22);
|
|
17285
17351
|
this.annotationDetailCache.set(aId, annotation);
|
|
17286
17352
|
}
|
|
17287
17353
|
// ── EventBus subscriptions ──────────────────────────────────────────────
|
|
@@ -17377,7 +17443,7 @@ var init_dist = __esm({
|
|
|
17377
17443
|
this.on("yield:update-ok", this.onYieldResourceMutated);
|
|
17378
17444
|
this.on("mark:archived", this.onArchiveToggled);
|
|
17379
17445
|
this.on("mark:unarchived", this.onArchiveToggled);
|
|
17380
|
-
this.on("
|
|
17446
|
+
this.on("frame:entity-type-added", () => this.invalidateEntityTypes());
|
|
17381
17447
|
}
|
|
17382
17448
|
};
|
|
17383
17449
|
MarkNamespace = class {
|
|
@@ -17385,34 +17451,28 @@ var init_dist = __esm({
|
|
|
17385
17451
|
this.transport = transport;
|
|
17386
17452
|
this.bus = bus;
|
|
17387
17453
|
}
|
|
17388
|
-
async annotation(
|
|
17389
|
-
|
|
17454
|
+
async annotation(input) {
|
|
17455
|
+
const resourceId22 = resourceId(input.target.source);
|
|
17456
|
+
const result = await busRequest(
|
|
17390
17457
|
this.transport,
|
|
17391
17458
|
"mark:create-request",
|
|
17392
|
-
{ resourceId:
|
|
17459
|
+
{ resourceId: resourceId22, request: input },
|
|
17393
17460
|
"mark:create-ok",
|
|
17394
17461
|
"mark:create-failed"
|
|
17395
17462
|
);
|
|
17463
|
+
return { annotationId: annotationId(result.annotationId) };
|
|
17396
17464
|
}
|
|
17397
|
-
async delete(
|
|
17398
|
-
await this.transport.emit("mark:delete", { annotationId:
|
|
17399
|
-
}
|
|
17400
|
-
async entityType(type2) {
|
|
17401
|
-
await this.transport.emit("mark:add-entity-type", { tag: type2 });
|
|
17402
|
-
}
|
|
17403
|
-
async entityTypes(types) {
|
|
17404
|
-
for (const tag of types) {
|
|
17405
|
-
await this.transport.emit("mark:add-entity-type", { tag });
|
|
17406
|
-
}
|
|
17465
|
+
async delete(resourceId22, annotationId22) {
|
|
17466
|
+
await this.transport.emit("mark:delete", { annotationId: annotationId22, resourceId: resourceId22 });
|
|
17407
17467
|
}
|
|
17408
|
-
async archive(
|
|
17409
|
-
await this.transport.emit("mark:archive", { resourceId:
|
|
17468
|
+
async archive(resourceId22) {
|
|
17469
|
+
await this.transport.emit("mark:archive", { resourceId: resourceId22 });
|
|
17410
17470
|
}
|
|
17411
|
-
async unarchive(
|
|
17412
|
-
await this.transport.emit("mark:unarchive", { resourceId:
|
|
17471
|
+
async unarchive(resourceId22) {
|
|
17472
|
+
await this.transport.emit("mark:unarchive", { resourceId: resourceId22 });
|
|
17413
17473
|
}
|
|
17414
|
-
assist(
|
|
17415
|
-
return new
|
|
17474
|
+
assist(resourceId22, motivation, options) {
|
|
17475
|
+
return new StreamObservable((subscriber) => {
|
|
17416
17476
|
let done = false;
|
|
17417
17477
|
let pollTimer = null;
|
|
17418
17478
|
let pollInterval = null;
|
|
@@ -17452,7 +17512,7 @@ var init_dist = __esm({
|
|
|
17452
17512
|
data: {
|
|
17453
17513
|
jobId,
|
|
17454
17514
|
jobType: status.jobType ?? "annotation",
|
|
17455
|
-
resourceId:
|
|
17515
|
+
resourceId: resourceId22,
|
|
17456
17516
|
result: status.result
|
|
17457
17517
|
}
|
|
17458
17518
|
});
|
|
@@ -17489,7 +17549,7 @@ var init_dist = __esm({
|
|
|
17489
17549
|
cleanup();
|
|
17490
17550
|
subscriber.error(new Error(e.error));
|
|
17491
17551
|
});
|
|
17492
|
-
this.dispatchAssist(
|
|
17552
|
+
this.dispatchAssist(resourceId22, motivation, options).then(({ jobId }) => {
|
|
17493
17553
|
if (jobId && !done) {
|
|
17494
17554
|
activeJobId = jobId;
|
|
17495
17555
|
resetPollTimer(jobId);
|
|
@@ -17537,7 +17597,7 @@ var init_dist = __esm({
|
|
|
17537
17597
|
toggleMode() {
|
|
17538
17598
|
this.bus.get("mark:mode-toggled").next(void 0);
|
|
17539
17599
|
}
|
|
17540
|
-
async dispatchAssist(
|
|
17600
|
+
async dispatchAssist(resourceId22, motivation, options) {
|
|
17541
17601
|
const jobTypeMap = {
|
|
17542
17602
|
tagging: "tag-annotation",
|
|
17543
17603
|
linking: "reference-annotation",
|
|
@@ -17559,12 +17619,13 @@ var init_dist = __esm({
|
|
|
17559
17619
|
if (options.density !== void 0) params.density = options.density;
|
|
17560
17620
|
if (options.tone !== void 0) params.tone = options.tone;
|
|
17561
17621
|
if (options.language !== void 0) params.language = options.language;
|
|
17622
|
+
if (options.sourceLanguage !== void 0) params.sourceLanguage = options.sourceLanguage;
|
|
17562
17623
|
if (options.schemaId !== void 0) params.schemaId = options.schemaId;
|
|
17563
17624
|
if (options.categories !== void 0) params.categories = options.categories;
|
|
17564
17625
|
return busRequest(
|
|
17565
17626
|
this.transport,
|
|
17566
17627
|
"job:create",
|
|
17567
|
-
{ jobType, resourceId:
|
|
17628
|
+
{ jobType, resourceId: resourceId22, params },
|
|
17568
17629
|
"job:created",
|
|
17569
17630
|
"job:create-failed"
|
|
17570
17631
|
);
|
|
@@ -17575,11 +17636,11 @@ var init_dist = __esm({
|
|
|
17575
17636
|
this.transport = transport;
|
|
17576
17637
|
this.bus = bus;
|
|
17577
17638
|
}
|
|
17578
|
-
async body(
|
|
17639
|
+
async body(resourceId22, annotationId22, operations) {
|
|
17579
17640
|
await this.transport.emit("bind:update-body", {
|
|
17580
17641
|
correlationId: crypto.randomUUID(),
|
|
17581
|
-
annotationId:
|
|
17582
|
-
resourceId:
|
|
17642
|
+
annotationId: annotationId22,
|
|
17643
|
+
resourceId: resourceId22,
|
|
17583
17644
|
operations
|
|
17584
17645
|
});
|
|
17585
17646
|
}
|
|
@@ -17592,8 +17653,8 @@ var init_dist = __esm({
|
|
|
17592
17653
|
this.transport = transport;
|
|
17593
17654
|
this.bus = bus;
|
|
17594
17655
|
}
|
|
17595
|
-
annotation(
|
|
17596
|
-
return new
|
|
17656
|
+
annotation(resourceId22, annotationId22, options) {
|
|
17657
|
+
return new StreamObservable((subscriber) => {
|
|
17597
17658
|
const correlationId = crypto.randomUUID();
|
|
17598
17659
|
const complete$ = this.bus.get("gather:complete").pipe(
|
|
17599
17660
|
(0, import_operators.filter)((e) => e.correlationId === correlationId)
|
|
@@ -17603,7 +17664,7 @@ var init_dist = __esm({
|
|
|
17603
17664
|
);
|
|
17604
17665
|
const sub = (0, import_rxjs.merge)(
|
|
17605
17666
|
this.bus.get("gather:annotation-progress").pipe(
|
|
17606
|
-
(0, import_operators.filter)((e) => e.annotationId ===
|
|
17667
|
+
(0, import_operators.filter)((e) => e.annotationId === annotationId22),
|
|
17607
17668
|
(0, import_operators.map)((e) => e)
|
|
17608
17669
|
),
|
|
17609
17670
|
complete$.pipe((0, import_operators.map)((e) => e))
|
|
@@ -17620,8 +17681,8 @@ var init_dist = __esm({
|
|
|
17620
17681
|
});
|
|
17621
17682
|
this.transport.emit("gather:requested", {
|
|
17622
17683
|
correlationId,
|
|
17623
|
-
annotationId:
|
|
17624
|
-
resourceId:
|
|
17684
|
+
annotationId: annotationId22,
|
|
17685
|
+
resourceId: resourceId22,
|
|
17625
17686
|
options: { contextWindow: options?.contextWindow ?? 2e3 }
|
|
17626
17687
|
}).catch((error) => {
|
|
17627
17688
|
subscriber.error(error);
|
|
@@ -17645,8 +17706,8 @@ var init_dist = __esm({
|
|
|
17645
17706
|
requestSearch(input) {
|
|
17646
17707
|
this.bus.get("match:search-requested").next(input);
|
|
17647
17708
|
}
|
|
17648
|
-
search(
|
|
17649
|
-
return new
|
|
17709
|
+
search(resourceId22, referenceId, context, options) {
|
|
17710
|
+
return new StreamObservable((subscriber) => {
|
|
17650
17711
|
const correlationId = crypto.randomUUID();
|
|
17651
17712
|
const result$ = this.bus.get("match:search-results").pipe(
|
|
17652
17713
|
(0, import_operators.filter)((e) => e.correlationId === correlationId)
|
|
@@ -17663,7 +17724,7 @@ var init_dist = __esm({
|
|
|
17663
17724
|
});
|
|
17664
17725
|
this.transport.emit("match:search-requested", {
|
|
17665
17726
|
correlationId,
|
|
17666
|
-
resourceId:
|
|
17727
|
+
resourceId: resourceId22,
|
|
17667
17728
|
referenceId,
|
|
17668
17729
|
context,
|
|
17669
17730
|
limit: options?.limit ?? 10,
|
|
@@ -17684,25 +17745,56 @@ var init_dist = __esm({
|
|
|
17684
17745
|
this.bus = bus;
|
|
17685
17746
|
this.content = content;
|
|
17686
17747
|
}
|
|
17687
|
-
|
|
17688
|
-
const
|
|
17689
|
-
|
|
17690
|
-
|
|
17691
|
-
|
|
17692
|
-
|
|
17693
|
-
|
|
17694
|
-
|
|
17695
|
-
|
|
17696
|
-
|
|
17697
|
-
|
|
17698
|
-
|
|
17699
|
-
|
|
17700
|
-
|
|
17748
|
+
resource(data) {
|
|
17749
|
+
const totalBytes = typeof Buffer !== "undefined" && data.file instanceof Buffer ? data.file.length : data.file.size;
|
|
17750
|
+
return new UploadObservable((subscriber) => {
|
|
17751
|
+
subscriber.next({ phase: "started", totalBytes });
|
|
17752
|
+
let cancelled = false;
|
|
17753
|
+
const abortController = new AbortController();
|
|
17754
|
+
this.content.putBinary(
|
|
17755
|
+
{
|
|
17756
|
+
name: data.name,
|
|
17757
|
+
file: data.file,
|
|
17758
|
+
format: data.format,
|
|
17759
|
+
storageUri: data.storageUri,
|
|
17760
|
+
...data.entityTypes ? { entityTypes: data.entityTypes } : {},
|
|
17761
|
+
...data.language ? { language: data.language } : {},
|
|
17762
|
+
...data.creationMethod ? { creationMethod: data.creationMethod } : {},
|
|
17763
|
+
...data.sourceAnnotationId ? { sourceAnnotationId: data.sourceAnnotationId } : {},
|
|
17764
|
+
...data.sourceResourceId ? { sourceResourceId: data.sourceResourceId } : {},
|
|
17765
|
+
...data.generationPrompt ? { generationPrompt: data.generationPrompt } : {},
|
|
17766
|
+
...data.generator ? { generator: data.generator } : {},
|
|
17767
|
+
...data.isDraft !== void 0 ? { isDraft: data.isDraft } : {}
|
|
17768
|
+
},
|
|
17769
|
+
{
|
|
17770
|
+
// Byte-progress hook. Honored by `HttpContentTransport`'s XHR
|
|
17771
|
+
// path; ignored by ky-path uploads (no `onProgress` consumer)
|
|
17772
|
+
// and by `LocalContentTransport` (no wire to observe).
|
|
17773
|
+
onProgress: ({ bytesUploaded, totalBytes: txTotal }) => {
|
|
17774
|
+
if (cancelled) return;
|
|
17775
|
+
const total = txTotal > 0 ? txTotal : totalBytes;
|
|
17776
|
+
subscriber.next({ phase: "progress", bytesUploaded, totalBytes: total });
|
|
17777
|
+
},
|
|
17778
|
+
signal: abortController.signal
|
|
17779
|
+
}
|
|
17780
|
+
).then((result) => {
|
|
17781
|
+
if (cancelled) return;
|
|
17782
|
+
subscriber.next({
|
|
17783
|
+
phase: "finished",
|
|
17784
|
+
resourceId: resourceId(result.resourceId)
|
|
17785
|
+
});
|
|
17786
|
+
subscriber.complete();
|
|
17787
|
+
}).catch((err) => {
|
|
17788
|
+
if (!cancelled) subscriber.error(err);
|
|
17789
|
+
});
|
|
17790
|
+
return () => {
|
|
17791
|
+
cancelled = true;
|
|
17792
|
+
abortController.abort();
|
|
17793
|
+
};
|
|
17701
17794
|
});
|
|
17702
|
-
return { resourceId: result.resourceId };
|
|
17703
17795
|
}
|
|
17704
|
-
fromAnnotation(
|
|
17705
|
-
return new
|
|
17796
|
+
fromAnnotation(resourceId22, annotationId22, options) {
|
|
17797
|
+
return new StreamObservable((subscriber) => {
|
|
17706
17798
|
let done = false;
|
|
17707
17799
|
let pollTimer = null;
|
|
17708
17800
|
let pollInterval = null;
|
|
@@ -17742,7 +17834,7 @@ var init_dist = __esm({
|
|
|
17742
17834
|
data: {
|
|
17743
17835
|
jobId: jid,
|
|
17744
17836
|
jobType: status.jobType ?? "generation",
|
|
17745
|
-
resourceId:
|
|
17837
|
+
resourceId: resourceId22,
|
|
17746
17838
|
result: status.result
|
|
17747
17839
|
}
|
|
17748
17840
|
});
|
|
@@ -17784,12 +17876,13 @@ var init_dist = __esm({
|
|
|
17784
17876
|
"job:create",
|
|
17785
17877
|
{
|
|
17786
17878
|
jobType: "generation",
|
|
17787
|
-
resourceId:
|
|
17879
|
+
resourceId: resourceId22,
|
|
17788
17880
|
params: {
|
|
17789
|
-
referenceId:
|
|
17881
|
+
referenceId: annotationId22,
|
|
17790
17882
|
title: options.title,
|
|
17791
17883
|
prompt: options.prompt,
|
|
17792
17884
|
language: options.language,
|
|
17885
|
+
sourceLanguage: options.sourceLanguage,
|
|
17793
17886
|
temperature: options.temperature,
|
|
17794
17887
|
maxTokens: options.maxTokens,
|
|
17795
17888
|
storageUri: options.storageUri,
|
|
@@ -17815,11 +17908,11 @@ var init_dist = __esm({
|
|
|
17815
17908
|
};
|
|
17816
17909
|
});
|
|
17817
17910
|
}
|
|
17818
|
-
async cloneToken(
|
|
17911
|
+
async cloneToken(resourceId22) {
|
|
17819
17912
|
return busRequest(
|
|
17820
17913
|
this.transport,
|
|
17821
17914
|
"yield:clone-token-requested",
|
|
17822
|
-
{ resourceId:
|
|
17915
|
+
{ resourceId: resourceId22 },
|
|
17823
17916
|
"yield:clone-token-generated",
|
|
17824
17917
|
"yield:clone-token-failed"
|
|
17825
17918
|
);
|
|
@@ -17835,13 +17928,14 @@ var init_dist = __esm({
|
|
|
17835
17928
|
return result.sourceResource;
|
|
17836
17929
|
}
|
|
17837
17930
|
async createFromToken(options) {
|
|
17838
|
-
|
|
17931
|
+
const result = await busRequest(
|
|
17839
17932
|
this.transport,
|
|
17840
17933
|
"yield:clone-create",
|
|
17841
17934
|
options,
|
|
17842
17935
|
"yield:clone-created",
|
|
17843
17936
|
"yield:clone-create-failed"
|
|
17844
17937
|
);
|
|
17938
|
+
return { resourceId: resourceId(result.resourceId) };
|
|
17845
17939
|
}
|
|
17846
17940
|
clone() {
|
|
17847
17941
|
this.bus.get("yield:clone").next(void 0);
|
|
@@ -17852,14 +17946,27 @@ var init_dist = __esm({
|
|
|
17852
17946
|
this.transport = transport;
|
|
17853
17947
|
this.bus = bus;
|
|
17854
17948
|
}
|
|
17855
|
-
attention(
|
|
17856
|
-
void this.transport.emit("beckon:focus", { annotationId:
|
|
17949
|
+
attention(resourceId22, annotationId22) {
|
|
17950
|
+
void this.transport.emit("beckon:focus", { annotationId: annotationId22, resourceId: resourceId22 });
|
|
17857
17951
|
}
|
|
17858
|
-
hover(
|
|
17859
|
-
this.bus.get("beckon:hover").next({ annotationId:
|
|
17952
|
+
hover(annotationId22) {
|
|
17953
|
+
this.bus.get("beckon:hover").next({ annotationId: annotationId22 });
|
|
17860
17954
|
}
|
|
17861
|
-
sparkle(
|
|
17862
|
-
this.bus.get("beckon:sparkle").next({ annotationId:
|
|
17955
|
+
sparkle(annotationId22) {
|
|
17956
|
+
this.bus.get("beckon:sparkle").next({ annotationId: annotationId22 });
|
|
17957
|
+
}
|
|
17958
|
+
};
|
|
17959
|
+
FrameNamespace = class {
|
|
17960
|
+
constructor(transport) {
|
|
17961
|
+
this.transport = transport;
|
|
17962
|
+
}
|
|
17963
|
+
async addEntityType(type2) {
|
|
17964
|
+
await this.transport.emit("frame:add-entity-type", { tag: type2 });
|
|
17965
|
+
}
|
|
17966
|
+
async addEntityTypes(types) {
|
|
17967
|
+
for (const tag of types) {
|
|
17968
|
+
await this.transport.emit("frame:add-entity-type", { tag });
|
|
17969
|
+
}
|
|
17863
17970
|
}
|
|
17864
17971
|
};
|
|
17865
17972
|
JobNamespace = class {
|
|
@@ -17898,7 +18005,7 @@ var init_dist = __esm({
|
|
|
17898
18005
|
}
|
|
17899
18006
|
async pollUntilComplete(jobId, options) {
|
|
17900
18007
|
const interval = options?.interval ?? 1e3;
|
|
17901
|
-
const
|
|
18008
|
+
const timeout6 = options?.timeout ?? 6e4;
|
|
17902
18009
|
const startTime = Date.now();
|
|
17903
18010
|
while (true) {
|
|
17904
18011
|
const status = await this.status(jobId);
|
|
@@ -17906,88 +18013,86 @@ var init_dist = __esm({
|
|
|
17906
18013
|
if (status.status === "complete" || status.status === "failed" || status.status === "cancelled") {
|
|
17907
18014
|
return status;
|
|
17908
18015
|
}
|
|
17909
|
-
if (Date.now() - startTime >
|
|
17910
|
-
throw new Error(`Job polling timeout after ${
|
|
18016
|
+
if (Date.now() - startTime > timeout6) {
|
|
18017
|
+
throw new Error(`Job polling timeout after ${timeout6}ms`);
|
|
17911
18018
|
}
|
|
17912
18019
|
await new Promise((resolve9) => setTimeout(resolve9, interval));
|
|
17913
18020
|
}
|
|
17914
18021
|
}
|
|
17915
|
-
async
|
|
17916
|
-
await this.transport.emit("job:cancel-requested", {
|
|
17917
|
-
jobType: type2 === "generation" ? "generation" : "annotation"
|
|
17918
|
-
});
|
|
18022
|
+
async cancelByType(jobType) {
|
|
18023
|
+
await this.transport.emit("job:cancel-requested", { jobType });
|
|
17919
18024
|
}
|
|
17920
18025
|
cancelRequest(jobType) {
|
|
17921
18026
|
this.bus.get("job:cancel-requested").next({ jobType });
|
|
17922
18027
|
}
|
|
17923
18028
|
};
|
|
17924
18029
|
AuthNamespace = class {
|
|
17925
|
-
constructor(
|
|
17926
|
-
this.
|
|
18030
|
+
constructor(backend) {
|
|
18031
|
+
this.backend = backend;
|
|
17927
18032
|
}
|
|
17928
18033
|
async password(emailStr, passwordStr) {
|
|
17929
|
-
return this.
|
|
18034
|
+
return this.backend.authenticatePassword(email(emailStr), passwordStr);
|
|
17930
18035
|
}
|
|
17931
18036
|
async google(credential) {
|
|
17932
|
-
return this.
|
|
18037
|
+
return this.backend.authenticateGoogle(googleCredential(credential));
|
|
17933
18038
|
}
|
|
17934
18039
|
async refresh(token) {
|
|
17935
|
-
return this.
|
|
18040
|
+
return this.backend.refreshAccessToken(refreshToken(token));
|
|
17936
18041
|
}
|
|
17937
18042
|
async logout() {
|
|
17938
|
-
await this.
|
|
18043
|
+
await this.backend.logout();
|
|
17939
18044
|
}
|
|
17940
18045
|
async me() {
|
|
17941
|
-
return this.
|
|
18046
|
+
return this.backend.getCurrentUser();
|
|
17942
18047
|
}
|
|
17943
18048
|
async acceptTerms() {
|
|
17944
|
-
await this.
|
|
18049
|
+
await this.backend.acceptTerms();
|
|
17945
18050
|
}
|
|
17946
18051
|
async mcpToken() {
|
|
17947
|
-
return this.
|
|
18052
|
+
return this.backend.generateMcpToken();
|
|
17948
18053
|
}
|
|
17949
|
-
async mediaToken(
|
|
17950
|
-
return this.
|
|
18054
|
+
async mediaToken(resourceId22) {
|
|
18055
|
+
return this.backend.getMediaToken(resourceId22);
|
|
17951
18056
|
}
|
|
17952
18057
|
};
|
|
17953
18058
|
AdminNamespace = class {
|
|
17954
|
-
constructor(
|
|
17955
|
-
this.
|
|
18059
|
+
constructor(backend) {
|
|
18060
|
+
this.backend = backend;
|
|
17956
18061
|
}
|
|
17957
18062
|
async users() {
|
|
17958
|
-
const result = await this.
|
|
18063
|
+
const result = await this.backend.listUsers();
|
|
17959
18064
|
return result.users;
|
|
17960
18065
|
}
|
|
17961
18066
|
async userStats() {
|
|
17962
|
-
return this.
|
|
18067
|
+
return this.backend.getUserStats();
|
|
17963
18068
|
}
|
|
17964
|
-
async updateUser(
|
|
17965
|
-
const result = await this.
|
|
18069
|
+
async updateUser(userId2, data) {
|
|
18070
|
+
const result = await this.backend.updateUser(userId2, data);
|
|
17966
18071
|
return result.user;
|
|
17967
18072
|
}
|
|
17968
18073
|
async oauthConfig() {
|
|
17969
|
-
return this.
|
|
18074
|
+
return this.backend.getOAuthConfig();
|
|
17970
18075
|
}
|
|
17971
18076
|
async healthCheck() {
|
|
17972
|
-
return this.
|
|
18077
|
+
return this.backend.healthCheck();
|
|
17973
18078
|
}
|
|
17974
18079
|
async status() {
|
|
17975
|
-
return this.
|
|
18080
|
+
return this.backend.getStatus();
|
|
17976
18081
|
}
|
|
17977
18082
|
async backup() {
|
|
17978
|
-
return this.
|
|
18083
|
+
return this.backend.backupKnowledgeBase();
|
|
17979
18084
|
}
|
|
17980
|
-
|
|
17981
|
-
return this.
|
|
18085
|
+
restore(file) {
|
|
18086
|
+
return wrapAsStream(this.backend.restoreKnowledgeBase(file));
|
|
17982
18087
|
}
|
|
17983
18088
|
async exportKnowledgeBase(params) {
|
|
17984
|
-
return this.
|
|
18089
|
+
return this.backend.exportKnowledgeBase(params);
|
|
17985
18090
|
}
|
|
17986
|
-
|
|
17987
|
-
return this.
|
|
18091
|
+
importKnowledgeBase(file) {
|
|
18092
|
+
return wrapAsStream(this.backend.importKnowledgeBase(file));
|
|
17988
18093
|
}
|
|
17989
18094
|
};
|
|
17990
|
-
SemiontClient = class {
|
|
18095
|
+
SemiontClient = class _SemiontClient {
|
|
17991
18096
|
/**
|
|
17992
18097
|
* The wire-facing transport. Owns bus actor, HTTP, auth, admin, exchange,
|
|
17993
18098
|
* system. Exposed for advanced consumers (workers, custom job adapters)
|
|
@@ -18006,6 +18111,15 @@ var init_dist = __esm({
|
|
|
18006
18111
|
bus;
|
|
18007
18112
|
baseUrl;
|
|
18008
18113
|
// ── Verb-oriented namespace API ──────────────────────────────────────────
|
|
18114
|
+
//
|
|
18115
|
+
// The first nine namespaces are bus-driven and always present. `frame`
|
|
18116
|
+
// is the schema-layer flow's surface (eighth flow); the other eight are
|
|
18117
|
+
// content-layer flows plus `job`. `auth` and `admin` are backend-ops
|
|
18118
|
+
// namespaces — they're only constructed when the caller passes an
|
|
18119
|
+
// `IBackendOperations` instance to the constructor. A `SemiontClient`
|
|
18120
|
+
// over a transport-only setup (e.g. `LocalTransport`) has
|
|
18121
|
+
// `auth === undefined` / `admin === undefined`.
|
|
18122
|
+
frame;
|
|
18009
18123
|
browse;
|
|
18010
18124
|
mark;
|
|
18011
18125
|
bind;
|
|
@@ -18028,13 +18142,20 @@ var init_dist = __esm({
|
|
|
18028
18142
|
* Callers do not pass a bus in. If they need to interact with the bus
|
|
18029
18143
|
* (e.g. for tests or to subscribe to arbitrary channels), they read it
|
|
18030
18144
|
* back via `client.bus`.
|
|
18145
|
+
*
|
|
18146
|
+
* `backend` is optional. When provided, the `auth` and `admin`
|
|
18147
|
+
* namespaces are constructed against it; when omitted, they're
|
|
18148
|
+
* `undefined`. For HTTP setups this is conventionally the same
|
|
18149
|
+
* `HttpTransport` instance that's also passed as `transport` (HTTP
|
|
18150
|
+
* implements both `ITransport` and `IBackendOperations`).
|
|
18031
18151
|
*/
|
|
18032
|
-
constructor(transport, content) {
|
|
18152
|
+
constructor(transport, content, backend) {
|
|
18033
18153
|
this.transport = transport;
|
|
18034
18154
|
this.content = content;
|
|
18035
18155
|
this.baseUrl = transport.baseUrl;
|
|
18036
18156
|
this.bus = new EventBus();
|
|
18037
18157
|
this.transport.bridgeInto(this.bus);
|
|
18158
|
+
this.frame = new FrameNamespace(this.transport);
|
|
18038
18159
|
this.browse = new BrowseNamespace(this.transport, this.bus, this.content);
|
|
18039
18160
|
this.mark = new MarkNamespace(this.transport, this.bus);
|
|
18040
18161
|
this.bind = new BindNamespace(this.transport, this.bus);
|
|
@@ -18043,20 +18164,88 @@ var init_dist = __esm({
|
|
|
18043
18164
|
this.yield = new YieldNamespace(this.transport, this.bus, this.content);
|
|
18044
18165
|
this.beckon = new BeckonNamespace(this.transport, this.bus);
|
|
18045
18166
|
this.job = new JobNamespace(this.transport, this.bus);
|
|
18046
|
-
this.auth = new AuthNamespace(
|
|
18047
|
-
this.admin = new AdminNamespace(
|
|
18167
|
+
this.auth = backend ? new AuthNamespace(backend) : void 0;
|
|
18168
|
+
this.admin = backend ? new AdminNamespace(backend) : void 0;
|
|
18048
18169
|
}
|
|
18049
18170
|
/** Transport-level connection state. HTTP reflects SSE health; local is always 'connected'. */
|
|
18050
18171
|
get state$() {
|
|
18051
18172
|
return this.transport.state$;
|
|
18052
18173
|
}
|
|
18053
|
-
subscribeToResource(
|
|
18054
|
-
return this.transport.subscribeToResource(
|
|
18174
|
+
subscribeToResource(resourceId22) {
|
|
18175
|
+
return this.transport.subscribeToResource(resourceId22);
|
|
18055
18176
|
}
|
|
18056
18177
|
dispose() {
|
|
18057
18178
|
this.transport.dispose();
|
|
18058
18179
|
this.content.dispose();
|
|
18059
18180
|
}
|
|
18181
|
+
/**
|
|
18182
|
+
* Convenience factory for the default HTTP setup. Constructs a
|
|
18183
|
+
* `BehaviorSubject<AccessToken | null>` internally, plus an
|
|
18184
|
+
* `HttpTransport` and `HttpContentTransport`, and returns the wired
|
|
18185
|
+
* `SemiontClient`.
|
|
18186
|
+
*
|
|
18187
|
+
* Use this for one-shot scripts, CLI commands, or any consumer that
|
|
18188
|
+
* doesn't need to drive the token from outside (no manual refresh,
|
|
18189
|
+
* no cross-tab sync). For long-running scripts that need refresh,
|
|
18190
|
+
* use `SemiontSession.fromHttp(...)` (with a token already on hand)
|
|
18191
|
+
* or `SemiontSession.signInHttp(...)` (credentials-first) instead —
|
|
18192
|
+
* either owns the same transport/client wiring plus the
|
|
18193
|
+
* proactive-refresh + storage machinery.
|
|
18194
|
+
*
|
|
18195
|
+
* Strings are accepted for `baseUrl` and `token`; they are branded
|
|
18196
|
+
* via `baseUrl()` / `accessToken()` from `@semiont/core` automatically.
|
|
18197
|
+
* Pass the already-branded values if you have them.
|
|
18198
|
+
*
|
|
18199
|
+
* Omit `token` for unauthenticated usage (public endpoints only).
|
|
18200
|
+
*/
|
|
18201
|
+
static fromHttp(opts) {
|
|
18202
|
+
const url = typeof opts.baseUrl === "string" ? baseUrl(opts.baseUrl) : opts.baseUrl;
|
|
18203
|
+
const tok = opts.token == null ? null : typeof opts.token === "string" ? accessToken(opts.token) : opts.token;
|
|
18204
|
+
const token$ = new import_rxjs.BehaviorSubject(tok);
|
|
18205
|
+
const transport = new HttpTransport({ baseUrl: url, token$ });
|
|
18206
|
+
const content = new HttpContentTransport(transport);
|
|
18207
|
+
return new _SemiontClient(transport, content, transport);
|
|
18208
|
+
}
|
|
18209
|
+
/**
|
|
18210
|
+
* Async factory for the credentials-first script case. Builds a
|
|
18211
|
+
* transient HTTP transport, calls `auth.password(email, password)`
|
|
18212
|
+
* to acquire an access token, and returns the wired client with
|
|
18213
|
+
* the token populated.
|
|
18214
|
+
*
|
|
18215
|
+
* This is the right entry point for skills, CLI scripts, and any
|
|
18216
|
+
* consumer that starts with email + password rather than a JWT
|
|
18217
|
+
* already on hand. For consumers that already hold a token (CLI
|
|
18218
|
+
* cached-token path, env-var token, embedded auth flow), use
|
|
18219
|
+
* `fromHttp({ baseUrl, token })` instead.
|
|
18220
|
+
*
|
|
18221
|
+
* For long-running scripts that need refresh, use
|
|
18222
|
+
* `SemiontSession.signInHttp(...)` — same credentials shape, plus
|
|
18223
|
+
* the session machinery for proactive refresh and persistence.
|
|
18224
|
+
*
|
|
18225
|
+
* Named `signInHttp` because email+password authentication is
|
|
18226
|
+
* inherently an HTTP-shaped operation in the current backend; an
|
|
18227
|
+
* in-process `LocalTransport` doesn't have a credentials login
|
|
18228
|
+
* path. Non-HTTP transports construct the client directly from
|
|
18229
|
+
* their package's transport instance.
|
|
18230
|
+
*
|
|
18231
|
+
* Throws if authentication fails. The transient client is disposed
|
|
18232
|
+
* before the throw, so no resources leak on failure.
|
|
18233
|
+
*/
|
|
18234
|
+
static async signInHttp(opts) {
|
|
18235
|
+
const url = typeof opts.baseUrl === "string" ? baseUrl(opts.baseUrl) : opts.baseUrl;
|
|
18236
|
+
const token$ = new import_rxjs.BehaviorSubject(null);
|
|
18237
|
+
const transport = new HttpTransport({ baseUrl: url, token$ });
|
|
18238
|
+
const content = new HttpContentTransport(transport);
|
|
18239
|
+
const client = new _SemiontClient(transport, content, transport);
|
|
18240
|
+
try {
|
|
18241
|
+
const auth = await client.auth.password(opts.email, opts.password);
|
|
18242
|
+
token$.next(accessToken(auth.token));
|
|
18243
|
+
return client;
|
|
18244
|
+
} catch (err) {
|
|
18245
|
+
client.dispose();
|
|
18246
|
+
throw err;
|
|
18247
|
+
}
|
|
18248
|
+
}
|
|
18060
18249
|
};
|
|
18061
18250
|
REFRESH_BEFORE_EXP_MS = 5 * 60 * 1e3;
|
|
18062
18251
|
}
|
|
@@ -18067,7 +18256,7 @@ import * as fs11 from "fs";
|
|
|
18067
18256
|
import * as path11 from "path";
|
|
18068
18257
|
import { execFileSync as execFileSync8 } from "child_process";
|
|
18069
18258
|
import { SemiontProject as SemiontProject4 } from "@semiont/core/node";
|
|
18070
|
-
import { baseUrl as
|
|
18259
|
+
import { baseUrl as baseUrl3 } from "@semiont/core";
|
|
18071
18260
|
import { HttpContentTransport as HttpContentTransport3, HttpTransport as HttpTransport3 } from "@semiont/api-client";
|
|
18072
18261
|
var checkBackendService, preflightBackendCheck, backendCheckDescriptor;
|
|
18073
18262
|
var init_backend_check = __esm({
|
|
@@ -18149,8 +18338,8 @@ var init_backend_check = __esm({
|
|
|
18149
18338
|
}
|
|
18150
18339
|
if (status === "unhealthy" || status === "unknown") {
|
|
18151
18340
|
const localUrl = `http://localhost:${config.port}`;
|
|
18152
|
-
const transport = new HttpTransport3({ baseUrl:
|
|
18153
|
-
const client = new SemiontClient(transport, new HttpContentTransport3(transport));
|
|
18341
|
+
const transport = new HttpTransport3({ baseUrl: baseUrl3(localUrl) });
|
|
18342
|
+
const client = new SemiontClient(transport, new HttpContentTransport3(transport), transport);
|
|
18154
18343
|
try {
|
|
18155
18344
|
const healthData = await client.admin.healthCheck();
|
|
18156
18345
|
healthy = true;
|
|
@@ -21253,7 +21442,7 @@ var init_platform2 = __esm({
|
|
|
21253
21442
|
|
|
21254
21443
|
// src/platforms/container/handlers/web-check.ts
|
|
21255
21444
|
import { execFileSync as execFileSync16 } from "child_process";
|
|
21256
|
-
import { baseUrl as
|
|
21445
|
+
import { baseUrl as baseUrl4 } from "@semiont/core";
|
|
21257
21446
|
import { HttpContentTransport as HttpContentTransport4, HttpTransport as HttpTransport4 } from "@semiont/api-client";
|
|
21258
21447
|
var checkWebContainer, preflightWebCheck, webCheckDescriptor, webFrontendCheckDescriptor;
|
|
21259
21448
|
var init_web_check = __esm({
|
|
@@ -21310,8 +21499,8 @@ var init_web_check = __esm({
|
|
|
21310
21499
|
try {
|
|
21311
21500
|
if (isBackend) {
|
|
21312
21501
|
const backendConfig = config;
|
|
21313
|
-
const transport = new HttpTransport4({ baseUrl:
|
|
21314
|
-
const client = new SemiontClient(transport, new HttpContentTransport4(transport));
|
|
21502
|
+
const transport = new HttpTransport4({ baseUrl: baseUrl4(backendConfig.publicURL) });
|
|
21503
|
+
const client = new SemiontClient(transport, new HttpContentTransport4(transport), transport);
|
|
21315
21504
|
try {
|
|
21316
21505
|
const healthData = await client.admin.healthCheck();
|
|
21317
21506
|
health = {
|
|
@@ -23167,7 +23356,7 @@ function generateError(state, message) {
|
|
|
23167
23356
|
mark.snippet = snippet(mark);
|
|
23168
23357
|
return new exception(message, mark);
|
|
23169
23358
|
}
|
|
23170
|
-
function
|
|
23359
|
+
function throwError2(state, message) {
|
|
23171
23360
|
throw generateError(state, message);
|
|
23172
23361
|
}
|
|
23173
23362
|
function throwWarning(state, message) {
|
|
@@ -23183,11 +23372,11 @@ function captureSegment(state, start2, end, checkJson) {
|
|
|
23183
23372
|
for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
|
|
23184
23373
|
_character = _result.charCodeAt(_position);
|
|
23185
23374
|
if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
|
|
23186
|
-
|
|
23375
|
+
throwError2(state, "expected valid JSON character");
|
|
23187
23376
|
}
|
|
23188
23377
|
}
|
|
23189
23378
|
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
|
|
23190
|
-
|
|
23379
|
+
throwError2(state, "the stream contains non-printable characters");
|
|
23191
23380
|
}
|
|
23192
23381
|
state.result += _result;
|
|
23193
23382
|
}
|
|
@@ -23195,7 +23384,7 @@ function captureSegment(state, start2, end, checkJson) {
|
|
|
23195
23384
|
function mergeMappings(state, destination, source, overridableKeys) {
|
|
23196
23385
|
var sourceKeys, key, index, quantity;
|
|
23197
23386
|
if (!common.isObject(source)) {
|
|
23198
|
-
|
|
23387
|
+
throwError2(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
23199
23388
|
}
|
|
23200
23389
|
sourceKeys = Object.keys(source);
|
|
23201
23390
|
for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
|
|
@@ -23212,7 +23401,7 @@ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valu
|
|
|
23212
23401
|
keyNode = Array.prototype.slice.call(keyNode);
|
|
23213
23402
|
for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
|
|
23214
23403
|
if (Array.isArray(keyNode[index])) {
|
|
23215
|
-
|
|
23404
|
+
throwError2(state, "nested arrays are not supported inside keys");
|
|
23216
23405
|
}
|
|
23217
23406
|
if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
|
|
23218
23407
|
keyNode[index] = "[object Object]";
|
|
@@ -23239,7 +23428,7 @@ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valu
|
|
|
23239
23428
|
state.line = startLine || state.line;
|
|
23240
23429
|
state.lineStart = startLineStart || state.lineStart;
|
|
23241
23430
|
state.position = startPos || state.position;
|
|
23242
|
-
|
|
23431
|
+
throwError2(state, "duplicated mapping key");
|
|
23243
23432
|
}
|
|
23244
23433
|
setProperty(_result, keyNode, valueNode);
|
|
23245
23434
|
delete overridableKeys[keyNode];
|
|
@@ -23257,7 +23446,7 @@ function readLineBreak(state) {
|
|
|
23257
23446
|
state.position++;
|
|
23258
23447
|
}
|
|
23259
23448
|
} else {
|
|
23260
|
-
|
|
23449
|
+
throwError2(state, "a line break is expected");
|
|
23261
23450
|
}
|
|
23262
23451
|
state.line += 1;
|
|
23263
23452
|
state.lineStart = state.position;
|
|
@@ -23405,13 +23594,13 @@ function readSingleQuotedScalar(state, nodeIndent) {
|
|
|
23405
23594
|
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
23406
23595
|
captureStart = captureEnd = state.position;
|
|
23407
23596
|
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
23408
|
-
|
|
23597
|
+
throwError2(state, "unexpected end of the document within a single quoted scalar");
|
|
23409
23598
|
} else {
|
|
23410
23599
|
state.position++;
|
|
23411
23600
|
captureEnd = state.position;
|
|
23412
23601
|
}
|
|
23413
23602
|
}
|
|
23414
|
-
|
|
23603
|
+
throwError2(state, "unexpected end of the stream within a single quoted scalar");
|
|
23415
23604
|
}
|
|
23416
23605
|
function readDoubleQuotedScalar(state, nodeIndent) {
|
|
23417
23606
|
var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
|
|
@@ -23444,13 +23633,13 @@ function readDoubleQuotedScalar(state, nodeIndent) {
|
|
|
23444
23633
|
if ((tmp = fromHexCode(ch)) >= 0) {
|
|
23445
23634
|
hexResult = (hexResult << 4) + tmp;
|
|
23446
23635
|
} else {
|
|
23447
|
-
|
|
23636
|
+
throwError2(state, "expected hexadecimal character");
|
|
23448
23637
|
}
|
|
23449
23638
|
}
|
|
23450
23639
|
state.result += charFromCodepoint(hexResult);
|
|
23451
23640
|
state.position++;
|
|
23452
23641
|
} else {
|
|
23453
|
-
|
|
23642
|
+
throwError2(state, "unknown escape sequence");
|
|
23454
23643
|
}
|
|
23455
23644
|
captureStart = captureEnd = state.position;
|
|
23456
23645
|
} else if (is_EOL(ch)) {
|
|
@@ -23458,13 +23647,13 @@ function readDoubleQuotedScalar(state, nodeIndent) {
|
|
|
23458
23647
|
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
23459
23648
|
captureStart = captureEnd = state.position;
|
|
23460
23649
|
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
23461
|
-
|
|
23650
|
+
throwError2(state, "unexpected end of the document within a double quoted scalar");
|
|
23462
23651
|
} else {
|
|
23463
23652
|
state.position++;
|
|
23464
23653
|
captureEnd = state.position;
|
|
23465
23654
|
}
|
|
23466
23655
|
}
|
|
23467
|
-
|
|
23656
|
+
throwError2(state, "unexpected end of the stream within a double quoted scalar");
|
|
23468
23657
|
}
|
|
23469
23658
|
function readFlowCollection(state, nodeIndent) {
|
|
23470
23659
|
var readNext = true, _line, _lineStart, _pos, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = /* @__PURE__ */ Object.create(null), keyNode, keyTag, valueNode, ch;
|
|
@@ -23495,9 +23684,9 @@ function readFlowCollection(state, nodeIndent) {
|
|
|
23495
23684
|
state.result = _result;
|
|
23496
23685
|
return true;
|
|
23497
23686
|
} else if (!readNext) {
|
|
23498
|
-
|
|
23687
|
+
throwError2(state, "missed comma between flow collection entries");
|
|
23499
23688
|
} else if (ch === 44) {
|
|
23500
|
-
|
|
23689
|
+
throwError2(state, "expected the node content, but found ','");
|
|
23501
23690
|
}
|
|
23502
23691
|
keyTag = keyNode = valueNode = null;
|
|
23503
23692
|
isPair = isExplicitPair = false;
|
|
@@ -23540,7 +23729,7 @@ function readFlowCollection(state, nodeIndent) {
|
|
|
23540
23729
|
readNext = false;
|
|
23541
23730
|
}
|
|
23542
23731
|
}
|
|
23543
|
-
|
|
23732
|
+
throwError2(state, "unexpected end of the stream within a flow collection");
|
|
23544
23733
|
}
|
|
23545
23734
|
function readBlockScalar(state, nodeIndent) {
|
|
23546
23735
|
var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
|
|
@@ -23560,16 +23749,16 @@ function readBlockScalar(state, nodeIndent) {
|
|
|
23560
23749
|
if (CHOMPING_CLIP === chomping) {
|
|
23561
23750
|
chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
|
|
23562
23751
|
} else {
|
|
23563
|
-
|
|
23752
|
+
throwError2(state, "repeat of a chomping mode identifier");
|
|
23564
23753
|
}
|
|
23565
23754
|
} else if ((tmp = fromDecimalCode(ch)) >= 0) {
|
|
23566
23755
|
if (tmp === 0) {
|
|
23567
|
-
|
|
23756
|
+
throwError2(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
|
23568
23757
|
} else if (!detectedIndent) {
|
|
23569
23758
|
textIndent = nodeIndent + tmp - 1;
|
|
23570
23759
|
detectedIndent = true;
|
|
23571
23760
|
} else {
|
|
23572
|
-
|
|
23761
|
+
throwError2(state, "repeat of an indentation width identifier");
|
|
23573
23762
|
}
|
|
23574
23763
|
} else {
|
|
23575
23764
|
break;
|
|
@@ -23648,7 +23837,7 @@ function readBlockSequence(state, nodeIndent) {
|
|
|
23648
23837
|
while (ch !== 0) {
|
|
23649
23838
|
if (state.firstTabInLine !== -1) {
|
|
23650
23839
|
state.position = state.firstTabInLine;
|
|
23651
|
-
|
|
23840
|
+
throwError2(state, "tab characters must not be used in indentation");
|
|
23652
23841
|
}
|
|
23653
23842
|
if (ch !== 45) {
|
|
23654
23843
|
break;
|
|
@@ -23672,7 +23861,7 @@ function readBlockSequence(state, nodeIndent) {
|
|
|
23672
23861
|
skipSeparationSpace(state, true, -1);
|
|
23673
23862
|
ch = state.input.charCodeAt(state.position);
|
|
23674
23863
|
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
23675
|
-
|
|
23864
|
+
throwError2(state, "bad indentation of a sequence entry");
|
|
23676
23865
|
} else if (state.lineIndent < nodeIndent) {
|
|
23677
23866
|
break;
|
|
23678
23867
|
}
|
|
@@ -23696,7 +23885,7 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
|
23696
23885
|
while (ch !== 0) {
|
|
23697
23886
|
if (!atExplicitKey && state.firstTabInLine !== -1) {
|
|
23698
23887
|
state.position = state.firstTabInLine;
|
|
23699
|
-
|
|
23888
|
+
throwError2(state, "tab characters must not be used in indentation");
|
|
23700
23889
|
}
|
|
23701
23890
|
following = state.input.charCodeAt(state.position + 1);
|
|
23702
23891
|
_line = state.line;
|
|
@@ -23713,7 +23902,7 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
|
23713
23902
|
atExplicitKey = false;
|
|
23714
23903
|
allowCompact = true;
|
|
23715
23904
|
} else {
|
|
23716
|
-
|
|
23905
|
+
throwError2(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
|
|
23717
23906
|
}
|
|
23718
23907
|
state.position += 1;
|
|
23719
23908
|
ch = following;
|
|
@@ -23732,7 +23921,7 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
|
23732
23921
|
if (ch === 58) {
|
|
23733
23922
|
ch = state.input.charCodeAt(++state.position);
|
|
23734
23923
|
if (!is_WS_OR_EOL(ch)) {
|
|
23735
|
-
|
|
23924
|
+
throwError2(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
|
23736
23925
|
}
|
|
23737
23926
|
if (atExplicitKey) {
|
|
23738
23927
|
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
@@ -23744,14 +23933,14 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
|
23744
23933
|
keyTag = state.tag;
|
|
23745
23934
|
keyNode = state.result;
|
|
23746
23935
|
} else if (detected) {
|
|
23747
|
-
|
|
23936
|
+
throwError2(state, "can not read an implicit mapping pair; a colon is missed");
|
|
23748
23937
|
} else {
|
|
23749
23938
|
state.tag = _tag;
|
|
23750
23939
|
state.anchor = _anchor;
|
|
23751
23940
|
return true;
|
|
23752
23941
|
}
|
|
23753
23942
|
} else if (detected) {
|
|
23754
|
-
|
|
23943
|
+
throwError2(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
23755
23944
|
} else {
|
|
23756
23945
|
state.tag = _tag;
|
|
23757
23946
|
state.anchor = _anchor;
|
|
@@ -23779,7 +23968,7 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
|
23779
23968
|
ch = state.input.charCodeAt(state.position);
|
|
23780
23969
|
}
|
|
23781
23970
|
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
23782
|
-
|
|
23971
|
+
throwError2(state, "bad indentation of a mapping entry");
|
|
23783
23972
|
} else if (state.lineIndent < nodeIndent) {
|
|
23784
23973
|
break;
|
|
23785
23974
|
}
|
|
@@ -23800,7 +23989,7 @@ function readTagProperty(state) {
|
|
|
23800
23989
|
ch = state.input.charCodeAt(state.position);
|
|
23801
23990
|
if (ch !== 33) return false;
|
|
23802
23991
|
if (state.tag !== null) {
|
|
23803
|
-
|
|
23992
|
+
throwError2(state, "duplication of a tag property");
|
|
23804
23993
|
}
|
|
23805
23994
|
ch = state.input.charCodeAt(++state.position);
|
|
23806
23995
|
if (ch === 60) {
|
|
@@ -23822,7 +24011,7 @@ function readTagProperty(state) {
|
|
|
23822
24011
|
tagName = state.input.slice(_position, state.position);
|
|
23823
24012
|
ch = state.input.charCodeAt(++state.position);
|
|
23824
24013
|
} else {
|
|
23825
|
-
|
|
24014
|
+
throwError2(state, "unexpected end of the stream within a verbatim tag");
|
|
23826
24015
|
}
|
|
23827
24016
|
} else {
|
|
23828
24017
|
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
@@ -23830,28 +24019,28 @@ function readTagProperty(state) {
|
|
|
23830
24019
|
if (!isNamed) {
|
|
23831
24020
|
tagHandle = state.input.slice(_position - 1, state.position + 1);
|
|
23832
24021
|
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
|
|
23833
|
-
|
|
24022
|
+
throwError2(state, "named tag handle cannot contain such characters");
|
|
23834
24023
|
}
|
|
23835
24024
|
isNamed = true;
|
|
23836
24025
|
_position = state.position + 1;
|
|
23837
24026
|
} else {
|
|
23838
|
-
|
|
24027
|
+
throwError2(state, "tag suffix cannot contain exclamation marks");
|
|
23839
24028
|
}
|
|
23840
24029
|
}
|
|
23841
24030
|
ch = state.input.charCodeAt(++state.position);
|
|
23842
24031
|
}
|
|
23843
24032
|
tagName = state.input.slice(_position, state.position);
|
|
23844
24033
|
if (PATTERN_FLOW_INDICATORS.test(tagName)) {
|
|
23845
|
-
|
|
24034
|
+
throwError2(state, "tag suffix cannot contain flow indicator characters");
|
|
23846
24035
|
}
|
|
23847
24036
|
}
|
|
23848
24037
|
if (tagName && !PATTERN_TAG_URI.test(tagName)) {
|
|
23849
|
-
|
|
24038
|
+
throwError2(state, "tag name cannot contain such characters: " + tagName);
|
|
23850
24039
|
}
|
|
23851
24040
|
try {
|
|
23852
24041
|
tagName = decodeURIComponent(tagName);
|
|
23853
24042
|
} catch (err) {
|
|
23854
|
-
|
|
24043
|
+
throwError2(state, "tag name is malformed: " + tagName);
|
|
23855
24044
|
}
|
|
23856
24045
|
if (isVerbatim) {
|
|
23857
24046
|
state.tag = tagName;
|
|
@@ -23862,7 +24051,7 @@ function readTagProperty(state) {
|
|
|
23862
24051
|
} else if (tagHandle === "!!") {
|
|
23863
24052
|
state.tag = "tag:yaml.org,2002:" + tagName;
|
|
23864
24053
|
} else {
|
|
23865
|
-
|
|
24054
|
+
throwError2(state, 'undeclared tag handle "' + tagHandle + '"');
|
|
23866
24055
|
}
|
|
23867
24056
|
return true;
|
|
23868
24057
|
}
|
|
@@ -23871,7 +24060,7 @@ function readAnchorProperty(state) {
|
|
|
23871
24060
|
ch = state.input.charCodeAt(state.position);
|
|
23872
24061
|
if (ch !== 38) return false;
|
|
23873
24062
|
if (state.anchor !== null) {
|
|
23874
|
-
|
|
24063
|
+
throwError2(state, "duplication of an anchor property");
|
|
23875
24064
|
}
|
|
23876
24065
|
ch = state.input.charCodeAt(++state.position);
|
|
23877
24066
|
_position = state.position;
|
|
@@ -23879,7 +24068,7 @@ function readAnchorProperty(state) {
|
|
|
23879
24068
|
ch = state.input.charCodeAt(++state.position);
|
|
23880
24069
|
}
|
|
23881
24070
|
if (state.position === _position) {
|
|
23882
|
-
|
|
24071
|
+
throwError2(state, "name of an anchor node must contain at least one character");
|
|
23883
24072
|
}
|
|
23884
24073
|
state.anchor = state.input.slice(_position, state.position);
|
|
23885
24074
|
return true;
|
|
@@ -23894,11 +24083,11 @@ function readAlias(state) {
|
|
|
23894
24083
|
ch = state.input.charCodeAt(++state.position);
|
|
23895
24084
|
}
|
|
23896
24085
|
if (state.position === _position) {
|
|
23897
|
-
|
|
24086
|
+
throwError2(state, "name of an alias node must contain at least one character");
|
|
23898
24087
|
}
|
|
23899
24088
|
alias = state.input.slice(_position, state.position);
|
|
23900
24089
|
if (!_hasOwnProperty$1.call(state.anchorMap, alias)) {
|
|
23901
|
-
|
|
24090
|
+
throwError2(state, 'unidentified alias "' + alias + '"');
|
|
23902
24091
|
}
|
|
23903
24092
|
state.result = state.anchorMap[alias];
|
|
23904
24093
|
skipSeparationSpace(state, true, -1);
|
|
@@ -23962,7 +24151,7 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
|
|
|
23962
24151
|
} else if (readAlias(state)) {
|
|
23963
24152
|
hasContent = true;
|
|
23964
24153
|
if (state.tag !== null || state.anchor !== null) {
|
|
23965
|
-
|
|
24154
|
+
throwError2(state, "alias node should not have any properties");
|
|
23966
24155
|
}
|
|
23967
24156
|
} else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
|
|
23968
24157
|
hasContent = true;
|
|
@@ -23984,7 +24173,7 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
|
|
|
23984
24173
|
}
|
|
23985
24174
|
} else if (state.tag === "?") {
|
|
23986
24175
|
if (state.result !== null && state.kind !== "scalar") {
|
|
23987
|
-
|
|
24176
|
+
throwError2(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
|
|
23988
24177
|
}
|
|
23989
24178
|
for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
|
|
23990
24179
|
type2 = state.implicitTypes[typeIndex];
|
|
@@ -24011,13 +24200,13 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
|
|
|
24011
24200
|
}
|
|
24012
24201
|
}
|
|
24013
24202
|
if (!type2) {
|
|
24014
|
-
|
|
24203
|
+
throwError2(state, "unknown tag !<" + state.tag + ">");
|
|
24015
24204
|
}
|
|
24016
24205
|
if (state.result !== null && type2.kind !== state.kind) {
|
|
24017
|
-
|
|
24206
|
+
throwError2(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type2.kind + '", not "' + state.kind + '"');
|
|
24018
24207
|
}
|
|
24019
24208
|
if (!type2.resolve(state.result, state.tag)) {
|
|
24020
|
-
|
|
24209
|
+
throwError2(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
|
|
24021
24210
|
} else {
|
|
24022
24211
|
state.result = type2.construct(state.result, state.tag);
|
|
24023
24212
|
if (state.anchor !== null) {
|
|
@@ -24051,7 +24240,7 @@ function readDocument(state) {
|
|
|
24051
24240
|
directiveName = state.input.slice(_position, state.position);
|
|
24052
24241
|
directiveArgs = [];
|
|
24053
24242
|
if (directiveName.length < 1) {
|
|
24054
|
-
|
|
24243
|
+
throwError2(state, "directive name must not be less than one character in length");
|
|
24055
24244
|
}
|
|
24056
24245
|
while (ch !== 0) {
|
|
24057
24246
|
while (is_WHITE_SPACE(ch)) {
|
|
@@ -24082,7 +24271,7 @@ function readDocument(state) {
|
|
|
24082
24271
|
state.position += 3;
|
|
24083
24272
|
skipSeparationSpace(state, true, -1);
|
|
24084
24273
|
} else if (hasDirectives) {
|
|
24085
|
-
|
|
24274
|
+
throwError2(state, "directives end mark is expected");
|
|
24086
24275
|
}
|
|
24087
24276
|
composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
|
|
24088
24277
|
skipSeparationSpace(state, true, -1);
|
|
@@ -24098,7 +24287,7 @@ function readDocument(state) {
|
|
|
24098
24287
|
return;
|
|
24099
24288
|
}
|
|
24100
24289
|
if (state.position < state.length - 1) {
|
|
24101
|
-
|
|
24290
|
+
throwError2(state, "end of the stream or a document separator is expected");
|
|
24102
24291
|
} else {
|
|
24103
24292
|
return;
|
|
24104
24293
|
}
|
|
@@ -24118,7 +24307,7 @@ function loadDocuments(input, options) {
|
|
|
24118
24307
|
var nullpos = input.indexOf("\0");
|
|
24119
24308
|
if (nullpos !== -1) {
|
|
24120
24309
|
state.position = nullpos;
|
|
24121
|
-
|
|
24310
|
+
throwError2(state, "null byte is not allowed in input");
|
|
24122
24311
|
}
|
|
24123
24312
|
state.input += "\0";
|
|
24124
24313
|
while (state.input.charCodeAt(state.position) === 32) {
|
|
@@ -24982,19 +25171,19 @@ var init_js_yaml = __esm({
|
|
|
24982
25171
|
YAML: function handleYamlDirective(state, name, args) {
|
|
24983
25172
|
var match, major, minor;
|
|
24984
25173
|
if (state.version !== null) {
|
|
24985
|
-
|
|
25174
|
+
throwError2(state, "duplication of %YAML directive");
|
|
24986
25175
|
}
|
|
24987
25176
|
if (args.length !== 1) {
|
|
24988
|
-
|
|
25177
|
+
throwError2(state, "YAML directive accepts exactly one argument");
|
|
24989
25178
|
}
|
|
24990
25179
|
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
24991
25180
|
if (match === null) {
|
|
24992
|
-
|
|
25181
|
+
throwError2(state, "ill-formed argument of the YAML directive");
|
|
24993
25182
|
}
|
|
24994
25183
|
major = parseInt(match[1], 10);
|
|
24995
25184
|
minor = parseInt(match[2], 10);
|
|
24996
25185
|
if (major !== 1) {
|
|
24997
|
-
|
|
25186
|
+
throwError2(state, "unacceptable YAML version of the document");
|
|
24998
25187
|
}
|
|
24999
25188
|
state.version = args[0];
|
|
25000
25189
|
state.checkLineBreaks = minor < 2;
|
|
@@ -25005,23 +25194,23 @@ var init_js_yaml = __esm({
|
|
|
25005
25194
|
TAG: function handleTagDirective(state, name, args) {
|
|
25006
25195
|
var handle, prefix;
|
|
25007
25196
|
if (args.length !== 2) {
|
|
25008
|
-
|
|
25197
|
+
throwError2(state, "TAG directive accepts exactly two arguments");
|
|
25009
25198
|
}
|
|
25010
25199
|
handle = args[0];
|
|
25011
25200
|
prefix = args[1];
|
|
25012
25201
|
if (!PATTERN_TAG_HANDLE.test(handle)) {
|
|
25013
|
-
|
|
25202
|
+
throwError2(state, "ill-formed tag handle (first argument) of the TAG directive");
|
|
25014
25203
|
}
|
|
25015
25204
|
if (_hasOwnProperty$1.call(state.tagMap, handle)) {
|
|
25016
|
-
|
|
25205
|
+
throwError2(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
|
25017
25206
|
}
|
|
25018
25207
|
if (!PATTERN_TAG_URI.test(prefix)) {
|
|
25019
|
-
|
|
25208
|
+
throwError2(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
25020
25209
|
}
|
|
25021
25210
|
try {
|
|
25022
25211
|
prefix = decodeURIComponent(prefix);
|
|
25023
25212
|
} catch (err) {
|
|
25024
|
-
|
|
25213
|
+
throwError2(state, "tag prefix is malformed: " + prefix);
|
|
25025
25214
|
}
|
|
25026
25215
|
state.tagMap[handle] = prefix;
|
|
25027
25216
|
}
|
|
@@ -26632,13 +26821,13 @@ var init_embedding_check = __esm({
|
|
|
26632
26821
|
const model = embeddingService.getModel();
|
|
26633
26822
|
try {
|
|
26634
26823
|
if (embeddingType === "ollama") {
|
|
26635
|
-
const
|
|
26636
|
-
const res = await fetch(`${
|
|
26824
|
+
const baseUrl5 = embeddingService.getBaseURL().replace(/\/+$/, "");
|
|
26825
|
+
const res = await fetch(`${baseUrl5}/api/tags`);
|
|
26637
26826
|
if (!res.ok) {
|
|
26638
26827
|
return {
|
|
26639
26828
|
success: false,
|
|
26640
26829
|
status: "unhealthy",
|
|
26641
|
-
error: `Ollama returned ${res.status} at ${
|
|
26830
|
+
error: `Ollama returned ${res.status} at ${baseUrl5}/api/tags`,
|
|
26642
26831
|
metadata: { serviceType: "embedding", embeddingType, model }
|
|
26643
26832
|
};
|
|
26644
26833
|
}
|
|
@@ -26668,9 +26857,9 @@ var init_embedding_check = __esm({
|
|
|
26668
26857
|
status: "running",
|
|
26669
26858
|
health: {
|
|
26670
26859
|
healthy: true,
|
|
26671
|
-
details: { embeddingType, model, endpoint:
|
|
26860
|
+
details: { embeddingType, model, endpoint: baseUrl5 }
|
|
26672
26861
|
},
|
|
26673
|
-
metadata: { serviceType: "embedding", embeddingType, model, endpoint:
|
|
26862
|
+
metadata: { serviceType: "embedding", embeddingType, model, endpoint: baseUrl5 }
|
|
26674
26863
|
};
|
|
26675
26864
|
}
|
|
26676
26865
|
return {
|
|
@@ -26729,11 +26918,11 @@ var init_embedding_provision = __esm({
|
|
|
26729
26918
|
};
|
|
26730
26919
|
}
|
|
26731
26920
|
const model = embeddingService.getModel();
|
|
26732
|
-
const
|
|
26921
|
+
const baseUrl5 = embeddingService.getBaseURL().replace(/\/+$/, "");
|
|
26733
26922
|
if (!service.quiet) {
|
|
26734
|
-
printInfo(`Pulling embedding model ${model} from ${
|
|
26923
|
+
printInfo(`Pulling embedding model ${model} from ${baseUrl5}...`);
|
|
26735
26924
|
}
|
|
26736
|
-
const res = await fetch(`${
|
|
26925
|
+
const res = await fetch(`${baseUrl5}/api/pull`, {
|
|
26737
26926
|
method: "POST",
|
|
26738
26927
|
headers: { "Content-Type": "application/json" },
|
|
26739
26928
|
body: JSON.stringify({ name: model, stream: false })
|
|
@@ -26761,13 +26950,13 @@ var init_embedding_provision = __esm({
|
|
|
26761
26950
|
success: true,
|
|
26762
26951
|
resources: {
|
|
26763
26952
|
platform: "external",
|
|
26764
|
-
data: { endpoint:
|
|
26953
|
+
data: { endpoint: baseUrl5, provider: embeddingType }
|
|
26765
26954
|
},
|
|
26766
26955
|
metadata: {
|
|
26767
26956
|
serviceType: "embedding",
|
|
26768
26957
|
embeddingType,
|
|
26769
26958
|
model,
|
|
26770
|
-
endpoint:
|
|
26959
|
+
endpoint: baseUrl5
|
|
26771
26960
|
}
|
|
26772
26961
|
};
|
|
26773
26962
|
};
|
|
@@ -27195,13 +27384,13 @@ var init_inference_provision3 = __esm({
|
|
|
27195
27384
|
metadata: { serviceType: "inference", inferenceType }
|
|
27196
27385
|
};
|
|
27197
27386
|
}
|
|
27198
|
-
const
|
|
27387
|
+
const baseUrl5 = endpoint.replace(/\/+$/, "");
|
|
27199
27388
|
const pulledModels = [];
|
|
27200
27389
|
for (const model of models) {
|
|
27201
27390
|
if (!service.quiet) {
|
|
27202
|
-
printInfo(`Pulling model ${model} from ${
|
|
27391
|
+
printInfo(`Pulling model ${model} from ${baseUrl5}...`);
|
|
27203
27392
|
}
|
|
27204
|
-
const res = await fetch(`${
|
|
27393
|
+
const res = await fetch(`${baseUrl5}/api/pull`, {
|
|
27205
27394
|
method: "POST",
|
|
27206
27395
|
headers: { "Content-Type": "application/json" },
|
|
27207
27396
|
body: JSON.stringify({ name: model, stream: false })
|
|
@@ -27231,13 +27420,13 @@ var init_inference_provision3 = __esm({
|
|
|
27231
27420
|
success: true,
|
|
27232
27421
|
resources: {
|
|
27233
27422
|
platform: "external",
|
|
27234
|
-
data: { endpoint:
|
|
27423
|
+
data: { endpoint: baseUrl5, provider: inferenceType }
|
|
27235
27424
|
},
|
|
27236
27425
|
metadata: {
|
|
27237
27426
|
serviceType: "inference",
|
|
27238
27427
|
inferenceType,
|
|
27239
27428
|
models: pulledModels,
|
|
27240
|
-
endpoint:
|
|
27429
|
+
endpoint: baseUrl5
|
|
27241
27430
|
}
|
|
27242
27431
|
};
|
|
27243
27432
|
};
|
|
@@ -32828,7 +33017,7 @@ var require_package = __commonJS({
|
|
|
32828
33017
|
"package.json"(exports, module) {
|
|
32829
33018
|
module.exports = {
|
|
32830
33019
|
name: "@semiont/cli",
|
|
32831
|
-
version: "0.5.
|
|
33020
|
+
version: "0.5.2",
|
|
32832
33021
|
description: "Semiont CLI - Unified environment management tool",
|
|
32833
33022
|
_comment: "AWS SDK dependencies (@aws-sdk/*) are only used by platforms/aws",
|
|
32834
33023
|
type: "module",
|
|
@@ -32875,13 +33064,13 @@ var require_package = __commonJS({
|
|
|
32875
33064
|
"test:watch:unit": "vitest --watch --config vitest.config.unit.ts"
|
|
32876
33065
|
},
|
|
32877
33066
|
dependencies: {
|
|
32878
|
-
"@semiont/api-client": "0.5.
|
|
32879
|
-
"@semiont/content": "0.5.
|
|
32880
|
-
"@semiont/core": "0.5.
|
|
32881
|
-
"@semiont/event-sourcing": "0.5.
|
|
32882
|
-
"@semiont/graph": "0.5.
|
|
32883
|
-
"@semiont/sdk": "0.5.
|
|
32884
|
-
"@semiont/make-meaning": "0.5.
|
|
33067
|
+
"@semiont/api-client": "0.5.2",
|
|
33068
|
+
"@semiont/content": "0.5.2",
|
|
33069
|
+
"@semiont/core": "0.5.2",
|
|
33070
|
+
"@semiont/event-sourcing": "0.5.2",
|
|
33071
|
+
"@semiont/graph": "0.5.2",
|
|
33072
|
+
"@semiont/sdk": "0.5.2",
|
|
33073
|
+
"@semiont/make-meaning": "0.5.2",
|
|
32885
33074
|
arg: "^5.0.2",
|
|
32886
33075
|
argon2: "^0.44.0",
|
|
32887
33076
|
express: "^5.2.1",
|
|
@@ -34226,8 +34415,8 @@ async function runBackup(options) {
|
|
|
34226
34415
|
const projectRoot = findProjectRoot();
|
|
34227
34416
|
const environment = options.environment;
|
|
34228
34417
|
const envConfig = loadEnvironmentConfig(projectRoot, environment);
|
|
34229
|
-
const
|
|
34230
|
-
if (!
|
|
34418
|
+
const baseUrl5 = envConfig.services?.backend?.publicURL;
|
|
34419
|
+
if (!baseUrl5) {
|
|
34231
34420
|
throw new Error("services.backend.publicURL is required in environment config");
|
|
34232
34421
|
}
|
|
34233
34422
|
const project = new SemiontProject11(projectRoot);
|
|
@@ -34243,7 +34432,7 @@ async function runBackup(options) {
|
|
|
34243
34432
|
}
|
|
34244
34433
|
const output = fs38.createWriteStream(outPath);
|
|
34245
34434
|
const manifest = await exportBackup(
|
|
34246
|
-
{ eventStore, content: contentStore, sourceUrl:
|
|
34435
|
+
{ eventStore, content: contentStore, sourceUrl: baseUrl5, logger },
|
|
34247
34436
|
output
|
|
34248
34437
|
);
|
|
34249
34438
|
if (!options.quiet) {
|
|
@@ -34585,8 +34774,8 @@ async function runExport(options) {
|
|
|
34585
34774
|
const projectRoot = findProjectRoot();
|
|
34586
34775
|
const environment = options.environment;
|
|
34587
34776
|
const envConfig = loadEnvironmentConfig(projectRoot, environment);
|
|
34588
|
-
const
|
|
34589
|
-
if (!
|
|
34777
|
+
const baseUrl5 = envConfig.services?.backend?.publicURL;
|
|
34778
|
+
if (!baseUrl5) {
|
|
34590
34779
|
throw new Error("services.backend.publicURL is required in environment config");
|
|
34591
34780
|
}
|
|
34592
34781
|
const project = new SemiontProject13(projectRoot);
|
|
@@ -34609,7 +34798,7 @@ async function runExport(options) {
|
|
|
34609
34798
|
{
|
|
34610
34799
|
views: eventStore.viewStorage,
|
|
34611
34800
|
content: contentStore,
|
|
34612
|
-
sourceUrl:
|
|
34801
|
+
sourceUrl: baseUrl5,
|
|
34613
34802
|
entityTypes,
|
|
34614
34803
|
includeArchived: options.includeArchived,
|
|
34615
34804
|
logger
|
|
@@ -34730,10 +34919,10 @@ async function runImport(options) {
|
|
|
34730
34919
|
if (!fs42.existsSync(filePath)) {
|
|
34731
34920
|
throw new Error(`File not found: ${filePath}`);
|
|
34732
34921
|
}
|
|
34733
|
-
const
|
|
34922
|
+
const userId2 = options.userId ?? `did:web:localhost:users:${process.env.USER ?? "cli"}`;
|
|
34734
34923
|
if (!options.quiet) {
|
|
34735
34924
|
printInfo(`Importing JSON-LD archive from ${filePath}`);
|
|
34736
|
-
printInfo(`User identity: ${
|
|
34925
|
+
printInfo(`User identity: ${userId2}`);
|
|
34737
34926
|
}
|
|
34738
34927
|
const eventBus = new EventBus5();
|
|
34739
34928
|
const eventStore = createEventStore4(project, eventBus, logger);
|
|
@@ -34742,7 +34931,7 @@ async function runImport(options) {
|
|
|
34742
34931
|
await stower.initialize();
|
|
34743
34932
|
try {
|
|
34744
34933
|
const input = fs42.createReadStream(filePath);
|
|
34745
|
-
const result = await importLinkedData(input, { eventBus, contentStore: kb.content, userId, logger });
|
|
34934
|
+
const result = await importLinkedData(input, { eventBus, contentStore: kb.content, userId: userId2, logger });
|
|
34746
34935
|
if (!options.quiet) {
|
|
34747
34936
|
printSuccess(
|
|
34748
34937
|
`Import complete: ${result.resourcesCreated} resources, ${result.annotationsCreated} annotations, ${result.entityTypesAdded} entity types`
|
|
@@ -35486,8 +35675,8 @@ async function runMv(options) {
|
|
|
35486
35675
|
reject(new Error(e.message ?? "Move failed"));
|
|
35487
35676
|
});
|
|
35488
35677
|
});
|
|
35489
|
-
const
|
|
35490
|
-
eventBus.get("yield:mv").next({ fromUri, toUri, _userId:
|
|
35678
|
+
const userId2 = `did:web:localhost:users:${process.env.USER ?? "cli"}`;
|
|
35679
|
+
eventBus.get("yield:mv").next({ fromUri, toUri, _userId: userId2, noGit: options.noGit });
|
|
35491
35680
|
await movedPromise;
|
|
35492
35681
|
if (!options.quiet) {
|
|
35493
35682
|
printSuccess(`Moved: ${fromUri} \u2192 ${toUri}`);
|
|
@@ -35533,7 +35722,7 @@ var mvCmd = new CommandBuilder().name("mv").description("Move (rename) a tracked
|
|
|
35533
35722
|
|
|
35534
35723
|
// src/core/commands/yield.ts
|
|
35535
35724
|
init_zod();
|
|
35536
|
-
var
|
|
35725
|
+
var import_rxjs2 = __toESM(require_cjs(), 1);
|
|
35537
35726
|
init_command_definition();
|
|
35538
35727
|
init_base_options_schema();
|
|
35539
35728
|
init_cli_logger();
|
|
@@ -35544,14 +35733,11 @@ import { resourceId as toResourceId, annotationId as toAnnotationId } from "@sem
|
|
|
35544
35733
|
|
|
35545
35734
|
// src/core/api-client-factory.ts
|
|
35546
35735
|
init_dist();
|
|
35547
|
-
var import_rxjs2 = __toESM(require_cjs(), 1);
|
|
35548
35736
|
import * as fs45 from "fs";
|
|
35549
35737
|
import * as path37 from "path";
|
|
35550
35738
|
import * as os6 from "os";
|
|
35551
|
-
import { HttpContentTransport as HttpContentTransport5, HttpTransport as HttpTransport5 } from "@semiont/api-client";
|
|
35552
35739
|
import {
|
|
35553
|
-
accessToken as toAccessToken
|
|
35554
|
-
baseUrl as toBaseUrl
|
|
35740
|
+
accessToken as toAccessToken
|
|
35555
35741
|
} from "@semiont/core";
|
|
35556
35742
|
var TOKEN_CACHE_TTL_MS = 864e5;
|
|
35557
35743
|
function authStoreDir() {
|
|
@@ -35581,8 +35767,7 @@ function isTokenValid(cache) {
|
|
|
35581
35767
|
return Date.now() < cachedAt + TOKEN_CACHE_TTL_MS;
|
|
35582
35768
|
}
|
|
35583
35769
|
async function acquireToken(rawBusUrl, emailStr, passwordStr) {
|
|
35584
|
-
const
|
|
35585
|
-
const semiont = new SemiontClient(transport, new HttpContentTransport5(transport));
|
|
35770
|
+
const semiont = SemiontClient.fromHttp({ baseUrl: rawBusUrl });
|
|
35586
35771
|
const authResult = await semiont.auth.password(emailStr, passwordStr);
|
|
35587
35772
|
const cache = {
|
|
35588
35773
|
bus: rawBusUrl,
|
|
@@ -35602,9 +35787,7 @@ Run: semiont login --bus ${rawBusUrl}`
|
|
|
35602
35787
|
);
|
|
35603
35788
|
}
|
|
35604
35789
|
const token = toAccessToken(cached.token);
|
|
35605
|
-
const
|
|
35606
|
-
const transport = new HttpTransport5({ baseUrl: toBaseUrl(rawBusUrl), token$ });
|
|
35607
|
-
const semiont = new SemiontClient(transport, new HttpContentTransport5(transport));
|
|
35790
|
+
const semiont = SemiontClient.fromHttp({ baseUrl: rawBusUrl, token });
|
|
35608
35791
|
return { semiont, token };
|
|
35609
35792
|
}
|
|
35610
35793
|
function resolveBusUrl(busFlag) {
|
|
@@ -35647,7 +35830,14 @@ var YieldOptionsSchema = ApiOptionsSchema.extend({
|
|
|
35647
35830
|
// Delegate mode optional
|
|
35648
35831
|
title: external_exports.string().optional(),
|
|
35649
35832
|
prompt: external_exports.string().optional(),
|
|
35833
|
+
/** BCP-47 tag — language the *generated resource* is written in. */
|
|
35650
35834
|
language: external_exports.string().optional(),
|
|
35835
|
+
/**
|
|
35836
|
+
* BCP-47 tag — language of the *source resource* the annotation lives on.
|
|
35837
|
+
* Goes into the prompt so the LLM understands embedded source-context
|
|
35838
|
+
* snippets correctly when source ≠ target language.
|
|
35839
|
+
*/
|
|
35840
|
+
sourceLanguage: external_exports.string().optional(),
|
|
35651
35841
|
temperature: external_exports.coerce.number().min(0).max(1).optional(),
|
|
35652
35842
|
maxTokens: external_exports.coerce.number().int().min(100).max(4e3).optional(),
|
|
35653
35843
|
contextWindow: external_exports.coerce.number().int().min(100).max(5e3).default(1e3)
|
|
@@ -35674,18 +35864,20 @@ async function runDelegate(semiont, options) {
|
|
|
35674
35864
|
const rawAnnotationId = options.annotation;
|
|
35675
35865
|
const rId = toResourceId(rawResourceId);
|
|
35676
35866
|
const aId = toAnnotationId(rawAnnotationId);
|
|
35677
|
-
const context = await (0,
|
|
35678
|
-
semiont.gather.annotation(
|
|
35867
|
+
const context = await (0, import_rxjs2.lastValueFrom)(
|
|
35868
|
+
semiont.gather.annotation(rId, aId, { contextWindow: options.contextWindow })
|
|
35679
35869
|
);
|
|
35680
35870
|
if (!options.quiet) process.stderr.write(`Generating from annotation ${rawAnnotationId}...
|
|
35681
35871
|
`);
|
|
35682
|
-
const
|
|
35872
|
+
const ctxSourceLanguage = context?.metadata?.language;
|
|
35873
|
+
const final = await (0, import_rxjs2.lastValueFrom)(
|
|
35683
35874
|
semiont.yield.fromAnnotation(rId, aId, {
|
|
35684
35875
|
title: options.title ?? rawAnnotationId,
|
|
35685
35876
|
storageUri: options.storageUri,
|
|
35686
35877
|
context,
|
|
35687
35878
|
prompt: options.prompt,
|
|
35688
35879
|
language: options.language,
|
|
35880
|
+
sourceLanguage: options.sourceLanguage ?? ctxSourceLanguage,
|
|
35689
35881
|
temperature: options.temperature,
|
|
35690
35882
|
maxTokens: options.maxTokens
|
|
35691
35883
|
})
|
|
@@ -35699,10 +35891,10 @@ async function runYield(options) {
|
|
|
35699
35891
|
const { semiont } = loadCachedClient(rawBusUrl);
|
|
35700
35892
|
const projectRoot = findProjectRoot();
|
|
35701
35893
|
if (options.delegate) {
|
|
35702
|
-
const { resourceId:
|
|
35703
|
-
const label = resourceName ??
|
|
35704
|
-
if (!options.quiet) printSuccess(`Yielded: ${options.storageUri} \u2192 ${
|
|
35705
|
-
process.stdout.write(JSON.stringify({ resourceId:
|
|
35894
|
+
const { resourceId: resourceId3, resourceName } = await runDelegate(semiont, options);
|
|
35895
|
+
const label = resourceName ?? resourceId3 ?? options.storageUri;
|
|
35896
|
+
if (!options.quiet) printSuccess(`Yielded: ${options.storageUri} \u2192 ${resourceId3 ?? "(pending)"}`);
|
|
35897
|
+
process.stdout.write(JSON.stringify({ resourceId: resourceId3, resourceName, storageUri: options.storageUri }));
|
|
35706
35898
|
if (!options.quiet) process.stdout.write("\n");
|
|
35707
35899
|
return {
|
|
35708
35900
|
command: "yield",
|
|
@@ -35711,7 +35903,7 @@ async function runYield(options) {
|
|
|
35711
35903
|
duration: Date.now() - startTime,
|
|
35712
35904
|
summary: { succeeded: 1, failed: 0, total: 1, warnings: 0 },
|
|
35713
35905
|
executionContext: { user: process.env.USER || "unknown", workingDirectory: process.cwd(), dryRun: options.dryRun },
|
|
35714
|
-
results: [{ entity: label, platform: "posix", success: true, metadata: { resourceId:
|
|
35906
|
+
results: [{ entity: label, platform: "posix", success: true, metadata: { resourceId: resourceId3, storageUri: options.storageUri }, duration: Date.now() - startTime }]
|
|
35715
35907
|
};
|
|
35716
35908
|
}
|
|
35717
35909
|
let succeeded = 0;
|
|
@@ -35733,11 +35925,11 @@ async function runYield(options) {
|
|
|
35733
35925
|
const storageUri = `file://${relPath}`;
|
|
35734
35926
|
const name = options.name ?? path38.basename(filePath, path38.extname(filePath));
|
|
35735
35927
|
const format = guessFormat(filePath);
|
|
35736
|
-
const { resourceId:
|
|
35928
|
+
const { resourceId: resourceId3 } = await semiont.yield.resource(
|
|
35737
35929
|
{ name, file: content, format, storageUri }
|
|
35738
35930
|
);
|
|
35739
|
-
if (!options.quiet) printSuccess(`Yielded: ${filePath} \u2192 ${
|
|
35740
|
-
results.push({ entity: filePath, platform: "posix", success: true, metadata: { resourceId:
|
|
35931
|
+
if (!options.quiet) printSuccess(`Yielded: ${filePath} \u2192 ${resourceId3}`);
|
|
35932
|
+
results.push({ entity: filePath, platform: "posix", success: true, metadata: { resourceId: resourceId3, storageUri }, duration: Date.now() - fileStart });
|
|
35741
35933
|
succeeded++;
|
|
35742
35934
|
}
|
|
35743
35935
|
return {
|
|
@@ -35823,7 +36015,7 @@ init_command_definition();
|
|
|
35823
36015
|
init_base_options_schema();
|
|
35824
36016
|
init_cli_logger();
|
|
35825
36017
|
import { resourceId as toResourceId2 } from "@semiont/core";
|
|
35826
|
-
var
|
|
36018
|
+
var import_rxjs3 = __toESM(require_cjs(), 1);
|
|
35827
36019
|
var MOTIVATIONS = ["highlighting", "commenting", "tagging", "assessing", "linking"];
|
|
35828
36020
|
var CONTEXT_WINDOW = 32;
|
|
35829
36021
|
var MarkOptionsSchema = ApiOptionsSchema.extend({
|
|
@@ -35856,6 +36048,19 @@ var MarkOptionsSchema = ApiOptionsSchema.extend({
|
|
|
35856
36048
|
instructions: external_exports.string().optional(),
|
|
35857
36049
|
density: external_exports.coerce.number().int().optional(),
|
|
35858
36050
|
tone: external_exports.enum(["scholarly", "explanatory", "conversational", "technical", "analytical", "critical", "balanced", "constructive"]).optional(),
|
|
36051
|
+
/**
|
|
36052
|
+
* BCP-47 tag for the annotation body language. Tells the LLM what language
|
|
36053
|
+
* to write generated body text in (comment/assessment) and stamps the
|
|
36054
|
+
* `language` field on every TextualBody the worker produces. Independent
|
|
36055
|
+
* from --source-language; this one is about the *output*.
|
|
36056
|
+
*/
|
|
36057
|
+
language: external_exports.string().optional(),
|
|
36058
|
+
/**
|
|
36059
|
+
* BCP-47 tag for the source-resource language. Goes into the prompt so the
|
|
36060
|
+
* LLM analyzes non-English source correctly. Independent from --language;
|
|
36061
|
+
* this one is about the *input*.
|
|
36062
|
+
*/
|
|
36063
|
+
sourceLanguage: external_exports.string().optional(),
|
|
35859
36064
|
// ── Delegate mode: linking ─────────────────────────────────────────────
|
|
35860
36065
|
entityType: external_exports.array(external_exports.string()).default([]),
|
|
35861
36066
|
includeDescriptive: external_exports.boolean().default(false),
|
|
@@ -35880,8 +36085,8 @@ var MarkOptionsSchema = ApiOptionsSchema.extend({
|
|
|
35880
36085
|
}
|
|
35881
36086
|
}
|
|
35882
36087
|
});
|
|
35883
|
-
async function fetchResourceText(semiont,
|
|
35884
|
-
const { data } = await semiont.browse.resourceRepresentation(
|
|
36088
|
+
async function fetchResourceText(semiont, resourceId3) {
|
|
36089
|
+
const { data } = await semiont.browse.resourceRepresentation(resourceId3, { accept: "text/plain" });
|
|
35885
36090
|
return new TextDecoder().decode(data);
|
|
35886
36091
|
}
|
|
35887
36092
|
function buildTextSelector(options, content) {
|
|
@@ -35919,7 +36124,7 @@ function buildTextSelector(options, content) {
|
|
|
35919
36124
|
}
|
|
35920
36125
|
return selectors;
|
|
35921
36126
|
}
|
|
35922
|
-
async function buildSelector(options, semiont,
|
|
36127
|
+
async function buildSelector(options, semiont, resourceId3) {
|
|
35923
36128
|
const hasText = options.quote !== void 0 || options.start !== void 0 && options.end !== void 0;
|
|
35924
36129
|
const hasSvg = options.svg !== void 0;
|
|
35925
36130
|
const hasFragment = options.fragment !== void 0;
|
|
@@ -35936,7 +36141,7 @@ async function buildSelector(options, semiont, resourceId2) {
|
|
|
35936
36141
|
return f;
|
|
35937
36142
|
}
|
|
35938
36143
|
if (!hasText) return void 0;
|
|
35939
|
-
const content = options.fetchContent ? await fetchResourceText(semiont,
|
|
36144
|
+
const content = options.fetchContent ? await fetchResourceText(semiont, resourceId3) : void 0;
|
|
35940
36145
|
const selectors = buildTextSelector(options, content);
|
|
35941
36146
|
if (selectors.length === 0) return void 0;
|
|
35942
36147
|
if (selectors.length === 1) return selectors[0];
|
|
@@ -35961,18 +36166,20 @@ function buildBody(options) {
|
|
|
35961
36166
|
async function runDelegate2(semiont, options) {
|
|
35962
36167
|
const rawResourceId = options.resourceIdArr[0];
|
|
35963
36168
|
const rId = toResourceId2(rawResourceId);
|
|
35964
|
-
const { motivation, instructions, density, tone, entityType, includeDescriptive, schemaId, category } = options;
|
|
36169
|
+
const { motivation, instructions, density, tone, entityType: entityType2, includeDescriptive, schemaId, category, language, sourceLanguage } = options;
|
|
35965
36170
|
if (!options.quiet) process.stderr.write(`Annotating ${motivation} on ${rawResourceId}...
|
|
35966
36171
|
`);
|
|
35967
|
-
const final = await (0,
|
|
36172
|
+
const final = await (0, import_rxjs3.lastValueFrom)(
|
|
35968
36173
|
semiont.mark.assist(rId, motivation, {
|
|
35969
36174
|
instructions,
|
|
35970
36175
|
density,
|
|
35971
36176
|
tone,
|
|
35972
|
-
entityTypes:
|
|
36177
|
+
entityTypes: entityType2,
|
|
35973
36178
|
includeDescriptiveReferences: includeDescriptive,
|
|
35974
36179
|
schemaId,
|
|
35975
|
-
categories: category
|
|
36180
|
+
categories: category,
|
|
36181
|
+
language,
|
|
36182
|
+
sourceLanguage
|
|
35976
36183
|
})
|
|
35977
36184
|
);
|
|
35978
36185
|
const r = (final.kind === "complete" ? final.data.result : void 0) ?? {};
|
|
@@ -36000,8 +36207,8 @@ async function runMark(options) {
|
|
|
36000
36207
|
};
|
|
36001
36208
|
}
|
|
36002
36209
|
const rawResourceId = options.resourceIdArr[0];
|
|
36003
|
-
const
|
|
36004
|
-
const selector = await buildSelector(options, semiont,
|
|
36210
|
+
const resourceId3 = toResourceId2(rawResourceId);
|
|
36211
|
+
const selector = await buildSelector(options, semiont, resourceId3);
|
|
36005
36212
|
const body = buildBody(options);
|
|
36006
36213
|
const target = selector !== void 0 ? { source: rawResourceId, selector } : { source: rawResourceId, selector: void 0 };
|
|
36007
36214
|
const request = {
|
|
@@ -36009,8 +36216,8 @@ async function runMark(options) {
|
|
|
36009
36216
|
target,
|
|
36010
36217
|
body
|
|
36011
36218
|
};
|
|
36012
|
-
const { annotationId:
|
|
36013
|
-
if (!options.quiet) printSuccess(`Marked: ${rawResourceId} \u2192 ${
|
|
36219
|
+
const { annotationId: annotationId3 } = await semiont.mark.annotation(request);
|
|
36220
|
+
if (!options.quiet) printSuccess(`Marked: ${rawResourceId} \u2192 ${annotationId3}`);
|
|
36014
36221
|
return {
|
|
36015
36222
|
command: "mark",
|
|
36016
36223
|
environment: rawBusUrl,
|
|
@@ -36018,7 +36225,7 @@ async function runMark(options) {
|
|
|
36018
36225
|
duration: Date.now() - startTime,
|
|
36019
36226
|
summary: { succeeded: 1, failed: 0, total: 1, warnings: 0 },
|
|
36020
36227
|
executionContext: { user: process.env.USER || "unknown", workingDirectory: process.cwd(), dryRun: options.dryRun },
|
|
36021
|
-
results: [{ entity: rawResourceId, platform: "posix", success: true, metadata: { annotationId:
|
|
36228
|
+
results: [{ entity: rawResourceId, platform: "posix", success: true, metadata: { annotationId: annotationId3 }, duration: Date.now() - startTime }]
|
|
36022
36229
|
};
|
|
36023
36230
|
}
|
|
36024
36231
|
var markCmd = new CommandBuilder().name("mark").description(
|
|
@@ -36149,7 +36356,7 @@ var markCmd = new CommandBuilder().name("mark").description(
|
|
|
36149
36356
|
|
|
36150
36357
|
// src/core/commands/gather.ts
|
|
36151
36358
|
init_zod();
|
|
36152
|
-
var
|
|
36359
|
+
var import_rxjs4 = __toESM(require_cjs(), 1);
|
|
36153
36360
|
init_command_definition();
|
|
36154
36361
|
init_base_options_schema();
|
|
36155
36362
|
import { resourceId as toResourceId3, annotationId as toAnnotationId2 } from "@semiont/core";
|
|
@@ -36176,8 +36383,8 @@ async function runGather(options) {
|
|
|
36176
36383
|
}
|
|
36177
36384
|
const rid = toResourceId3(rawResourceId);
|
|
36178
36385
|
const aid = toAnnotationId2(rawAnnotationId);
|
|
36179
|
-
result = await (0,
|
|
36180
|
-
semiont.gather.annotation(
|
|
36386
|
+
result = await (0, import_rxjs4.lastValueFrom)(
|
|
36387
|
+
semiont.gather.annotation(rid, aid, { contextWindow: options.contextWindow })
|
|
36181
36388
|
);
|
|
36182
36389
|
} else {
|
|
36183
36390
|
throw new Error(`Unknown subcommand: ${subcommand}. Use 'resource' or 'annotation'.`);
|
|
@@ -36219,7 +36426,7 @@ var gatherCmd = new CommandBuilder().name("gather").description("Fetch LLM-optim
|
|
|
36219
36426
|
|
|
36220
36427
|
// src/core/commands/match.ts
|
|
36221
36428
|
init_zod();
|
|
36222
|
-
var
|
|
36429
|
+
var import_rxjs5 = __toESM(require_cjs(), 1);
|
|
36223
36430
|
init_command_definition();
|
|
36224
36431
|
init_base_options_schema();
|
|
36225
36432
|
import { resourceId as toResourceId4, annotationId as toAnnotationId3 } from "@semiont/core";
|
|
@@ -36233,18 +36440,18 @@ var MatchOptionsSchema = ApiOptionsSchema.extend({
|
|
|
36233
36440
|
async function runMatch(options) {
|
|
36234
36441
|
const startTime = Date.now();
|
|
36235
36442
|
const [rawResourceId, rawAnnotationId] = options.args;
|
|
36236
|
-
const
|
|
36237
|
-
const
|
|
36443
|
+
const resourceId3 = toResourceId4(rawResourceId);
|
|
36444
|
+
const annotationId3 = toAnnotationId3(rawAnnotationId);
|
|
36238
36445
|
const rawBusUrl = resolveBusUrl(options.bus);
|
|
36239
36446
|
const { semiont } = loadCachedClient(rawBusUrl);
|
|
36240
|
-
let context = await (0,
|
|
36241
|
-
semiont.gather.annotation(
|
|
36447
|
+
let context = await (0, import_rxjs5.lastValueFrom)(
|
|
36448
|
+
semiont.gather.annotation(resourceId3, annotationId3, { contextWindow: options.contextWindow })
|
|
36242
36449
|
);
|
|
36243
36450
|
if (options.userHint) {
|
|
36244
36451
|
context = { ...context, userHint: options.userHint };
|
|
36245
36452
|
}
|
|
36246
|
-
const searchResult = await (0,
|
|
36247
|
-
semiont.match.search(
|
|
36453
|
+
const searchResult = await (0, import_rxjs5.firstValueFrom)(
|
|
36454
|
+
semiont.match.search(resourceId3, annotationId3, context, {
|
|
36248
36455
|
limit: options.limit,
|
|
36249
36456
|
useSemanticScoring: !options.noSemantic
|
|
36250
36457
|
})
|
|
@@ -36296,9 +36503,9 @@ async function runBind(options) {
|
|
|
36296
36503
|
const rawBusUrl = resolveBusUrl(options.bus);
|
|
36297
36504
|
const { semiont } = loadCachedClient(rawBusUrl);
|
|
36298
36505
|
const [rawResourceId, rawAnnotationId, targetResourceId] = options.args;
|
|
36299
|
-
const
|
|
36300
|
-
const
|
|
36301
|
-
await semiont.bind.body(
|
|
36506
|
+
const resourceId3 = toResourceId5(rawResourceId);
|
|
36507
|
+
const annotationId3 = toAnnotationId4(rawAnnotationId);
|
|
36508
|
+
await semiont.bind.body(resourceId3, annotationId3, [{
|
|
36302
36509
|
op: "add",
|
|
36303
36510
|
item: {
|
|
36304
36511
|
type: "SpecificResource",
|
|
@@ -36392,7 +36599,7 @@ var beckonCmd = new CommandBuilder().name("beckon").description(
|
|
|
36392
36599
|
|
|
36393
36600
|
// src/core/commands/browse.ts
|
|
36394
36601
|
init_zod();
|
|
36395
|
-
var
|
|
36602
|
+
var import_rxjs6 = __toESM(require_cjs(), 1);
|
|
36396
36603
|
var import_operators2 = __toESM(require_operators(), 1);
|
|
36397
36604
|
init_command_definition();
|
|
36398
36605
|
init_base_options_schema();
|
|
@@ -36441,15 +36648,15 @@ async function runBrowse(options) {
|
|
|
36441
36648
|
if (subcommand === "resources") {
|
|
36442
36649
|
const filters = { limit: options.limit };
|
|
36443
36650
|
if (options.search) filters.search = options.search;
|
|
36444
|
-
const items = await (0,
|
|
36651
|
+
const items = await (0, import_rxjs6.firstValueFrom)(semiont.browse.resources(filters).pipe((0, import_operators2.filter)(defined)));
|
|
36445
36652
|
result = items;
|
|
36446
36653
|
label = `${items.length} resource${items.length !== 1 ? "s" : ""} found`;
|
|
36447
36654
|
} else if (subcommand === "resource") {
|
|
36448
36655
|
const id = toResourceId6(rawResourceId);
|
|
36449
|
-
const resourceData = await (0,
|
|
36656
|
+
const resourceData = await (0, import_rxjs6.firstValueFrom)(semiont.browse.resource(id).pipe((0, import_operators2.filter)(defined)));
|
|
36450
36657
|
if (options.annotations || options.references) {
|
|
36451
|
-
const annotations = options.annotations ? await (0,
|
|
36452
|
-
const referencedBy = options.references ? await (0,
|
|
36658
|
+
const annotations = options.annotations ? await (0, import_rxjs6.firstValueFrom)(semiont.browse.annotations(id).pipe((0, import_operators2.filter)(defined))) : void 0;
|
|
36659
|
+
const referencedBy = options.references ? await (0, import_rxjs6.firstValueFrom)(semiont.browse.referencedBy(id).pipe((0, import_operators2.filter)(defined))) : void 0;
|
|
36453
36660
|
result = {
|
|
36454
36661
|
...resourceData,
|
|
36455
36662
|
...annotations ? { annotations } : {},
|
|
@@ -36460,13 +36667,13 @@ async function runBrowse(options) {
|
|
|
36460
36667
|
}
|
|
36461
36668
|
label = `${rawResourceId}: ${resourceData?.name ?? rawResourceId}`;
|
|
36462
36669
|
} else if (subcommand === "annotation") {
|
|
36463
|
-
const
|
|
36464
|
-
const
|
|
36465
|
-
result = await (0,
|
|
36670
|
+
const resourceId3 = toResourceId6(rawResourceId);
|
|
36671
|
+
const annotationId3 = toAnnotationId5(rawAnnotationId);
|
|
36672
|
+
result = await (0, import_rxjs6.firstValueFrom)(semiont.browse.annotation(resourceId3, annotationId3).pipe((0, import_operators2.filter)(defined)));
|
|
36466
36673
|
label = `${rawAnnotationId}: annotation on ${rawResourceId}`;
|
|
36467
36674
|
} else if (subcommand === "references") {
|
|
36468
36675
|
const id = toResourceId6(rawResourceId);
|
|
36469
|
-
const refs = await (0,
|
|
36676
|
+
const refs = await (0, import_rxjs6.firstValueFrom)(semiont.browse.referencedBy(id).pipe((0, import_operators2.filter)(defined)));
|
|
36470
36677
|
result = refs;
|
|
36471
36678
|
label = `${refs.length} resource${refs.length !== 1 ? "s" : ""} reference ${rawResourceId}`;
|
|
36472
36679
|
} else if (subcommand === "events") {
|
|
@@ -36475,9 +36682,9 @@ async function runBrowse(options) {
|
|
|
36475
36682
|
result = events;
|
|
36476
36683
|
label = `${events.length} event${events.length !== 1 ? "s" : ""} for ${rawResourceId}`;
|
|
36477
36684
|
} else if (subcommand === "history") {
|
|
36478
|
-
const
|
|
36479
|
-
const
|
|
36480
|
-
result = await semiont.browse.annotationHistory(
|
|
36685
|
+
const resourceId3 = toResourceId6(rawResourceId);
|
|
36686
|
+
const annotationId3 = toAnnotationId5(rawAnnotationId);
|
|
36687
|
+
result = await semiont.browse.annotationHistory(resourceId3, annotationId3);
|
|
36481
36688
|
label = `history for annotation ${rawAnnotationId} on ${rawResourceId}`;
|
|
36482
36689
|
} else if (subcommand === "files") {
|
|
36483
36690
|
const dirPath = options.args[1];
|
|
@@ -36486,7 +36693,7 @@ async function runBrowse(options) {
|
|
|
36486
36693
|
const entries = data?.entries ?? [];
|
|
36487
36694
|
label = `${entries.length} entr${entries.length !== 1 ? "ies" : "y"} in ${dirPath ?? "/"}`;
|
|
36488
36695
|
} else {
|
|
36489
|
-
const tags = await (0,
|
|
36696
|
+
const tags = await (0, import_rxjs6.firstValueFrom)(semiont.browse.entityTypes().pipe((0, import_operators2.filter)(defined)));
|
|
36490
36697
|
result = tags;
|
|
36491
36698
|
label = `${tags.length} entity type${tags.length !== 1 ? "s" : ""}`;
|
|
36492
36699
|
}
|
|
@@ -36561,7 +36768,7 @@ init_zod();
|
|
|
36561
36768
|
init_command_definition();
|
|
36562
36769
|
init_base_options_schema();
|
|
36563
36770
|
import { resourceId as toResourceId7 } from "@semiont/core";
|
|
36564
|
-
import {
|
|
36771
|
+
import { createActorStateUnit } from "@semiont/api-client";
|
|
36565
36772
|
var ListenOptionsSchema = ApiOptionsSchema.extend({
|
|
36566
36773
|
args: external_exports.array(external_exports.string()).default([])
|
|
36567
36774
|
}).superRefine((val, ctx) => {
|
|
@@ -36587,7 +36794,7 @@ var ALL_EVENT_TYPES = [
|
|
|
36587
36794
|
"mark:unarchived",
|
|
36588
36795
|
"mark:entity-tag-added",
|
|
36589
36796
|
"mark:entity-tag-removed",
|
|
36590
|
-
"
|
|
36797
|
+
"frame:entity-type-added",
|
|
36591
36798
|
"job:started",
|
|
36592
36799
|
"job:progress",
|
|
36593
36800
|
"job:completed",
|
|
@@ -36602,7 +36809,7 @@ async function runListen(options) {
|
|
|
36602
36809
|
let eventCount = 0;
|
|
36603
36810
|
const label = isResourceScoped ? `Listening for events on resource ${rawResourceId}` : "Listening for global events";
|
|
36604
36811
|
if (!options.quiet) process.stderr.write(label + " (Ctrl-C to stop)\n");
|
|
36605
|
-
const actor =
|
|
36812
|
+
const actor = createActorStateUnit({
|
|
36606
36813
|
baseUrl: rawBusUrl,
|
|
36607
36814
|
token,
|
|
36608
36815
|
channels: isResourceScoped ? [] : [...ALL_EVENT_TYPES]
|
|
@@ -37365,15 +37572,15 @@ var OutputFormatter = class {
|
|
|
37365
37572
|
`;
|
|
37366
37573
|
}
|
|
37367
37574
|
}
|
|
37368
|
-
const
|
|
37369
|
-
if (options.verbose &&
|
|
37370
|
-
const resourceInfo = this.formatResourceId(
|
|
37575
|
+
const resourceId3 = result.extensions?.resources || result.resourceId;
|
|
37576
|
+
if (options.verbose && resourceId3) {
|
|
37577
|
+
const resourceInfo = this.formatResourceId(resourceId3);
|
|
37371
37578
|
if (resourceInfo) {
|
|
37372
37579
|
output += ` ${c.dim}resource: ${resourceInfo}${c.reset}
|
|
37373
37580
|
`;
|
|
37374
37581
|
}
|
|
37375
|
-
if (
|
|
37376
|
-
output += ` ${c.cyan}console: ${
|
|
37582
|
+
if (resourceId3.aws?.consoleUrl) {
|
|
37583
|
+
output += ` ${c.cyan}console: ${resourceId3.aws.consoleUrl}${c.reset}
|
|
37377
37584
|
`;
|
|
37378
37585
|
}
|
|
37379
37586
|
}
|
|
@@ -37549,43 +37756,43 @@ var OutputFormatter = class {
|
|
|
37549
37756
|
/**
|
|
37550
37757
|
* Format resource identifier for display
|
|
37551
37758
|
*/
|
|
37552
|
-
static formatResourceId(
|
|
37553
|
-
if (!
|
|
37554
|
-
if (
|
|
37555
|
-
if (
|
|
37556
|
-
if (
|
|
37557
|
-
const parts =
|
|
37558
|
-
return parts[parts.length - 1] ||
|
|
37559
|
-
}
|
|
37560
|
-
const arnParts =
|
|
37759
|
+
static formatResourceId(resourceId3) {
|
|
37760
|
+
if (!resourceId3) return "-";
|
|
37761
|
+
if (resourceId3.aws) {
|
|
37762
|
+
if (resourceId3.aws.arn) {
|
|
37763
|
+
if (resourceId3.aws.arn.includes("/")) {
|
|
37764
|
+
const parts = resourceId3.aws.arn.split("/");
|
|
37765
|
+
return parts[parts.length - 1] || resourceId3.aws.arn;
|
|
37766
|
+
}
|
|
37767
|
+
const arnParts = resourceId3.aws.arn.split(":");
|
|
37561
37768
|
const resourcePart = arnParts[arnParts.length - 1] || "";
|
|
37562
37769
|
if (resourcePart.includes("/")) {
|
|
37563
37770
|
const subParts = resourcePart.split("/");
|
|
37564
37771
|
return subParts[subParts.length - 1];
|
|
37565
37772
|
}
|
|
37566
|
-
return resourcePart ||
|
|
37773
|
+
return resourcePart || resourceId3.aws.name || "AWS";
|
|
37567
37774
|
}
|
|
37568
|
-
return
|
|
37775
|
+
return resourceId3.aws.id || resourceId3.aws.name || "AWS";
|
|
37569
37776
|
}
|
|
37570
|
-
if (
|
|
37571
|
-
const name =
|
|
37572
|
-
const id =
|
|
37777
|
+
if (resourceId3.container) {
|
|
37778
|
+
const name = resourceId3.container.name || "";
|
|
37779
|
+
const id = resourceId3.container.id ? resourceId3.container.id.substring(0, 12) : "";
|
|
37573
37780
|
if (name && id) {
|
|
37574
37781
|
return `${name}:${id}`;
|
|
37575
37782
|
}
|
|
37576
37783
|
return name || id || "Container";
|
|
37577
37784
|
}
|
|
37578
|
-
if (
|
|
37579
|
-
if (
|
|
37580
|
-
return `PID:${
|
|
37785
|
+
if (resourceId3.process) {
|
|
37786
|
+
if (resourceId3.process.pid) {
|
|
37787
|
+
return `PID:${resourceId3.process.pid}`;
|
|
37581
37788
|
}
|
|
37582
|
-
return
|
|
37789
|
+
return resourceId3.process.path || "Process";
|
|
37583
37790
|
}
|
|
37584
|
-
if (
|
|
37585
|
-
return
|
|
37791
|
+
if (resourceId3.external) {
|
|
37792
|
+
return resourceId3.external.endpoint || resourceId3.external.path || "External";
|
|
37586
37793
|
}
|
|
37587
|
-
if (
|
|
37588
|
-
return
|
|
37794
|
+
if (resourceId3.mock) {
|
|
37795
|
+
return resourceId3.mock.id || "Mock";
|
|
37589
37796
|
}
|
|
37590
37797
|
return "-";
|
|
37591
37798
|
}
|
|
@@ -37875,7 +38082,7 @@ async function generateGlobalHelp() {
|
|
|
37875
38082
|
}
|
|
37876
38083
|
|
|
37877
38084
|
// src/cli.ts
|
|
37878
|
-
var VERSION = "0.5.
|
|
38085
|
+
var VERSION = "0.5.2";
|
|
37879
38086
|
function printVersion() {
|
|
37880
38087
|
console.log(`Semiont CLI v${VERSION}`);
|
|
37881
38088
|
}
|