@semiont/cli 0.4.22 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +394 -287
- package/dist/frontend/dist/assets/{CookiePreferences-CPbRK2Nf.js → CookiePreferences-D5wgmVC7.js} +2 -2
- package/dist/frontend/dist/assets/{CookiePreferences-CPbRK2Nf.js.map → CookiePreferences-D5wgmVC7.js.map} +1 -1
- package/dist/frontend/dist/assets/{PdfAnnotationCanvas.client-5QESNO5H-CprYrfHh.js → PdfAnnotationCanvas.client-5QESNO5H-B7UjwjIX.js} +2 -2
- package/dist/frontend/dist/assets/{PdfAnnotationCanvas.client-5QESNO5H-CprYrfHh.js.map → PdfAnnotationCanvas.client-5QESNO5H-B7UjwjIX.js.map} +1 -1
- package/dist/frontend/dist/assets/{ToolbarPanels-CPoZvoTB.js → ToolbarPanels-CjWlSOUC.js} +2 -2
- package/dist/frontend/dist/assets/{ToolbarPanels-CPoZvoTB.js.map → ToolbarPanels-CjWlSOUC.js.map} +1 -1
- package/dist/frontend/dist/assets/{client-kS15_T5U.js → client-B-MtBLP9.js} +2 -2
- package/dist/frontend/dist/assets/{client-kS15_T5U.js.map → client-B-MtBLP9.js.map} +1 -1
- package/dist/frontend/dist/assets/{client-CPOjL49o.js → client-DX1ckM1P.js} +2 -2
- package/dist/frontend/dist/assets/{client-CPOjL49o.js.map → client-DX1ckM1P.js.map} +1 -1
- package/dist/frontend/dist/assets/{client-CCxdaxo8.js → client-Dh9ak8Fa.js} +2 -2
- package/dist/frontend/dist/assets/{client-CCxdaxo8.js.map → client-Dh9ak8Fa.js.map} +1 -1
- package/dist/frontend/dist/assets/{client-D04WIU14.js → client-DsP3tx7D.js} +2 -2
- package/dist/frontend/dist/assets/{client-D04WIU14.js.map → client-DsP3tx7D.js.map} +1 -1
- package/dist/frontend/dist/assets/{index-fHqJXd_A.css → index-Dg-Pampr.css} +1 -1
- package/dist/frontend/dist/assets/{index-Bsr9DJ3G.js → index-DoPpOINE.js} +57 -57
- package/dist/frontend/dist/assets/index-DoPpOINE.js.map +1 -0
- package/dist/frontend/dist/assets/{layout-w9wtEpkI.js → layout-BNfHKiGS.js} +2 -2
- package/dist/frontend/dist/assets/{layout-w9wtEpkI.js.map → layout-BNfHKiGS.js.map} +1 -1
- package/dist/frontend/dist/assets/{layout-DqFHhLVw.js → layout-CMpievJ_.js} +2 -2
- package/dist/frontend/dist/assets/{layout-DqFHhLVw.js.map → layout-CMpievJ_.js.map} +1 -1
- package/dist/frontend/dist/assets/{layout-BWesrQWr.js → layout-Delbhxmy.js} +2 -2
- package/dist/frontend/dist/assets/{layout-BWesrQWr.js.map → layout-Delbhxmy.js.map} +1 -1
- package/dist/frontend/dist/assets/{layout-B-lufx1s.js → layout-G6HeeKIH.js} +2 -2
- package/dist/frontend/dist/assets/{layout-B-lufx1s.js.map → layout-G6HeeKIH.js.map} +1 -1
- package/dist/frontend/dist/assets/{not-found-C0HTZoKU.js → not-found-CtwZrTVU.js} +2 -2
- package/dist/frontend/dist/assets/{not-found-C0HTZoKU.js.map → not-found-CtwZrTVU.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-BS88Xh4W.js → page-7nyyO6Jy.js} +2 -2
- package/dist/frontend/dist/assets/{page-BS88Xh4W.js.map → page-7nyyO6Jy.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-JI9gNkHU.js → page-BEhfXGas.js} +2 -2
- package/dist/frontend/dist/assets/{page-JI9gNkHU.js.map → page-BEhfXGas.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-CryPHwXI.js → page-Bb5SB6_Q.js} +2 -2
- package/dist/frontend/dist/assets/{page-CryPHwXI.js.map → page-Bb5SB6_Q.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-BIyG0SOs.js → page-CI8oLbhf.js} +2 -2
- package/dist/frontend/dist/assets/{page-BIyG0SOs.js.map → page-CI8oLbhf.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-C43cKrO_.js → page-CV0h_zZE.js} +2 -2
- package/dist/frontend/dist/assets/{page-C43cKrO_.js.map → page-CV0h_zZE.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-BoFYscYi.js → page-C_fIdKsk.js} +2 -2
- package/dist/frontend/dist/assets/{page-BoFYscYi.js.map → page-C_fIdKsk.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-CPL87vBZ.js → page-CjI_QXry.js} +2 -2
- package/dist/frontend/dist/assets/{page-CPL87vBZ.js.map → page-CjI_QXry.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-BMeXKClk.js → page-CkiQdVlI.js} +2 -2
- package/dist/frontend/dist/assets/{page-BMeXKClk.js.map → page-CkiQdVlI.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-CU11Rd_F.js → page-D5qkLwSn.js} +2 -2
- package/dist/frontend/dist/assets/{page-CU11Rd_F.js.map → page-D5qkLwSn.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-Dvw2I_gp.js → page-DBYS9qIU.js} +2 -2
- package/dist/frontend/dist/assets/{page-Dvw2I_gp.js.map → page-DBYS9qIU.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-DYOj954J.js → page-DBlue8Rh.js} +2 -2
- package/dist/frontend/dist/assets/{page-DYOj954J.js.map → page-DBlue8Rh.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-haUujHsJ.js → page-DSW3JQF2.js} +2 -2
- package/dist/frontend/dist/assets/{page-haUujHsJ.js.map → page-DSW3JQF2.js.map} +1 -1
- package/dist/frontend/dist/assets/page-DU909Np3.js +2 -0
- package/dist/frontend/dist/assets/{page-Du1JP0jA.js.map → page-DU909Np3.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-BzkBmeDS.js → page-DV9q0oju.js} +2 -2
- package/dist/frontend/dist/assets/{page-BzkBmeDS.js.map → page-DV9q0oju.js.map} +1 -1
- package/dist/frontend/dist/assets/{page--QmNUvGH.js → page-D_6K1M4j.js} +2 -2
- package/dist/frontend/dist/assets/{page--QmNUvGH.js.map → page-D_6K1M4j.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-CHCWv8gH.js → page-RgfG8Fre.js} +2 -2
- package/dist/frontend/dist/assets/{page-CHCWv8gH.js.map → page-RgfG8Fre.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-CN1zC8Ky.js → page-VPeYeXi6.js} +2 -2
- package/dist/frontend/dist/assets/{page-CN1zC8Ky.js.map → page-VPeYeXi6.js.map} +1 -1
- package/dist/frontend/dist/assets/{page-BkEdFy5p.js → page-kVSb0jfm.js} +2 -2
- package/dist/frontend/dist/assets/{page-BkEdFy5p.js.map → page-kVSb0jfm.js.map} +1 -1
- package/dist/frontend/dist/assets/{privacy-CZ8NTWnp.js → privacy-NaGU1hj4.js} +2 -2
- package/dist/frontend/dist/assets/{privacy-CZ8NTWnp.js.map → privacy-NaGU1hj4.js.map} +1 -1
- package/dist/frontend/dist/assets/{routing-D4iNsc7y.js → routing-BybXhU8X.js} +2 -2
- package/dist/frontend/dist/assets/{routing-D4iNsc7y.js.map → routing-BybXhU8X.js.map} +1 -1
- package/dist/frontend/dist/assets/{routing-DCIgrT7s.js → routing-o1npPvOW.js} +2 -2
- package/dist/frontend/dist/assets/{routing-DCIgrT7s.js.map → routing-o1npPvOW.js.map} +1 -1
- package/dist/frontend/dist/assets/{web-Ua5dIRkZ.js → web-DAOI6EsG.js} +2 -2
- package/dist/frontend/dist/assets/{web-Ua5dIRkZ.js.map → web-DAOI6EsG.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/index-Bsr9DJ3G.js.map +0 -1
- package/dist/frontend/dist/assets/page-Du1JP0jA.js +0 -2
package/dist/cli.mjs
CHANGED
|
@@ -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,7 +16922,8 @@ var require_operators = __commonJS({
|
|
|
16922
16922
|
});
|
|
16923
16923
|
|
|
16924
16924
|
// ../../packages/sdk/dist/index.js
|
|
16925
|
-
import { annotationId, resourceId, email, googleCredential, refreshToken, EventBus,
|
|
16925
|
+
import { SemiontError, annotationId, resourceId, email, googleCredential, refreshToken, EventBus, baseUrl, accessToken, isHighlight, isComment, isAssessment, isReference, isTag, decodeWithCharset, getPrimaryMediaType, userDID, 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";
|
|
16926
16927
|
import { HttpTransport, HttpContentTransport, createActorVM, APIError } from "@semiont/api-client";
|
|
16927
16928
|
import { APIError as APIError2, DEGRADED_THRESHOLD_MS, HttpContentTransport as HttpContentTransport2, HttpTransport as HttpTransport2, createActorVM as createActorVM2 } from "@semiont/api-client";
|
|
16928
16929
|
async function busRequest(bus, emitChannel, payload, resultChannel, failureChannel, timeoutMs = 3e4) {
|
|
@@ -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,50 @@ function createCache(fetchFn) {
|
|
|
17012
17035
|
}
|
|
17013
17036
|
};
|
|
17014
17037
|
}
|
|
17015
|
-
var import_rxjs, import_operators, BusRequestError, ENTITY_TYPES_KEY, BrowseNamespace, MarkNamespace, BindNamespace, GatherNamespace, MatchNamespace, YieldNamespace, BeckonNamespace, JobNamespace, AuthNamespace, AdminNamespace, SemiontClient, REFRESH_BEFORE_EXP_MS;
|
|
17038
|
+
var import_rxjs, import_operators, StreamObservable, CacheObservable, wrapperCache, BusRequestError, ENTITY_TYPES_KEY, BrowseNamespace, MarkNamespace, BindNamespace, GatherNamespace, MatchNamespace, YieldNamespace, BeckonNamespace, JobNamespace, AuthNamespace, AdminNamespace, SemiontClient, REFRESH_BEFORE_EXP_MS;
|
|
17016
17039
|
var init_dist = __esm({
|
|
17017
17040
|
"../../packages/sdk/dist/index.js"() {
|
|
17018
17041
|
"use strict";
|
|
17019
17042
|
import_rxjs = __toESM(require_cjs(), 1);
|
|
17020
17043
|
import_operators = __toESM(require_operators(), 1);
|
|
17021
|
-
|
|
17022
|
-
|
|
17023
|
-
|
|
17044
|
+
StreamObservable = class _StreamObservable extends import_rxjs.Observable {
|
|
17045
|
+
then(onfulfilled, onrejected) {
|
|
17046
|
+
return (0, import_rxjs.lastValueFrom)(this).then(onfulfilled, onrejected);
|
|
17047
|
+
}
|
|
17048
|
+
/** Wrap an existing Observable's subscribe behavior in a StreamObservable. */
|
|
17049
|
+
static from(source) {
|
|
17050
|
+
return new _StreamObservable((subscriber) => source.subscribe(subscriber));
|
|
17051
|
+
}
|
|
17052
|
+
};
|
|
17053
|
+
CacheObservable = class _CacheObservable extends import_rxjs.Observable {
|
|
17054
|
+
then(onfulfilled, onrejected) {
|
|
17055
|
+
return (0, import_rxjs.firstValueFrom)(this.pipe((0, import_operators.filter)((v) => v !== void 0))).then(onfulfilled, onrejected);
|
|
17056
|
+
}
|
|
17057
|
+
/**
|
|
17058
|
+
* Wrap an existing Observable's subscribe behavior in a `CacheObservable`.
|
|
17059
|
+
*
|
|
17060
|
+
* Memoizes on source identity: passing the same `source` returns the same
|
|
17061
|
+
* wrapper instance. The Browse cache primitive already returns a stable
|
|
17062
|
+
* Observable per key (its B4 contract), so this preserves that contract
|
|
17063
|
+
* through the awaitable wrapping. Without the memo, every public-method
|
|
17064
|
+
* call would produce a fresh wrapper and break referential-equality
|
|
17065
|
+
* guarantees that React-side consumers depend on.
|
|
17066
|
+
*
|
|
17067
|
+
* Backed by a `WeakMap`, so wrappers are GC'd when their source is.
|
|
17068
|
+
*/
|
|
17069
|
+
static from(source) {
|
|
17070
|
+
let wrapper = wrapperCache.get(source);
|
|
17071
|
+
if (!wrapper) {
|
|
17072
|
+
wrapper = new _CacheObservable((subscriber) => source.subscribe(subscriber));
|
|
17073
|
+
wrapperCache.set(source, wrapper);
|
|
17074
|
+
}
|
|
17075
|
+
return wrapper;
|
|
17076
|
+
}
|
|
17077
|
+
};
|
|
17078
|
+
wrapperCache = /* @__PURE__ */ new WeakMap();
|
|
17079
|
+
BusRequestError = class extends SemiontError {
|
|
17080
|
+
constructor(message, code, details) {
|
|
17081
|
+
super(message, code, details);
|
|
17024
17082
|
this.name = "BusRequestError";
|
|
17025
17083
|
}
|
|
17026
17084
|
};
|
|
@@ -17030,11 +17088,6 @@ var init_dist = __esm({
|
|
|
17030
17088
|
this.transport = transport;
|
|
17031
17089
|
this.bus = bus;
|
|
17032
17090
|
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
17091
|
this.resourceCache = createCache(async (id) => {
|
|
17039
17092
|
const result = await busRequest(
|
|
17040
17093
|
this.transport,
|
|
@@ -17057,32 +17110,30 @@ var init_dist = __esm({
|
|
|
17057
17110
|
);
|
|
17058
17111
|
return result.resources;
|
|
17059
17112
|
});
|
|
17060
|
-
this.annotationListCache = createCache(async (
|
|
17113
|
+
this.annotationListCache = createCache(async (resourceId22) => {
|
|
17061
17114
|
return busRequest(
|
|
17062
17115
|
this.transport,
|
|
17063
17116
|
"browse:annotations-requested",
|
|
17064
|
-
{ resourceId:
|
|
17117
|
+
{ resourceId: resourceId22 },
|
|
17065
17118
|
"browse:annotations-result",
|
|
17066
17119
|
"browse:annotations-failed"
|
|
17067
17120
|
);
|
|
17068
17121
|
});
|
|
17069
|
-
this.annotationDetailCache = createCache(async (
|
|
17070
|
-
const
|
|
17071
|
-
if (!
|
|
17072
|
-
throw new Error(`Cannot fetch annotation ${
|
|
17122
|
+
this.annotationDetailCache = createCache(async (annotationId22) => {
|
|
17123
|
+
const resourceId22 = this.annotationResources.get(annotationId22);
|
|
17124
|
+
if (!resourceId22) {
|
|
17125
|
+
throw new Error(`Cannot fetch annotation ${annotationId22}: no resourceId known`);
|
|
17073
17126
|
}
|
|
17074
17127
|
const result = await busRequest(
|
|
17075
17128
|
this.transport,
|
|
17076
17129
|
"browse:annotation-requested",
|
|
17077
|
-
{ resourceId:
|
|
17130
|
+
{ resourceId: resourceId22, annotationId: annotationId22 },
|
|
17078
17131
|
"browse:annotation-result",
|
|
17079
17132
|
"browse:annotation-failed"
|
|
17080
17133
|
);
|
|
17081
17134
|
return result.annotation;
|
|
17082
17135
|
});
|
|
17083
17136
|
this.entityTypesCache = createCache(async () => {
|
|
17084
|
-
const serial = this.__serial__;
|
|
17085
|
-
console.debug(`[diag] BrowseNamespace#${serial} entityTypes fetchFn START`);
|
|
17086
17137
|
const result = await busRequest(
|
|
17087
17138
|
this.transport,
|
|
17088
17139
|
"browse:entity-types-requested",
|
|
@@ -17090,24 +17141,23 @@ var init_dist = __esm({
|
|
|
17090
17141
|
"browse:entity-types-result",
|
|
17091
17142
|
"browse:entity-types-failed"
|
|
17092
17143
|
);
|
|
17093
|
-
console.debug(`[diag] BrowseNamespace#${serial} entityTypes fetchFn RESOLVE`, JSON.stringify(result.entityTypes).slice(0, 200));
|
|
17094
17144
|
return result.entityTypes;
|
|
17095
17145
|
});
|
|
17096
|
-
this.referencedByCache = createCache(async (
|
|
17146
|
+
this.referencedByCache = createCache(async (resourceId22) => {
|
|
17097
17147
|
const result = await busRequest(
|
|
17098
17148
|
this.transport,
|
|
17099
17149
|
"browse:referenced-by-requested",
|
|
17100
|
-
{ resourceId:
|
|
17150
|
+
{ resourceId: resourceId22 },
|
|
17101
17151
|
"browse:referenced-by-result",
|
|
17102
17152
|
"browse:referenced-by-failed"
|
|
17103
17153
|
);
|
|
17104
17154
|
return result.referencedBy;
|
|
17105
17155
|
});
|
|
17106
|
-
this.resourceEventsCache = createCache(async (
|
|
17156
|
+
this.resourceEventsCache = createCache(async (resourceId22) => {
|
|
17107
17157
|
const result = await busRequest(
|
|
17108
17158
|
this.transport,
|
|
17109
17159
|
"browse:events-requested",
|
|
17110
|
-
{ resourceId:
|
|
17160
|
+
{ resourceId: resourceId22 },
|
|
17111
17161
|
"browse:events-result",
|
|
17112
17162
|
"browse:events-failed"
|
|
17113
17163
|
);
|
|
@@ -17119,7 +17169,7 @@ var init_dist = __esm({
|
|
|
17119
17169
|
//
|
|
17120
17170
|
// Each cache encapsulates the BehaviorSubject store, in-flight guard,
|
|
17121
17171
|
// and per-key observable memoization that was previously open-coded
|
|
17122
|
-
// here. Behavioral contract: `packages/
|
|
17172
|
+
// here. Behavioral contract: `packages/sdk/docs/CACHE-SEMANTICS.md`.
|
|
17123
17173
|
//
|
|
17124
17174
|
// Public surface (`resource()`, `annotations()`, etc.) is unchanged;
|
|
17125
17175
|
// the caches are an implementation detail of this namespace.
|
|
@@ -17151,71 +17201,66 @@ var init_dist = __esm({
|
|
|
17151
17201
|
*/
|
|
17152
17202
|
annotationListObs = /* @__PURE__ */ new Map();
|
|
17153
17203
|
// ── Live queries ────────────────────────────────────────────────────────
|
|
17154
|
-
|
|
17155
|
-
|
|
17204
|
+
//
|
|
17205
|
+
// These return `CacheObservable<T>`: subscribers see `T | undefined`
|
|
17206
|
+
// (with `undefined` during initial load), and `await` resolves to the
|
|
17207
|
+
// first non-undefined value.
|
|
17208
|
+
resource(resourceId22) {
|
|
17209
|
+
return CacheObservable.from(this.resourceCache.observe(resourceId22));
|
|
17156
17210
|
}
|
|
17157
17211
|
resources(filters) {
|
|
17158
17212
|
const key = JSON.stringify(filters ?? {});
|
|
17159
17213
|
this.resourceListFilters.set(key, filters ?? {});
|
|
17160
|
-
return this.resourceListCache.observe(key);
|
|
17214
|
+
return CacheObservable.from(this.resourceListCache.observe(key));
|
|
17161
17215
|
}
|
|
17162
|
-
annotations(
|
|
17163
|
-
let obs = this.annotationListObs.get(
|
|
17216
|
+
annotations(resourceId22) {
|
|
17217
|
+
let obs = this.annotationListObs.get(resourceId22);
|
|
17164
17218
|
if (!obs) {
|
|
17165
|
-
obs = this.annotationListCache.observe(
|
|
17166
|
-
this.annotationListObs.set(
|
|
17219
|
+
obs = this.annotationListCache.observe(resourceId22).pipe((0, import_rxjs.map)((r) => r?.annotations));
|
|
17220
|
+
this.annotationListObs.set(resourceId22, obs);
|
|
17167
17221
|
}
|
|
17168
|
-
return obs;
|
|
17222
|
+
return CacheObservable.from(obs);
|
|
17169
17223
|
}
|
|
17170
|
-
annotation(
|
|
17171
|
-
this.annotationResources.set(
|
|
17172
|
-
return this.annotationDetailCache.observe(
|
|
17224
|
+
annotation(resourceId22, annotationId22) {
|
|
17225
|
+
this.annotationResources.set(annotationId22, resourceId22);
|
|
17226
|
+
return CacheObservable.from(this.annotationDetailCache.observe(annotationId22));
|
|
17173
17227
|
}
|
|
17174
17228
|
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__;
|
|
17229
|
+
return CacheObservable.from(this.entityTypesCache.observe(ENTITY_TYPES_KEY));
|
|
17185
17230
|
}
|
|
17186
|
-
referencedBy(
|
|
17187
|
-
return this.referencedByCache.observe(
|
|
17231
|
+
referencedBy(resourceId22) {
|
|
17232
|
+
return CacheObservable.from(this.referencedByCache.observe(resourceId22));
|
|
17188
17233
|
}
|
|
17189
|
-
events(
|
|
17190
|
-
return this.resourceEventsCache.observe(
|
|
17234
|
+
events(resourceId22) {
|
|
17235
|
+
return CacheObservable.from(this.resourceEventsCache.observe(resourceId22));
|
|
17191
17236
|
}
|
|
17192
17237
|
// ── One-shot reads ──────────────────────────────────────────────────────
|
|
17193
|
-
async resourceContent(
|
|
17194
|
-
const result = await this.content.getBinary(
|
|
17238
|
+
async resourceContent(resourceId22) {
|
|
17239
|
+
const result = await this.content.getBinary(resourceId22, { accept: "text/plain" });
|
|
17195
17240
|
const decoder = new TextDecoder();
|
|
17196
17241
|
return decoder.decode(result.data);
|
|
17197
17242
|
}
|
|
17198
|
-
async resourceRepresentation(
|
|
17199
|
-
return this.content.getBinary(
|
|
17243
|
+
async resourceRepresentation(resourceId22, options) {
|
|
17244
|
+
return this.content.getBinary(resourceId22, options?.accept ? { accept: options.accept } : void 0);
|
|
17200
17245
|
}
|
|
17201
|
-
async resourceRepresentationStream(
|
|
17202
|
-
return this.content.getBinaryStream(
|
|
17246
|
+
async resourceRepresentationStream(resourceId22, options) {
|
|
17247
|
+
return this.content.getBinaryStream(resourceId22, options?.accept ? { accept: options.accept } : void 0);
|
|
17203
17248
|
}
|
|
17204
|
-
async resourceEvents(
|
|
17249
|
+
async resourceEvents(resourceId22) {
|
|
17205
17250
|
const result = await busRequest(
|
|
17206
17251
|
this.transport,
|
|
17207
17252
|
"browse:events-requested",
|
|
17208
|
-
{ resourceId:
|
|
17253
|
+
{ resourceId: resourceId22 },
|
|
17209
17254
|
"browse:events-result",
|
|
17210
17255
|
"browse:events-failed"
|
|
17211
17256
|
);
|
|
17212
17257
|
return result.events;
|
|
17213
17258
|
}
|
|
17214
|
-
async annotationHistory(
|
|
17259
|
+
async annotationHistory(resourceId22, annotationId22) {
|
|
17215
17260
|
return busRequest(
|
|
17216
17261
|
this.transport,
|
|
17217
17262
|
"browse:annotation-history-requested",
|
|
17218
|
-
{ resourceId:
|
|
17263
|
+
{ resourceId: resourceId22, annotationId: annotationId22 },
|
|
17219
17264
|
"browse:annotation-history-result",
|
|
17220
17265
|
"browse:annotation-history-failed"
|
|
17221
17266
|
);
|
|
@@ -17239,11 +17284,11 @@ var init_dist = __esm({
|
|
|
17239
17284
|
);
|
|
17240
17285
|
}
|
|
17241
17286
|
// ── UI signals (local bus fan-out) ────────────────────────────────────
|
|
17242
|
-
click(
|
|
17243
|
-
this.bus.get("browse:click").next({ annotationId:
|
|
17287
|
+
click(annotationId22, motivation) {
|
|
17288
|
+
this.bus.get("browse:click").next({ annotationId: annotationId22, motivation });
|
|
17244
17289
|
}
|
|
17245
|
-
navigateReference(
|
|
17246
|
-
this.bus.get("browse:reference-navigate").next({ resourceId:
|
|
17290
|
+
navigateReference(resourceId22) {
|
|
17291
|
+
this.bus.get("browse:reference-navigate").next({ resourceId: resourceId22 });
|
|
17247
17292
|
}
|
|
17248
17293
|
// ── Cache-mutation API (used by the bus-event subscribers below and by
|
|
17249
17294
|
// other namespaces that know about specific updates) ─────────────────
|
|
@@ -17251,12 +17296,12 @@ var init_dist = __esm({
|
|
|
17251
17296
|
// - `invalidate*` — SWR refetch (B7). Keeps prior value visible.
|
|
17252
17297
|
// - `removeAnnotationDetail` — drops the entry (B13a: entity gone).
|
|
17253
17298
|
// - `updateAnnotationInPlace` — write-through (B13b: new value known).
|
|
17254
|
-
invalidateAnnotationList(
|
|
17255
|
-
this.annotationListCache.invalidate(
|
|
17299
|
+
invalidateAnnotationList(resourceId22) {
|
|
17300
|
+
this.annotationListCache.invalidate(resourceId22);
|
|
17256
17301
|
}
|
|
17257
|
-
removeAnnotationDetail(
|
|
17258
|
-
this.annotationDetailCache.remove(
|
|
17259
|
-
this.annotationResources.delete(
|
|
17302
|
+
removeAnnotationDetail(annotationId22) {
|
|
17303
|
+
this.annotationDetailCache.remove(annotationId22);
|
|
17304
|
+
this.annotationResources.delete(annotationId22);
|
|
17260
17305
|
}
|
|
17261
17306
|
invalidateResourceDetail(id) {
|
|
17262
17307
|
this.resourceCache.invalidate(id);
|
|
@@ -17267,21 +17312,21 @@ var init_dist = __esm({
|
|
|
17267
17312
|
invalidateEntityTypes() {
|
|
17268
17313
|
this.entityTypesCache.invalidate(ENTITY_TYPES_KEY);
|
|
17269
17314
|
}
|
|
17270
|
-
invalidateReferencedBy(
|
|
17271
|
-
this.referencedByCache.invalidate(
|
|
17315
|
+
invalidateReferencedBy(resourceId22) {
|
|
17316
|
+
this.referencedByCache.invalidate(resourceId22);
|
|
17272
17317
|
}
|
|
17273
|
-
invalidateResourceEvents(
|
|
17274
|
-
this.resourceEventsCache.invalidate(
|
|
17318
|
+
invalidateResourceEvents(resourceId22) {
|
|
17319
|
+
this.resourceEventsCache.invalidate(resourceId22);
|
|
17275
17320
|
}
|
|
17276
|
-
updateAnnotationInPlace(
|
|
17277
|
-
const currentList = this.annotationListCache.get(
|
|
17321
|
+
updateAnnotationInPlace(resourceId22, annotation) {
|
|
17322
|
+
const currentList = this.annotationListCache.get(resourceId22);
|
|
17278
17323
|
if (currentList) {
|
|
17279
17324
|
const idx = currentList.annotations.findIndex((a) => a.id === annotation.id);
|
|
17280
17325
|
const nextAnnotations = idx >= 0 ? currentList.annotations.map((a, i) => i === idx ? annotation : a) : [...currentList.annotations, annotation];
|
|
17281
|
-
this.annotationListCache.set(
|
|
17326
|
+
this.annotationListCache.set(resourceId22, { ...currentList, annotations: nextAnnotations });
|
|
17282
17327
|
}
|
|
17283
17328
|
const aId = annotationId(annotation.id);
|
|
17284
|
-
this.annotationResources.set(aId,
|
|
17329
|
+
this.annotationResources.set(aId, resourceId22);
|
|
17285
17330
|
this.annotationDetailCache.set(aId, annotation);
|
|
17286
17331
|
}
|
|
17287
17332
|
// ── EventBus subscriptions ──────────────────────────────────────────────
|
|
@@ -17385,17 +17430,18 @@ var init_dist = __esm({
|
|
|
17385
17430
|
this.transport = transport;
|
|
17386
17431
|
this.bus = bus;
|
|
17387
17432
|
}
|
|
17388
|
-
async annotation(
|
|
17389
|
-
|
|
17433
|
+
async annotation(resourceId22, input) {
|
|
17434
|
+
const result = await busRequest(
|
|
17390
17435
|
this.transport,
|
|
17391
17436
|
"mark:create-request",
|
|
17392
|
-
{ resourceId:
|
|
17437
|
+
{ resourceId: resourceId22, request: input },
|
|
17393
17438
|
"mark:create-ok",
|
|
17394
17439
|
"mark:create-failed"
|
|
17395
17440
|
);
|
|
17441
|
+
return { annotationId: annotationId(result.annotationId) };
|
|
17396
17442
|
}
|
|
17397
|
-
async delete(
|
|
17398
|
-
await this.transport.emit("mark:delete", { annotationId:
|
|
17443
|
+
async delete(resourceId22, annotationId22) {
|
|
17444
|
+
await this.transport.emit("mark:delete", { annotationId: annotationId22, resourceId: resourceId22 });
|
|
17399
17445
|
}
|
|
17400
17446
|
async entityType(type2) {
|
|
17401
17447
|
await this.transport.emit("mark:add-entity-type", { tag: type2 });
|
|
@@ -17405,14 +17451,14 @@ var init_dist = __esm({
|
|
|
17405
17451
|
await this.transport.emit("mark:add-entity-type", { tag });
|
|
17406
17452
|
}
|
|
17407
17453
|
}
|
|
17408
|
-
async archive(
|
|
17409
|
-
await this.transport.emit("mark:archive", { resourceId:
|
|
17454
|
+
async archive(resourceId22) {
|
|
17455
|
+
await this.transport.emit("mark:archive", { resourceId: resourceId22 });
|
|
17410
17456
|
}
|
|
17411
|
-
async unarchive(
|
|
17412
|
-
await this.transport.emit("mark:unarchive", { resourceId:
|
|
17457
|
+
async unarchive(resourceId22) {
|
|
17458
|
+
await this.transport.emit("mark:unarchive", { resourceId: resourceId22 });
|
|
17413
17459
|
}
|
|
17414
|
-
assist(
|
|
17415
|
-
return new
|
|
17460
|
+
assist(resourceId22, motivation, options) {
|
|
17461
|
+
return new StreamObservable((subscriber) => {
|
|
17416
17462
|
let done = false;
|
|
17417
17463
|
let pollTimer = null;
|
|
17418
17464
|
let pollInterval = null;
|
|
@@ -17452,7 +17498,7 @@ var init_dist = __esm({
|
|
|
17452
17498
|
data: {
|
|
17453
17499
|
jobId,
|
|
17454
17500
|
jobType: status.jobType ?? "annotation",
|
|
17455
|
-
resourceId:
|
|
17501
|
+
resourceId: resourceId22,
|
|
17456
17502
|
result: status.result
|
|
17457
17503
|
}
|
|
17458
17504
|
});
|
|
@@ -17489,7 +17535,7 @@ var init_dist = __esm({
|
|
|
17489
17535
|
cleanup();
|
|
17490
17536
|
subscriber.error(new Error(e.error));
|
|
17491
17537
|
});
|
|
17492
|
-
this.dispatchAssist(
|
|
17538
|
+
this.dispatchAssist(resourceId22, motivation, options).then(({ jobId }) => {
|
|
17493
17539
|
if (jobId && !done) {
|
|
17494
17540
|
activeJobId = jobId;
|
|
17495
17541
|
resetPollTimer(jobId);
|
|
@@ -17537,7 +17583,7 @@ var init_dist = __esm({
|
|
|
17537
17583
|
toggleMode() {
|
|
17538
17584
|
this.bus.get("mark:mode-toggled").next(void 0);
|
|
17539
17585
|
}
|
|
17540
|
-
async dispatchAssist(
|
|
17586
|
+
async dispatchAssist(resourceId22, motivation, options) {
|
|
17541
17587
|
const jobTypeMap = {
|
|
17542
17588
|
tagging: "tag-annotation",
|
|
17543
17589
|
linking: "reference-annotation",
|
|
@@ -17564,7 +17610,7 @@ var init_dist = __esm({
|
|
|
17564
17610
|
return busRequest(
|
|
17565
17611
|
this.transport,
|
|
17566
17612
|
"job:create",
|
|
17567
|
-
{ jobType, resourceId:
|
|
17613
|
+
{ jobType, resourceId: resourceId22, params },
|
|
17568
17614
|
"job:created",
|
|
17569
17615
|
"job:create-failed"
|
|
17570
17616
|
);
|
|
@@ -17575,11 +17621,11 @@ var init_dist = __esm({
|
|
|
17575
17621
|
this.transport = transport;
|
|
17576
17622
|
this.bus = bus;
|
|
17577
17623
|
}
|
|
17578
|
-
async body(
|
|
17624
|
+
async body(resourceId22, annotationId22, operations) {
|
|
17579
17625
|
await this.transport.emit("bind:update-body", {
|
|
17580
17626
|
correlationId: crypto.randomUUID(),
|
|
17581
|
-
annotationId:
|
|
17582
|
-
resourceId:
|
|
17627
|
+
annotationId: annotationId22,
|
|
17628
|
+
resourceId: resourceId22,
|
|
17583
17629
|
operations
|
|
17584
17630
|
});
|
|
17585
17631
|
}
|
|
@@ -17592,8 +17638,8 @@ var init_dist = __esm({
|
|
|
17592
17638
|
this.transport = transport;
|
|
17593
17639
|
this.bus = bus;
|
|
17594
17640
|
}
|
|
17595
|
-
annotation(
|
|
17596
|
-
return new
|
|
17641
|
+
annotation(annotationId22, resourceId22, options) {
|
|
17642
|
+
return new StreamObservable((subscriber) => {
|
|
17597
17643
|
const correlationId = crypto.randomUUID();
|
|
17598
17644
|
const complete$ = this.bus.get("gather:complete").pipe(
|
|
17599
17645
|
(0, import_operators.filter)((e) => e.correlationId === correlationId)
|
|
@@ -17603,7 +17649,7 @@ var init_dist = __esm({
|
|
|
17603
17649
|
);
|
|
17604
17650
|
const sub = (0, import_rxjs.merge)(
|
|
17605
17651
|
this.bus.get("gather:annotation-progress").pipe(
|
|
17606
|
-
(0, import_operators.filter)((e) => e.annotationId ===
|
|
17652
|
+
(0, import_operators.filter)((e) => e.annotationId === annotationId22),
|
|
17607
17653
|
(0, import_operators.map)((e) => e)
|
|
17608
17654
|
),
|
|
17609
17655
|
complete$.pipe((0, import_operators.map)((e) => e))
|
|
@@ -17620,8 +17666,8 @@ var init_dist = __esm({
|
|
|
17620
17666
|
});
|
|
17621
17667
|
this.transport.emit("gather:requested", {
|
|
17622
17668
|
correlationId,
|
|
17623
|
-
annotationId:
|
|
17624
|
-
resourceId:
|
|
17669
|
+
annotationId: annotationId22,
|
|
17670
|
+
resourceId: resourceId22,
|
|
17625
17671
|
options: { contextWindow: options?.contextWindow ?? 2e3 }
|
|
17626
17672
|
}).catch((error) => {
|
|
17627
17673
|
subscriber.error(error);
|
|
@@ -17645,8 +17691,8 @@ var init_dist = __esm({
|
|
|
17645
17691
|
requestSearch(input) {
|
|
17646
17692
|
this.bus.get("match:search-requested").next(input);
|
|
17647
17693
|
}
|
|
17648
|
-
search(
|
|
17649
|
-
return new
|
|
17694
|
+
search(resourceId22, referenceId, context, options) {
|
|
17695
|
+
return new StreamObservable((subscriber) => {
|
|
17650
17696
|
const correlationId = crypto.randomUUID();
|
|
17651
17697
|
const result$ = this.bus.get("match:search-results").pipe(
|
|
17652
17698
|
(0, import_operators.filter)((e) => e.correlationId === correlationId)
|
|
@@ -17663,7 +17709,7 @@ var init_dist = __esm({
|
|
|
17663
17709
|
});
|
|
17664
17710
|
this.transport.emit("match:search-requested", {
|
|
17665
17711
|
correlationId,
|
|
17666
|
-
resourceId:
|
|
17712
|
+
resourceId: resourceId22,
|
|
17667
17713
|
referenceId,
|
|
17668
17714
|
context,
|
|
17669
17715
|
limit: options?.limit ?? 10,
|
|
@@ -17701,8 +17747,8 @@ var init_dist = __esm({
|
|
|
17701
17747
|
});
|
|
17702
17748
|
return { resourceId: result.resourceId };
|
|
17703
17749
|
}
|
|
17704
|
-
fromAnnotation(
|
|
17705
|
-
return new
|
|
17750
|
+
fromAnnotation(resourceId22, annotationId22, options) {
|
|
17751
|
+
return new StreamObservable((subscriber) => {
|
|
17706
17752
|
let done = false;
|
|
17707
17753
|
let pollTimer = null;
|
|
17708
17754
|
let pollInterval = null;
|
|
@@ -17742,7 +17788,7 @@ var init_dist = __esm({
|
|
|
17742
17788
|
data: {
|
|
17743
17789
|
jobId: jid,
|
|
17744
17790
|
jobType: status.jobType ?? "generation",
|
|
17745
|
-
resourceId:
|
|
17791
|
+
resourceId: resourceId22,
|
|
17746
17792
|
result: status.result
|
|
17747
17793
|
}
|
|
17748
17794
|
});
|
|
@@ -17784,9 +17830,9 @@ var init_dist = __esm({
|
|
|
17784
17830
|
"job:create",
|
|
17785
17831
|
{
|
|
17786
17832
|
jobType: "generation",
|
|
17787
|
-
resourceId:
|
|
17833
|
+
resourceId: resourceId22,
|
|
17788
17834
|
params: {
|
|
17789
|
-
referenceId:
|
|
17835
|
+
referenceId: annotationId22,
|
|
17790
17836
|
title: options.title,
|
|
17791
17837
|
prompt: options.prompt,
|
|
17792
17838
|
language: options.language,
|
|
@@ -17815,11 +17861,11 @@ var init_dist = __esm({
|
|
|
17815
17861
|
};
|
|
17816
17862
|
});
|
|
17817
17863
|
}
|
|
17818
|
-
async cloneToken(
|
|
17864
|
+
async cloneToken(resourceId22) {
|
|
17819
17865
|
return busRequest(
|
|
17820
17866
|
this.transport,
|
|
17821
17867
|
"yield:clone-token-requested",
|
|
17822
|
-
{ resourceId:
|
|
17868
|
+
{ resourceId: resourceId22 },
|
|
17823
17869
|
"yield:clone-token-generated",
|
|
17824
17870
|
"yield:clone-token-failed"
|
|
17825
17871
|
);
|
|
@@ -17852,14 +17898,14 @@ var init_dist = __esm({
|
|
|
17852
17898
|
this.transport = transport;
|
|
17853
17899
|
this.bus = bus;
|
|
17854
17900
|
}
|
|
17855
|
-
attention(
|
|
17856
|
-
void this.transport.emit("beckon:focus", { annotationId:
|
|
17901
|
+
attention(annotationId22, resourceId22) {
|
|
17902
|
+
void this.transport.emit("beckon:focus", { annotationId: annotationId22, resourceId: resourceId22 });
|
|
17857
17903
|
}
|
|
17858
|
-
hover(
|
|
17859
|
-
this.bus.get("beckon:hover").next({ annotationId:
|
|
17904
|
+
hover(annotationId22) {
|
|
17905
|
+
this.bus.get("beckon:hover").next({ annotationId: annotationId22 });
|
|
17860
17906
|
}
|
|
17861
|
-
sparkle(
|
|
17862
|
-
this.bus.get("beckon:sparkle").next({ annotationId:
|
|
17907
|
+
sparkle(annotationId22) {
|
|
17908
|
+
this.bus.get("beckon:sparkle").next({ annotationId: annotationId22 });
|
|
17863
17909
|
}
|
|
17864
17910
|
};
|
|
17865
17911
|
JobNamespace = class {
|
|
@@ -17946,8 +17992,8 @@ var init_dist = __esm({
|
|
|
17946
17992
|
async mcpToken() {
|
|
17947
17993
|
return this.transport.generateMcpToken();
|
|
17948
17994
|
}
|
|
17949
|
-
async mediaToken(
|
|
17950
|
-
return this.transport.getMediaToken(
|
|
17995
|
+
async mediaToken(resourceId22) {
|
|
17996
|
+
return this.transport.getMediaToken(resourceId22);
|
|
17951
17997
|
}
|
|
17952
17998
|
};
|
|
17953
17999
|
AdminNamespace = class {
|
|
@@ -17961,8 +18007,8 @@ var init_dist = __esm({
|
|
|
17961
18007
|
async userStats() {
|
|
17962
18008
|
return this.transport.getUserStats();
|
|
17963
18009
|
}
|
|
17964
|
-
async updateUser(
|
|
17965
|
-
const result = await this.transport.updateUser(
|
|
18010
|
+
async updateUser(userId2, data) {
|
|
18011
|
+
const result = await this.transport.updateUser(userId2, data);
|
|
17966
18012
|
return result.user;
|
|
17967
18013
|
}
|
|
17968
18014
|
async oauthConfig() {
|
|
@@ -17987,7 +18033,7 @@ var init_dist = __esm({
|
|
|
17987
18033
|
return this.transport.importKnowledgeBase(file, onProgress);
|
|
17988
18034
|
}
|
|
17989
18035
|
};
|
|
17990
|
-
SemiontClient = class {
|
|
18036
|
+
SemiontClient = class _SemiontClient {
|
|
17991
18037
|
/**
|
|
17992
18038
|
* The wire-facing transport. Owns bus actor, HTTP, auth, admin, exchange,
|
|
17993
18039
|
* system. Exposed for advanced consumers (workers, custom job adapters)
|
|
@@ -18050,13 +18096,74 @@ var init_dist = __esm({
|
|
|
18050
18096
|
get state$() {
|
|
18051
18097
|
return this.transport.state$;
|
|
18052
18098
|
}
|
|
18053
|
-
subscribeToResource(
|
|
18054
|
-
return this.transport.subscribeToResource(
|
|
18099
|
+
subscribeToResource(resourceId22) {
|
|
18100
|
+
return this.transport.subscribeToResource(resourceId22);
|
|
18055
18101
|
}
|
|
18056
18102
|
dispose() {
|
|
18057
18103
|
this.transport.dispose();
|
|
18058
18104
|
this.content.dispose();
|
|
18059
18105
|
}
|
|
18106
|
+
/**
|
|
18107
|
+
* Convenience factory for the default HTTP setup. Constructs a
|
|
18108
|
+
* `BehaviorSubject<AccessToken | null>` internally, plus an
|
|
18109
|
+
* `HttpTransport` and `HttpContentTransport`, and returns the wired
|
|
18110
|
+
* `SemiontClient`.
|
|
18111
|
+
*
|
|
18112
|
+
* Use this for one-shot scripts, CLI commands, or any consumer that
|
|
18113
|
+
* doesn't need to drive the token from outside (no manual refresh,
|
|
18114
|
+
* no cross-tab sync). For long-running scripts that need refresh,
|
|
18115
|
+
* use `SemiontSession.fromHttp(...)` instead — it owns the same
|
|
18116
|
+
* transport/client wiring plus the proactive-refresh + storage
|
|
18117
|
+
* machinery.
|
|
18118
|
+
*
|
|
18119
|
+
* Strings are accepted for `baseUrl` and `token`; they are branded
|
|
18120
|
+
* via `baseUrl()` / `accessToken()` from `@semiont/core` automatically.
|
|
18121
|
+
* Pass the already-branded values if you have them.
|
|
18122
|
+
*
|
|
18123
|
+
* Omit `token` for unauthenticated usage (public endpoints only).
|
|
18124
|
+
*/
|
|
18125
|
+
static fromHttp(opts) {
|
|
18126
|
+
const url = typeof opts.baseUrl === "string" ? baseUrl(opts.baseUrl) : opts.baseUrl;
|
|
18127
|
+
const tok = opts.token == null ? null : typeof opts.token === "string" ? accessToken(opts.token) : opts.token;
|
|
18128
|
+
const token$ = new import_rxjs.BehaviorSubject(tok);
|
|
18129
|
+
const transport = new HttpTransport({ baseUrl: url, token$ });
|
|
18130
|
+
const content = new HttpContentTransport(transport);
|
|
18131
|
+
return new _SemiontClient(transport, content);
|
|
18132
|
+
}
|
|
18133
|
+
/**
|
|
18134
|
+
* Async factory for the credentials-first script case. Builds a
|
|
18135
|
+
* transient transport, calls `auth.password(email, password)` to
|
|
18136
|
+
* acquire an access token, and returns the wired client with the
|
|
18137
|
+
* token populated.
|
|
18138
|
+
*
|
|
18139
|
+
* This is the right entry point for skills, CLI scripts, and any
|
|
18140
|
+
* consumer that starts with email + password rather than a JWT
|
|
18141
|
+
* already on hand. For consumers that already hold a token (CLI
|
|
18142
|
+
* cached-token path, env-var token, embedded auth flow), use
|
|
18143
|
+
* `fromHttp({ baseUrl, token })` instead.
|
|
18144
|
+
*
|
|
18145
|
+
* For long-running scripts that need refresh, use
|
|
18146
|
+
* `SemiontSession.signIn(...)` — same credentials shape, plus the
|
|
18147
|
+
* session machinery for proactive refresh and persistence.
|
|
18148
|
+
*
|
|
18149
|
+
* Throws if authentication fails. The transient client is disposed
|
|
18150
|
+
* before the throw, so no resources leak on failure.
|
|
18151
|
+
*/
|
|
18152
|
+
static async signIn(opts) {
|
|
18153
|
+
const url = typeof opts.baseUrl === "string" ? baseUrl(opts.baseUrl) : opts.baseUrl;
|
|
18154
|
+
const token$ = new import_rxjs.BehaviorSubject(null);
|
|
18155
|
+
const transport = new HttpTransport({ baseUrl: url, token$ });
|
|
18156
|
+
const content = new HttpContentTransport(transport);
|
|
18157
|
+
const client = new _SemiontClient(transport, content);
|
|
18158
|
+
try {
|
|
18159
|
+
const auth = await client.auth.password(opts.email, opts.password);
|
|
18160
|
+
token$.next(accessToken(auth.token));
|
|
18161
|
+
return client;
|
|
18162
|
+
} catch (err) {
|
|
18163
|
+
client.dispose();
|
|
18164
|
+
throw err;
|
|
18165
|
+
}
|
|
18166
|
+
}
|
|
18060
18167
|
};
|
|
18061
18168
|
REFRESH_BEFORE_EXP_MS = 5 * 60 * 1e3;
|
|
18062
18169
|
}
|
|
@@ -18067,7 +18174,7 @@ import * as fs11 from "fs";
|
|
|
18067
18174
|
import * as path11 from "path";
|
|
18068
18175
|
import { execFileSync as execFileSync8 } from "child_process";
|
|
18069
18176
|
import { SemiontProject as SemiontProject4 } from "@semiont/core/node";
|
|
18070
|
-
import { baseUrl as
|
|
18177
|
+
import { baseUrl as baseUrl3 } from "@semiont/core";
|
|
18071
18178
|
import { HttpContentTransport as HttpContentTransport3, HttpTransport as HttpTransport3 } from "@semiont/api-client";
|
|
18072
18179
|
var checkBackendService, preflightBackendCheck, backendCheckDescriptor;
|
|
18073
18180
|
var init_backend_check = __esm({
|
|
@@ -18149,7 +18256,7 @@ var init_backend_check = __esm({
|
|
|
18149
18256
|
}
|
|
18150
18257
|
if (status === "unhealthy" || status === "unknown") {
|
|
18151
18258
|
const localUrl = `http://localhost:${config.port}`;
|
|
18152
|
-
const transport = new HttpTransport3({ baseUrl:
|
|
18259
|
+
const transport = new HttpTransport3({ baseUrl: baseUrl3(localUrl) });
|
|
18153
18260
|
const client = new SemiontClient(transport, new HttpContentTransport3(transport));
|
|
18154
18261
|
try {
|
|
18155
18262
|
const healthData = await client.admin.healthCheck();
|
|
@@ -21253,7 +21360,7 @@ var init_platform2 = __esm({
|
|
|
21253
21360
|
|
|
21254
21361
|
// src/platforms/container/handlers/web-check.ts
|
|
21255
21362
|
import { execFileSync as execFileSync16 } from "child_process";
|
|
21256
|
-
import { baseUrl as
|
|
21363
|
+
import { baseUrl as baseUrl4 } from "@semiont/core";
|
|
21257
21364
|
import { HttpContentTransport as HttpContentTransport4, HttpTransport as HttpTransport4 } from "@semiont/api-client";
|
|
21258
21365
|
var checkWebContainer, preflightWebCheck, webCheckDescriptor, webFrontendCheckDescriptor;
|
|
21259
21366
|
var init_web_check = __esm({
|
|
@@ -21310,7 +21417,7 @@ var init_web_check = __esm({
|
|
|
21310
21417
|
try {
|
|
21311
21418
|
if (isBackend) {
|
|
21312
21419
|
const backendConfig = config;
|
|
21313
|
-
const transport = new HttpTransport4({ baseUrl:
|
|
21420
|
+
const transport = new HttpTransport4({ baseUrl: baseUrl4(backendConfig.publicURL) });
|
|
21314
21421
|
const client = new SemiontClient(transport, new HttpContentTransport4(transport));
|
|
21315
21422
|
try {
|
|
21316
21423
|
const healthData = await client.admin.healthCheck();
|
|
@@ -23167,7 +23274,7 @@ function generateError(state, message) {
|
|
|
23167
23274
|
mark.snippet = snippet(mark);
|
|
23168
23275
|
return new exception(message, mark);
|
|
23169
23276
|
}
|
|
23170
|
-
function
|
|
23277
|
+
function throwError2(state, message) {
|
|
23171
23278
|
throw generateError(state, message);
|
|
23172
23279
|
}
|
|
23173
23280
|
function throwWarning(state, message) {
|
|
@@ -23183,11 +23290,11 @@ function captureSegment(state, start2, end, checkJson) {
|
|
|
23183
23290
|
for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
|
|
23184
23291
|
_character = _result.charCodeAt(_position);
|
|
23185
23292
|
if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
|
|
23186
|
-
|
|
23293
|
+
throwError2(state, "expected valid JSON character");
|
|
23187
23294
|
}
|
|
23188
23295
|
}
|
|
23189
23296
|
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
|
|
23190
|
-
|
|
23297
|
+
throwError2(state, "the stream contains non-printable characters");
|
|
23191
23298
|
}
|
|
23192
23299
|
state.result += _result;
|
|
23193
23300
|
}
|
|
@@ -23195,7 +23302,7 @@ function captureSegment(state, start2, end, checkJson) {
|
|
|
23195
23302
|
function mergeMappings(state, destination, source, overridableKeys) {
|
|
23196
23303
|
var sourceKeys, key, index, quantity;
|
|
23197
23304
|
if (!common.isObject(source)) {
|
|
23198
|
-
|
|
23305
|
+
throwError2(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
23199
23306
|
}
|
|
23200
23307
|
sourceKeys = Object.keys(source);
|
|
23201
23308
|
for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
|
|
@@ -23212,7 +23319,7 @@ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valu
|
|
|
23212
23319
|
keyNode = Array.prototype.slice.call(keyNode);
|
|
23213
23320
|
for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
|
|
23214
23321
|
if (Array.isArray(keyNode[index])) {
|
|
23215
|
-
|
|
23322
|
+
throwError2(state, "nested arrays are not supported inside keys");
|
|
23216
23323
|
}
|
|
23217
23324
|
if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
|
|
23218
23325
|
keyNode[index] = "[object Object]";
|
|
@@ -23239,7 +23346,7 @@ function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valu
|
|
|
23239
23346
|
state.line = startLine || state.line;
|
|
23240
23347
|
state.lineStart = startLineStart || state.lineStart;
|
|
23241
23348
|
state.position = startPos || state.position;
|
|
23242
|
-
|
|
23349
|
+
throwError2(state, "duplicated mapping key");
|
|
23243
23350
|
}
|
|
23244
23351
|
setProperty(_result, keyNode, valueNode);
|
|
23245
23352
|
delete overridableKeys[keyNode];
|
|
@@ -23257,7 +23364,7 @@ function readLineBreak(state) {
|
|
|
23257
23364
|
state.position++;
|
|
23258
23365
|
}
|
|
23259
23366
|
} else {
|
|
23260
|
-
|
|
23367
|
+
throwError2(state, "a line break is expected");
|
|
23261
23368
|
}
|
|
23262
23369
|
state.line += 1;
|
|
23263
23370
|
state.lineStart = state.position;
|
|
@@ -23405,13 +23512,13 @@ function readSingleQuotedScalar(state, nodeIndent) {
|
|
|
23405
23512
|
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
23406
23513
|
captureStart = captureEnd = state.position;
|
|
23407
23514
|
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
23408
|
-
|
|
23515
|
+
throwError2(state, "unexpected end of the document within a single quoted scalar");
|
|
23409
23516
|
} else {
|
|
23410
23517
|
state.position++;
|
|
23411
23518
|
captureEnd = state.position;
|
|
23412
23519
|
}
|
|
23413
23520
|
}
|
|
23414
|
-
|
|
23521
|
+
throwError2(state, "unexpected end of the stream within a single quoted scalar");
|
|
23415
23522
|
}
|
|
23416
23523
|
function readDoubleQuotedScalar(state, nodeIndent) {
|
|
23417
23524
|
var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
|
|
@@ -23444,13 +23551,13 @@ function readDoubleQuotedScalar(state, nodeIndent) {
|
|
|
23444
23551
|
if ((tmp = fromHexCode(ch)) >= 0) {
|
|
23445
23552
|
hexResult = (hexResult << 4) + tmp;
|
|
23446
23553
|
} else {
|
|
23447
|
-
|
|
23554
|
+
throwError2(state, "expected hexadecimal character");
|
|
23448
23555
|
}
|
|
23449
23556
|
}
|
|
23450
23557
|
state.result += charFromCodepoint(hexResult);
|
|
23451
23558
|
state.position++;
|
|
23452
23559
|
} else {
|
|
23453
|
-
|
|
23560
|
+
throwError2(state, "unknown escape sequence");
|
|
23454
23561
|
}
|
|
23455
23562
|
captureStart = captureEnd = state.position;
|
|
23456
23563
|
} else if (is_EOL(ch)) {
|
|
@@ -23458,13 +23565,13 @@ function readDoubleQuotedScalar(state, nodeIndent) {
|
|
|
23458
23565
|
writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
|
|
23459
23566
|
captureStart = captureEnd = state.position;
|
|
23460
23567
|
} else if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
23461
|
-
|
|
23568
|
+
throwError2(state, "unexpected end of the document within a double quoted scalar");
|
|
23462
23569
|
} else {
|
|
23463
23570
|
state.position++;
|
|
23464
23571
|
captureEnd = state.position;
|
|
23465
23572
|
}
|
|
23466
23573
|
}
|
|
23467
|
-
|
|
23574
|
+
throwError2(state, "unexpected end of the stream within a double quoted scalar");
|
|
23468
23575
|
}
|
|
23469
23576
|
function readFlowCollection(state, nodeIndent) {
|
|
23470
23577
|
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 +23602,9 @@ function readFlowCollection(state, nodeIndent) {
|
|
|
23495
23602
|
state.result = _result;
|
|
23496
23603
|
return true;
|
|
23497
23604
|
} else if (!readNext) {
|
|
23498
|
-
|
|
23605
|
+
throwError2(state, "missed comma between flow collection entries");
|
|
23499
23606
|
} else if (ch === 44) {
|
|
23500
|
-
|
|
23607
|
+
throwError2(state, "expected the node content, but found ','");
|
|
23501
23608
|
}
|
|
23502
23609
|
keyTag = keyNode = valueNode = null;
|
|
23503
23610
|
isPair = isExplicitPair = false;
|
|
@@ -23540,7 +23647,7 @@ function readFlowCollection(state, nodeIndent) {
|
|
|
23540
23647
|
readNext = false;
|
|
23541
23648
|
}
|
|
23542
23649
|
}
|
|
23543
|
-
|
|
23650
|
+
throwError2(state, "unexpected end of the stream within a flow collection");
|
|
23544
23651
|
}
|
|
23545
23652
|
function readBlockScalar(state, nodeIndent) {
|
|
23546
23653
|
var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
|
|
@@ -23560,16 +23667,16 @@ function readBlockScalar(state, nodeIndent) {
|
|
|
23560
23667
|
if (CHOMPING_CLIP === chomping) {
|
|
23561
23668
|
chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
|
|
23562
23669
|
} else {
|
|
23563
|
-
|
|
23670
|
+
throwError2(state, "repeat of a chomping mode identifier");
|
|
23564
23671
|
}
|
|
23565
23672
|
} else if ((tmp = fromDecimalCode(ch)) >= 0) {
|
|
23566
23673
|
if (tmp === 0) {
|
|
23567
|
-
|
|
23674
|
+
throwError2(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
|
23568
23675
|
} else if (!detectedIndent) {
|
|
23569
23676
|
textIndent = nodeIndent + tmp - 1;
|
|
23570
23677
|
detectedIndent = true;
|
|
23571
23678
|
} else {
|
|
23572
|
-
|
|
23679
|
+
throwError2(state, "repeat of an indentation width identifier");
|
|
23573
23680
|
}
|
|
23574
23681
|
} else {
|
|
23575
23682
|
break;
|
|
@@ -23648,7 +23755,7 @@ function readBlockSequence(state, nodeIndent) {
|
|
|
23648
23755
|
while (ch !== 0) {
|
|
23649
23756
|
if (state.firstTabInLine !== -1) {
|
|
23650
23757
|
state.position = state.firstTabInLine;
|
|
23651
|
-
|
|
23758
|
+
throwError2(state, "tab characters must not be used in indentation");
|
|
23652
23759
|
}
|
|
23653
23760
|
if (ch !== 45) {
|
|
23654
23761
|
break;
|
|
@@ -23672,7 +23779,7 @@ function readBlockSequence(state, nodeIndent) {
|
|
|
23672
23779
|
skipSeparationSpace(state, true, -1);
|
|
23673
23780
|
ch = state.input.charCodeAt(state.position);
|
|
23674
23781
|
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
23675
|
-
|
|
23782
|
+
throwError2(state, "bad indentation of a sequence entry");
|
|
23676
23783
|
} else if (state.lineIndent < nodeIndent) {
|
|
23677
23784
|
break;
|
|
23678
23785
|
}
|
|
@@ -23696,7 +23803,7 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
|
23696
23803
|
while (ch !== 0) {
|
|
23697
23804
|
if (!atExplicitKey && state.firstTabInLine !== -1) {
|
|
23698
23805
|
state.position = state.firstTabInLine;
|
|
23699
|
-
|
|
23806
|
+
throwError2(state, "tab characters must not be used in indentation");
|
|
23700
23807
|
}
|
|
23701
23808
|
following = state.input.charCodeAt(state.position + 1);
|
|
23702
23809
|
_line = state.line;
|
|
@@ -23713,7 +23820,7 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
|
23713
23820
|
atExplicitKey = false;
|
|
23714
23821
|
allowCompact = true;
|
|
23715
23822
|
} else {
|
|
23716
|
-
|
|
23823
|
+
throwError2(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
|
|
23717
23824
|
}
|
|
23718
23825
|
state.position += 1;
|
|
23719
23826
|
ch = following;
|
|
@@ -23732,7 +23839,7 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
|
23732
23839
|
if (ch === 58) {
|
|
23733
23840
|
ch = state.input.charCodeAt(++state.position);
|
|
23734
23841
|
if (!is_WS_OR_EOL(ch)) {
|
|
23735
|
-
|
|
23842
|
+
throwError2(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
|
23736
23843
|
}
|
|
23737
23844
|
if (atExplicitKey) {
|
|
23738
23845
|
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
|
|
@@ -23744,14 +23851,14 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
|
23744
23851
|
keyTag = state.tag;
|
|
23745
23852
|
keyNode = state.result;
|
|
23746
23853
|
} else if (detected) {
|
|
23747
|
-
|
|
23854
|
+
throwError2(state, "can not read an implicit mapping pair; a colon is missed");
|
|
23748
23855
|
} else {
|
|
23749
23856
|
state.tag = _tag;
|
|
23750
23857
|
state.anchor = _anchor;
|
|
23751
23858
|
return true;
|
|
23752
23859
|
}
|
|
23753
23860
|
} else if (detected) {
|
|
23754
|
-
|
|
23861
|
+
throwError2(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
23755
23862
|
} else {
|
|
23756
23863
|
state.tag = _tag;
|
|
23757
23864
|
state.anchor = _anchor;
|
|
@@ -23779,7 +23886,7 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
|
23779
23886
|
ch = state.input.charCodeAt(state.position);
|
|
23780
23887
|
}
|
|
23781
23888
|
if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
|
|
23782
|
-
|
|
23889
|
+
throwError2(state, "bad indentation of a mapping entry");
|
|
23783
23890
|
} else if (state.lineIndent < nodeIndent) {
|
|
23784
23891
|
break;
|
|
23785
23892
|
}
|
|
@@ -23800,7 +23907,7 @@ function readTagProperty(state) {
|
|
|
23800
23907
|
ch = state.input.charCodeAt(state.position);
|
|
23801
23908
|
if (ch !== 33) return false;
|
|
23802
23909
|
if (state.tag !== null) {
|
|
23803
|
-
|
|
23910
|
+
throwError2(state, "duplication of a tag property");
|
|
23804
23911
|
}
|
|
23805
23912
|
ch = state.input.charCodeAt(++state.position);
|
|
23806
23913
|
if (ch === 60) {
|
|
@@ -23822,7 +23929,7 @@ function readTagProperty(state) {
|
|
|
23822
23929
|
tagName = state.input.slice(_position, state.position);
|
|
23823
23930
|
ch = state.input.charCodeAt(++state.position);
|
|
23824
23931
|
} else {
|
|
23825
|
-
|
|
23932
|
+
throwError2(state, "unexpected end of the stream within a verbatim tag");
|
|
23826
23933
|
}
|
|
23827
23934
|
} else {
|
|
23828
23935
|
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
@@ -23830,28 +23937,28 @@ function readTagProperty(state) {
|
|
|
23830
23937
|
if (!isNamed) {
|
|
23831
23938
|
tagHandle = state.input.slice(_position - 1, state.position + 1);
|
|
23832
23939
|
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
|
|
23833
|
-
|
|
23940
|
+
throwError2(state, "named tag handle cannot contain such characters");
|
|
23834
23941
|
}
|
|
23835
23942
|
isNamed = true;
|
|
23836
23943
|
_position = state.position + 1;
|
|
23837
23944
|
} else {
|
|
23838
|
-
|
|
23945
|
+
throwError2(state, "tag suffix cannot contain exclamation marks");
|
|
23839
23946
|
}
|
|
23840
23947
|
}
|
|
23841
23948
|
ch = state.input.charCodeAt(++state.position);
|
|
23842
23949
|
}
|
|
23843
23950
|
tagName = state.input.slice(_position, state.position);
|
|
23844
23951
|
if (PATTERN_FLOW_INDICATORS.test(tagName)) {
|
|
23845
|
-
|
|
23952
|
+
throwError2(state, "tag suffix cannot contain flow indicator characters");
|
|
23846
23953
|
}
|
|
23847
23954
|
}
|
|
23848
23955
|
if (tagName && !PATTERN_TAG_URI.test(tagName)) {
|
|
23849
|
-
|
|
23956
|
+
throwError2(state, "tag name cannot contain such characters: " + tagName);
|
|
23850
23957
|
}
|
|
23851
23958
|
try {
|
|
23852
23959
|
tagName = decodeURIComponent(tagName);
|
|
23853
23960
|
} catch (err) {
|
|
23854
|
-
|
|
23961
|
+
throwError2(state, "tag name is malformed: " + tagName);
|
|
23855
23962
|
}
|
|
23856
23963
|
if (isVerbatim) {
|
|
23857
23964
|
state.tag = tagName;
|
|
@@ -23862,7 +23969,7 @@ function readTagProperty(state) {
|
|
|
23862
23969
|
} else if (tagHandle === "!!") {
|
|
23863
23970
|
state.tag = "tag:yaml.org,2002:" + tagName;
|
|
23864
23971
|
} else {
|
|
23865
|
-
|
|
23972
|
+
throwError2(state, 'undeclared tag handle "' + tagHandle + '"');
|
|
23866
23973
|
}
|
|
23867
23974
|
return true;
|
|
23868
23975
|
}
|
|
@@ -23871,7 +23978,7 @@ function readAnchorProperty(state) {
|
|
|
23871
23978
|
ch = state.input.charCodeAt(state.position);
|
|
23872
23979
|
if (ch !== 38) return false;
|
|
23873
23980
|
if (state.anchor !== null) {
|
|
23874
|
-
|
|
23981
|
+
throwError2(state, "duplication of an anchor property");
|
|
23875
23982
|
}
|
|
23876
23983
|
ch = state.input.charCodeAt(++state.position);
|
|
23877
23984
|
_position = state.position;
|
|
@@ -23879,7 +23986,7 @@ function readAnchorProperty(state) {
|
|
|
23879
23986
|
ch = state.input.charCodeAt(++state.position);
|
|
23880
23987
|
}
|
|
23881
23988
|
if (state.position === _position) {
|
|
23882
|
-
|
|
23989
|
+
throwError2(state, "name of an anchor node must contain at least one character");
|
|
23883
23990
|
}
|
|
23884
23991
|
state.anchor = state.input.slice(_position, state.position);
|
|
23885
23992
|
return true;
|
|
@@ -23894,11 +24001,11 @@ function readAlias(state) {
|
|
|
23894
24001
|
ch = state.input.charCodeAt(++state.position);
|
|
23895
24002
|
}
|
|
23896
24003
|
if (state.position === _position) {
|
|
23897
|
-
|
|
24004
|
+
throwError2(state, "name of an alias node must contain at least one character");
|
|
23898
24005
|
}
|
|
23899
24006
|
alias = state.input.slice(_position, state.position);
|
|
23900
24007
|
if (!_hasOwnProperty$1.call(state.anchorMap, alias)) {
|
|
23901
|
-
|
|
24008
|
+
throwError2(state, 'unidentified alias "' + alias + '"');
|
|
23902
24009
|
}
|
|
23903
24010
|
state.result = state.anchorMap[alias];
|
|
23904
24011
|
skipSeparationSpace(state, true, -1);
|
|
@@ -23962,7 +24069,7 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
|
|
|
23962
24069
|
} else if (readAlias(state)) {
|
|
23963
24070
|
hasContent = true;
|
|
23964
24071
|
if (state.tag !== null || state.anchor !== null) {
|
|
23965
|
-
|
|
24072
|
+
throwError2(state, "alias node should not have any properties");
|
|
23966
24073
|
}
|
|
23967
24074
|
} else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
|
|
23968
24075
|
hasContent = true;
|
|
@@ -23984,7 +24091,7 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
|
|
|
23984
24091
|
}
|
|
23985
24092
|
} else if (state.tag === "?") {
|
|
23986
24093
|
if (state.result !== null && state.kind !== "scalar") {
|
|
23987
|
-
|
|
24094
|
+
throwError2(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
|
|
23988
24095
|
}
|
|
23989
24096
|
for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
|
|
23990
24097
|
type2 = state.implicitTypes[typeIndex];
|
|
@@ -24011,13 +24118,13 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
|
|
|
24011
24118
|
}
|
|
24012
24119
|
}
|
|
24013
24120
|
if (!type2) {
|
|
24014
|
-
|
|
24121
|
+
throwError2(state, "unknown tag !<" + state.tag + ">");
|
|
24015
24122
|
}
|
|
24016
24123
|
if (state.result !== null && type2.kind !== state.kind) {
|
|
24017
|
-
|
|
24124
|
+
throwError2(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type2.kind + '", not "' + state.kind + '"');
|
|
24018
24125
|
}
|
|
24019
24126
|
if (!type2.resolve(state.result, state.tag)) {
|
|
24020
|
-
|
|
24127
|
+
throwError2(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
|
|
24021
24128
|
} else {
|
|
24022
24129
|
state.result = type2.construct(state.result, state.tag);
|
|
24023
24130
|
if (state.anchor !== null) {
|
|
@@ -24051,7 +24158,7 @@ function readDocument(state) {
|
|
|
24051
24158
|
directiveName = state.input.slice(_position, state.position);
|
|
24052
24159
|
directiveArgs = [];
|
|
24053
24160
|
if (directiveName.length < 1) {
|
|
24054
|
-
|
|
24161
|
+
throwError2(state, "directive name must not be less than one character in length");
|
|
24055
24162
|
}
|
|
24056
24163
|
while (ch !== 0) {
|
|
24057
24164
|
while (is_WHITE_SPACE(ch)) {
|
|
@@ -24082,7 +24189,7 @@ function readDocument(state) {
|
|
|
24082
24189
|
state.position += 3;
|
|
24083
24190
|
skipSeparationSpace(state, true, -1);
|
|
24084
24191
|
} else if (hasDirectives) {
|
|
24085
|
-
|
|
24192
|
+
throwError2(state, "directives end mark is expected");
|
|
24086
24193
|
}
|
|
24087
24194
|
composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
|
|
24088
24195
|
skipSeparationSpace(state, true, -1);
|
|
@@ -24098,7 +24205,7 @@ function readDocument(state) {
|
|
|
24098
24205
|
return;
|
|
24099
24206
|
}
|
|
24100
24207
|
if (state.position < state.length - 1) {
|
|
24101
|
-
|
|
24208
|
+
throwError2(state, "end of the stream or a document separator is expected");
|
|
24102
24209
|
} else {
|
|
24103
24210
|
return;
|
|
24104
24211
|
}
|
|
@@ -24118,7 +24225,7 @@ function loadDocuments(input, options) {
|
|
|
24118
24225
|
var nullpos = input.indexOf("\0");
|
|
24119
24226
|
if (nullpos !== -1) {
|
|
24120
24227
|
state.position = nullpos;
|
|
24121
|
-
|
|
24228
|
+
throwError2(state, "null byte is not allowed in input");
|
|
24122
24229
|
}
|
|
24123
24230
|
state.input += "\0";
|
|
24124
24231
|
while (state.input.charCodeAt(state.position) === 32) {
|
|
@@ -24982,19 +25089,19 @@ var init_js_yaml = __esm({
|
|
|
24982
25089
|
YAML: function handleYamlDirective(state, name, args) {
|
|
24983
25090
|
var match, major, minor;
|
|
24984
25091
|
if (state.version !== null) {
|
|
24985
|
-
|
|
25092
|
+
throwError2(state, "duplication of %YAML directive");
|
|
24986
25093
|
}
|
|
24987
25094
|
if (args.length !== 1) {
|
|
24988
|
-
|
|
25095
|
+
throwError2(state, "YAML directive accepts exactly one argument");
|
|
24989
25096
|
}
|
|
24990
25097
|
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
24991
25098
|
if (match === null) {
|
|
24992
|
-
|
|
25099
|
+
throwError2(state, "ill-formed argument of the YAML directive");
|
|
24993
25100
|
}
|
|
24994
25101
|
major = parseInt(match[1], 10);
|
|
24995
25102
|
minor = parseInt(match[2], 10);
|
|
24996
25103
|
if (major !== 1) {
|
|
24997
|
-
|
|
25104
|
+
throwError2(state, "unacceptable YAML version of the document");
|
|
24998
25105
|
}
|
|
24999
25106
|
state.version = args[0];
|
|
25000
25107
|
state.checkLineBreaks = minor < 2;
|
|
@@ -25005,23 +25112,23 @@ var init_js_yaml = __esm({
|
|
|
25005
25112
|
TAG: function handleTagDirective(state, name, args) {
|
|
25006
25113
|
var handle, prefix;
|
|
25007
25114
|
if (args.length !== 2) {
|
|
25008
|
-
|
|
25115
|
+
throwError2(state, "TAG directive accepts exactly two arguments");
|
|
25009
25116
|
}
|
|
25010
25117
|
handle = args[0];
|
|
25011
25118
|
prefix = args[1];
|
|
25012
25119
|
if (!PATTERN_TAG_HANDLE.test(handle)) {
|
|
25013
|
-
|
|
25120
|
+
throwError2(state, "ill-formed tag handle (first argument) of the TAG directive");
|
|
25014
25121
|
}
|
|
25015
25122
|
if (_hasOwnProperty$1.call(state.tagMap, handle)) {
|
|
25016
|
-
|
|
25123
|
+
throwError2(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
|
25017
25124
|
}
|
|
25018
25125
|
if (!PATTERN_TAG_URI.test(prefix)) {
|
|
25019
|
-
|
|
25126
|
+
throwError2(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
25020
25127
|
}
|
|
25021
25128
|
try {
|
|
25022
25129
|
prefix = decodeURIComponent(prefix);
|
|
25023
25130
|
} catch (err) {
|
|
25024
|
-
|
|
25131
|
+
throwError2(state, "tag prefix is malformed: " + prefix);
|
|
25025
25132
|
}
|
|
25026
25133
|
state.tagMap[handle] = prefix;
|
|
25027
25134
|
}
|
|
@@ -26632,13 +26739,13 @@ var init_embedding_check = __esm({
|
|
|
26632
26739
|
const model = embeddingService.getModel();
|
|
26633
26740
|
try {
|
|
26634
26741
|
if (embeddingType === "ollama") {
|
|
26635
|
-
const
|
|
26636
|
-
const res = await fetch(`${
|
|
26742
|
+
const baseUrl5 = embeddingService.getBaseURL().replace(/\/+$/, "");
|
|
26743
|
+
const res = await fetch(`${baseUrl5}/api/tags`);
|
|
26637
26744
|
if (!res.ok) {
|
|
26638
26745
|
return {
|
|
26639
26746
|
success: false,
|
|
26640
26747
|
status: "unhealthy",
|
|
26641
|
-
error: `Ollama returned ${res.status} at ${
|
|
26748
|
+
error: `Ollama returned ${res.status} at ${baseUrl5}/api/tags`,
|
|
26642
26749
|
metadata: { serviceType: "embedding", embeddingType, model }
|
|
26643
26750
|
};
|
|
26644
26751
|
}
|
|
@@ -26668,9 +26775,9 @@ var init_embedding_check = __esm({
|
|
|
26668
26775
|
status: "running",
|
|
26669
26776
|
health: {
|
|
26670
26777
|
healthy: true,
|
|
26671
|
-
details: { embeddingType, model, endpoint:
|
|
26778
|
+
details: { embeddingType, model, endpoint: baseUrl5 }
|
|
26672
26779
|
},
|
|
26673
|
-
metadata: { serviceType: "embedding", embeddingType, model, endpoint:
|
|
26780
|
+
metadata: { serviceType: "embedding", embeddingType, model, endpoint: baseUrl5 }
|
|
26674
26781
|
};
|
|
26675
26782
|
}
|
|
26676
26783
|
return {
|
|
@@ -26729,11 +26836,11 @@ var init_embedding_provision = __esm({
|
|
|
26729
26836
|
};
|
|
26730
26837
|
}
|
|
26731
26838
|
const model = embeddingService.getModel();
|
|
26732
|
-
const
|
|
26839
|
+
const baseUrl5 = embeddingService.getBaseURL().replace(/\/+$/, "");
|
|
26733
26840
|
if (!service.quiet) {
|
|
26734
|
-
printInfo(`Pulling embedding model ${model} from ${
|
|
26841
|
+
printInfo(`Pulling embedding model ${model} from ${baseUrl5}...`);
|
|
26735
26842
|
}
|
|
26736
|
-
const res = await fetch(`${
|
|
26843
|
+
const res = await fetch(`${baseUrl5}/api/pull`, {
|
|
26737
26844
|
method: "POST",
|
|
26738
26845
|
headers: { "Content-Type": "application/json" },
|
|
26739
26846
|
body: JSON.stringify({ name: model, stream: false })
|
|
@@ -26761,13 +26868,13 @@ var init_embedding_provision = __esm({
|
|
|
26761
26868
|
success: true,
|
|
26762
26869
|
resources: {
|
|
26763
26870
|
platform: "external",
|
|
26764
|
-
data: { endpoint:
|
|
26871
|
+
data: { endpoint: baseUrl5, provider: embeddingType }
|
|
26765
26872
|
},
|
|
26766
26873
|
metadata: {
|
|
26767
26874
|
serviceType: "embedding",
|
|
26768
26875
|
embeddingType,
|
|
26769
26876
|
model,
|
|
26770
|
-
endpoint:
|
|
26877
|
+
endpoint: baseUrl5
|
|
26771
26878
|
}
|
|
26772
26879
|
};
|
|
26773
26880
|
};
|
|
@@ -27195,13 +27302,13 @@ var init_inference_provision3 = __esm({
|
|
|
27195
27302
|
metadata: { serviceType: "inference", inferenceType }
|
|
27196
27303
|
};
|
|
27197
27304
|
}
|
|
27198
|
-
const
|
|
27305
|
+
const baseUrl5 = endpoint.replace(/\/+$/, "");
|
|
27199
27306
|
const pulledModels = [];
|
|
27200
27307
|
for (const model of models) {
|
|
27201
27308
|
if (!service.quiet) {
|
|
27202
|
-
printInfo(`Pulling model ${model} from ${
|
|
27309
|
+
printInfo(`Pulling model ${model} from ${baseUrl5}...`);
|
|
27203
27310
|
}
|
|
27204
|
-
const res = await fetch(`${
|
|
27311
|
+
const res = await fetch(`${baseUrl5}/api/pull`, {
|
|
27205
27312
|
method: "POST",
|
|
27206
27313
|
headers: { "Content-Type": "application/json" },
|
|
27207
27314
|
body: JSON.stringify({ name: model, stream: false })
|
|
@@ -27231,13 +27338,13 @@ var init_inference_provision3 = __esm({
|
|
|
27231
27338
|
success: true,
|
|
27232
27339
|
resources: {
|
|
27233
27340
|
platform: "external",
|
|
27234
|
-
data: { endpoint:
|
|
27341
|
+
data: { endpoint: baseUrl5, provider: inferenceType }
|
|
27235
27342
|
},
|
|
27236
27343
|
metadata: {
|
|
27237
27344
|
serviceType: "inference",
|
|
27238
27345
|
inferenceType,
|
|
27239
27346
|
models: pulledModels,
|
|
27240
|
-
endpoint:
|
|
27347
|
+
endpoint: baseUrl5
|
|
27241
27348
|
}
|
|
27242
27349
|
};
|
|
27243
27350
|
};
|
|
@@ -32828,7 +32935,7 @@ var require_package = __commonJS({
|
|
|
32828
32935
|
"package.json"(exports, module) {
|
|
32829
32936
|
module.exports = {
|
|
32830
32937
|
name: "@semiont/cli",
|
|
32831
|
-
version: "0.
|
|
32938
|
+
version: "0.5.1",
|
|
32832
32939
|
description: "Semiont CLI - Unified environment management tool",
|
|
32833
32940
|
_comment: "AWS SDK dependencies (@aws-sdk/*) are only used by platforms/aws",
|
|
32834
32941
|
type: "module",
|
|
@@ -32875,13 +32982,13 @@ var require_package = __commonJS({
|
|
|
32875
32982
|
"test:watch:unit": "vitest --watch --config vitest.config.unit.ts"
|
|
32876
32983
|
},
|
|
32877
32984
|
dependencies: {
|
|
32878
|
-
"@semiont/api-client": "0.
|
|
32879
|
-
"@semiont/content": "0.
|
|
32880
|
-
"@semiont/core": "0.
|
|
32881
|
-
"@semiont/event-sourcing": "0.
|
|
32882
|
-
"@semiont/graph": "0.
|
|
32883
|
-
"@semiont/sdk": "0.
|
|
32884
|
-
"@semiont/make-meaning": "0.
|
|
32985
|
+
"@semiont/api-client": "0.5.1",
|
|
32986
|
+
"@semiont/content": "0.5.1",
|
|
32987
|
+
"@semiont/core": "0.5.1",
|
|
32988
|
+
"@semiont/event-sourcing": "0.5.1",
|
|
32989
|
+
"@semiont/graph": "0.5.1",
|
|
32990
|
+
"@semiont/sdk": "0.5.1",
|
|
32991
|
+
"@semiont/make-meaning": "0.5.1",
|
|
32885
32992
|
arg: "^5.0.2",
|
|
32886
32993
|
argon2: "^0.44.0",
|
|
32887
32994
|
express: "^5.2.1",
|
|
@@ -34226,8 +34333,8 @@ async function runBackup(options) {
|
|
|
34226
34333
|
const projectRoot = findProjectRoot();
|
|
34227
34334
|
const environment = options.environment;
|
|
34228
34335
|
const envConfig = loadEnvironmentConfig(projectRoot, environment);
|
|
34229
|
-
const
|
|
34230
|
-
if (!
|
|
34336
|
+
const baseUrl5 = envConfig.services?.backend?.publicURL;
|
|
34337
|
+
if (!baseUrl5) {
|
|
34231
34338
|
throw new Error("services.backend.publicURL is required in environment config");
|
|
34232
34339
|
}
|
|
34233
34340
|
const project = new SemiontProject11(projectRoot);
|
|
@@ -34243,7 +34350,7 @@ async function runBackup(options) {
|
|
|
34243
34350
|
}
|
|
34244
34351
|
const output = fs38.createWriteStream(outPath);
|
|
34245
34352
|
const manifest = await exportBackup(
|
|
34246
|
-
{ eventStore, content: contentStore, sourceUrl:
|
|
34353
|
+
{ eventStore, content: contentStore, sourceUrl: baseUrl5, logger },
|
|
34247
34354
|
output
|
|
34248
34355
|
);
|
|
34249
34356
|
if (!options.quiet) {
|
|
@@ -34585,8 +34692,8 @@ async function runExport(options) {
|
|
|
34585
34692
|
const projectRoot = findProjectRoot();
|
|
34586
34693
|
const environment = options.environment;
|
|
34587
34694
|
const envConfig = loadEnvironmentConfig(projectRoot, environment);
|
|
34588
|
-
const
|
|
34589
|
-
if (!
|
|
34695
|
+
const baseUrl5 = envConfig.services?.backend?.publicURL;
|
|
34696
|
+
if (!baseUrl5) {
|
|
34590
34697
|
throw new Error("services.backend.publicURL is required in environment config");
|
|
34591
34698
|
}
|
|
34592
34699
|
const project = new SemiontProject13(projectRoot);
|
|
@@ -34609,7 +34716,7 @@ async function runExport(options) {
|
|
|
34609
34716
|
{
|
|
34610
34717
|
views: eventStore.viewStorage,
|
|
34611
34718
|
content: contentStore,
|
|
34612
|
-
sourceUrl:
|
|
34719
|
+
sourceUrl: baseUrl5,
|
|
34613
34720
|
entityTypes,
|
|
34614
34721
|
includeArchived: options.includeArchived,
|
|
34615
34722
|
logger
|
|
@@ -34730,10 +34837,10 @@ async function runImport(options) {
|
|
|
34730
34837
|
if (!fs42.existsSync(filePath)) {
|
|
34731
34838
|
throw new Error(`File not found: ${filePath}`);
|
|
34732
34839
|
}
|
|
34733
|
-
const
|
|
34840
|
+
const userId2 = options.userId ?? `did:web:localhost:users:${process.env.USER ?? "cli"}`;
|
|
34734
34841
|
if (!options.quiet) {
|
|
34735
34842
|
printInfo(`Importing JSON-LD archive from ${filePath}`);
|
|
34736
|
-
printInfo(`User identity: ${
|
|
34843
|
+
printInfo(`User identity: ${userId2}`);
|
|
34737
34844
|
}
|
|
34738
34845
|
const eventBus = new EventBus5();
|
|
34739
34846
|
const eventStore = createEventStore4(project, eventBus, logger);
|
|
@@ -34742,7 +34849,7 @@ async function runImport(options) {
|
|
|
34742
34849
|
await stower.initialize();
|
|
34743
34850
|
try {
|
|
34744
34851
|
const input = fs42.createReadStream(filePath);
|
|
34745
|
-
const result = await importLinkedData(input, { eventBus, contentStore: kb.content, userId, logger });
|
|
34852
|
+
const result = await importLinkedData(input, { eventBus, contentStore: kb.content, userId: userId2, logger });
|
|
34746
34853
|
if (!options.quiet) {
|
|
34747
34854
|
printSuccess(
|
|
34748
34855
|
`Import complete: ${result.resourcesCreated} resources, ${result.annotationsCreated} annotations, ${result.entityTypesAdded} entity types`
|
|
@@ -35486,8 +35593,8 @@ async function runMv(options) {
|
|
|
35486
35593
|
reject(new Error(e.message ?? "Move failed"));
|
|
35487
35594
|
});
|
|
35488
35595
|
});
|
|
35489
|
-
const
|
|
35490
|
-
eventBus.get("yield:mv").next({ fromUri, toUri, _userId:
|
|
35596
|
+
const userId2 = `did:web:localhost:users:${process.env.USER ?? "cli"}`;
|
|
35597
|
+
eventBus.get("yield:mv").next({ fromUri, toUri, _userId: userId2, noGit: options.noGit });
|
|
35491
35598
|
await movedPromise;
|
|
35492
35599
|
if (!options.quiet) {
|
|
35493
35600
|
printSuccess(`Moved: ${fromUri} \u2192 ${toUri}`);
|
|
@@ -35699,10 +35806,10 @@ async function runYield(options) {
|
|
|
35699
35806
|
const { semiont } = loadCachedClient(rawBusUrl);
|
|
35700
35807
|
const projectRoot = findProjectRoot();
|
|
35701
35808
|
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:
|
|
35809
|
+
const { resourceId: resourceId3, resourceName } = await runDelegate(semiont, options);
|
|
35810
|
+
const label = resourceName ?? resourceId3 ?? options.storageUri;
|
|
35811
|
+
if (!options.quiet) printSuccess(`Yielded: ${options.storageUri} \u2192 ${resourceId3 ?? "(pending)"}`);
|
|
35812
|
+
process.stdout.write(JSON.stringify({ resourceId: resourceId3, resourceName, storageUri: options.storageUri }));
|
|
35706
35813
|
if (!options.quiet) process.stdout.write("\n");
|
|
35707
35814
|
return {
|
|
35708
35815
|
command: "yield",
|
|
@@ -35711,7 +35818,7 @@ async function runYield(options) {
|
|
|
35711
35818
|
duration: Date.now() - startTime,
|
|
35712
35819
|
summary: { succeeded: 1, failed: 0, total: 1, warnings: 0 },
|
|
35713
35820
|
executionContext: { user: process.env.USER || "unknown", workingDirectory: process.cwd(), dryRun: options.dryRun },
|
|
35714
|
-
results: [{ entity: label, platform: "posix", success: true, metadata: { resourceId:
|
|
35821
|
+
results: [{ entity: label, platform: "posix", success: true, metadata: { resourceId: resourceId3, storageUri: options.storageUri }, duration: Date.now() - startTime }]
|
|
35715
35822
|
};
|
|
35716
35823
|
}
|
|
35717
35824
|
let succeeded = 0;
|
|
@@ -35733,11 +35840,11 @@ async function runYield(options) {
|
|
|
35733
35840
|
const storageUri = `file://${relPath}`;
|
|
35734
35841
|
const name = options.name ?? path38.basename(filePath, path38.extname(filePath));
|
|
35735
35842
|
const format = guessFormat(filePath);
|
|
35736
|
-
const { resourceId:
|
|
35843
|
+
const { resourceId: resourceId3 } = await semiont.yield.resource(
|
|
35737
35844
|
{ name, file: content, format, storageUri }
|
|
35738
35845
|
);
|
|
35739
|
-
if (!options.quiet) printSuccess(`Yielded: ${filePath} \u2192 ${
|
|
35740
|
-
results.push({ entity: filePath, platform: "posix", success: true, metadata: { resourceId:
|
|
35846
|
+
if (!options.quiet) printSuccess(`Yielded: ${filePath} \u2192 ${resourceId3}`);
|
|
35847
|
+
results.push({ entity: filePath, platform: "posix", success: true, metadata: { resourceId: resourceId3, storageUri }, duration: Date.now() - fileStart });
|
|
35741
35848
|
succeeded++;
|
|
35742
35849
|
}
|
|
35743
35850
|
return {
|
|
@@ -35880,8 +35987,8 @@ var MarkOptionsSchema = ApiOptionsSchema.extend({
|
|
|
35880
35987
|
}
|
|
35881
35988
|
}
|
|
35882
35989
|
});
|
|
35883
|
-
async function fetchResourceText(semiont,
|
|
35884
|
-
const { data } = await semiont.browse.resourceRepresentation(
|
|
35990
|
+
async function fetchResourceText(semiont, resourceId3) {
|
|
35991
|
+
const { data } = await semiont.browse.resourceRepresentation(resourceId3, { accept: "text/plain" });
|
|
35885
35992
|
return new TextDecoder().decode(data);
|
|
35886
35993
|
}
|
|
35887
35994
|
function buildTextSelector(options, content) {
|
|
@@ -35919,7 +36026,7 @@ function buildTextSelector(options, content) {
|
|
|
35919
36026
|
}
|
|
35920
36027
|
return selectors;
|
|
35921
36028
|
}
|
|
35922
|
-
async function buildSelector(options, semiont,
|
|
36029
|
+
async function buildSelector(options, semiont, resourceId3) {
|
|
35923
36030
|
const hasText = options.quote !== void 0 || options.start !== void 0 && options.end !== void 0;
|
|
35924
36031
|
const hasSvg = options.svg !== void 0;
|
|
35925
36032
|
const hasFragment = options.fragment !== void 0;
|
|
@@ -35936,7 +36043,7 @@ async function buildSelector(options, semiont, resourceId2) {
|
|
|
35936
36043
|
return f;
|
|
35937
36044
|
}
|
|
35938
36045
|
if (!hasText) return void 0;
|
|
35939
|
-
const content = options.fetchContent ? await fetchResourceText(semiont,
|
|
36046
|
+
const content = options.fetchContent ? await fetchResourceText(semiont, resourceId3) : void 0;
|
|
35940
36047
|
const selectors = buildTextSelector(options, content);
|
|
35941
36048
|
if (selectors.length === 0) return void 0;
|
|
35942
36049
|
if (selectors.length === 1) return selectors[0];
|
|
@@ -35961,7 +36068,7 @@ function buildBody(options) {
|
|
|
35961
36068
|
async function runDelegate2(semiont, options) {
|
|
35962
36069
|
const rawResourceId = options.resourceIdArr[0];
|
|
35963
36070
|
const rId = toResourceId2(rawResourceId);
|
|
35964
|
-
const { motivation, instructions, density, tone, entityType, includeDescriptive, schemaId, category } = options;
|
|
36071
|
+
const { motivation, instructions, density, tone, entityType: entityType2, includeDescriptive, schemaId, category } = options;
|
|
35965
36072
|
if (!options.quiet) process.stderr.write(`Annotating ${motivation} on ${rawResourceId}...
|
|
35966
36073
|
`);
|
|
35967
36074
|
const final = await (0, import_rxjs4.lastValueFrom)(
|
|
@@ -35969,7 +36076,7 @@ async function runDelegate2(semiont, options) {
|
|
|
35969
36076
|
instructions,
|
|
35970
36077
|
density,
|
|
35971
36078
|
tone,
|
|
35972
|
-
entityTypes:
|
|
36079
|
+
entityTypes: entityType2,
|
|
35973
36080
|
includeDescriptiveReferences: includeDescriptive,
|
|
35974
36081
|
schemaId,
|
|
35975
36082
|
categories: category
|
|
@@ -36000,8 +36107,8 @@ async function runMark(options) {
|
|
|
36000
36107
|
};
|
|
36001
36108
|
}
|
|
36002
36109
|
const rawResourceId = options.resourceIdArr[0];
|
|
36003
|
-
const
|
|
36004
|
-
const selector = await buildSelector(options, semiont,
|
|
36110
|
+
const resourceId3 = toResourceId2(rawResourceId);
|
|
36111
|
+
const selector = await buildSelector(options, semiont, resourceId3);
|
|
36005
36112
|
const body = buildBody(options);
|
|
36006
36113
|
const target = selector !== void 0 ? { source: rawResourceId, selector } : { source: rawResourceId, selector: void 0 };
|
|
36007
36114
|
const request = {
|
|
@@ -36009,8 +36116,8 @@ async function runMark(options) {
|
|
|
36009
36116
|
target,
|
|
36010
36117
|
body
|
|
36011
36118
|
};
|
|
36012
|
-
const { annotationId:
|
|
36013
|
-
if (!options.quiet) printSuccess(`Marked: ${rawResourceId} \u2192 ${
|
|
36119
|
+
const { annotationId: annotationId3 } = await semiont.mark.annotation(resourceId3, request);
|
|
36120
|
+
if (!options.quiet) printSuccess(`Marked: ${rawResourceId} \u2192 ${annotationId3}`);
|
|
36014
36121
|
return {
|
|
36015
36122
|
command: "mark",
|
|
36016
36123
|
environment: rawBusUrl,
|
|
@@ -36018,7 +36125,7 @@ async function runMark(options) {
|
|
|
36018
36125
|
duration: Date.now() - startTime,
|
|
36019
36126
|
summary: { succeeded: 1, failed: 0, total: 1, warnings: 0 },
|
|
36020
36127
|
executionContext: { user: process.env.USER || "unknown", workingDirectory: process.cwd(), dryRun: options.dryRun },
|
|
36021
|
-
results: [{ entity: rawResourceId, platform: "posix", success: true, metadata: { annotationId:
|
|
36128
|
+
results: [{ entity: rawResourceId, platform: "posix", success: true, metadata: { annotationId: annotationId3 }, duration: Date.now() - startTime }]
|
|
36022
36129
|
};
|
|
36023
36130
|
}
|
|
36024
36131
|
var markCmd = new CommandBuilder().name("mark").description(
|
|
@@ -36233,18 +36340,18 @@ var MatchOptionsSchema = ApiOptionsSchema.extend({
|
|
|
36233
36340
|
async function runMatch(options) {
|
|
36234
36341
|
const startTime = Date.now();
|
|
36235
36342
|
const [rawResourceId, rawAnnotationId] = options.args;
|
|
36236
|
-
const
|
|
36237
|
-
const
|
|
36343
|
+
const resourceId3 = toResourceId4(rawResourceId);
|
|
36344
|
+
const annotationId3 = toAnnotationId3(rawAnnotationId);
|
|
36238
36345
|
const rawBusUrl = resolveBusUrl(options.bus);
|
|
36239
36346
|
const { semiont } = loadCachedClient(rawBusUrl);
|
|
36240
36347
|
let context = await (0, import_rxjs6.lastValueFrom)(
|
|
36241
|
-
semiont.gather.annotation(
|
|
36348
|
+
semiont.gather.annotation(annotationId3, resourceId3, { contextWindow: options.contextWindow })
|
|
36242
36349
|
);
|
|
36243
36350
|
if (options.userHint) {
|
|
36244
36351
|
context = { ...context, userHint: options.userHint };
|
|
36245
36352
|
}
|
|
36246
36353
|
const searchResult = await (0, import_rxjs6.firstValueFrom)(
|
|
36247
|
-
semiont.match.search(
|
|
36354
|
+
semiont.match.search(resourceId3, annotationId3, context, {
|
|
36248
36355
|
limit: options.limit,
|
|
36249
36356
|
useSemanticScoring: !options.noSemantic
|
|
36250
36357
|
})
|
|
@@ -36296,9 +36403,9 @@ async function runBind(options) {
|
|
|
36296
36403
|
const rawBusUrl = resolveBusUrl(options.bus);
|
|
36297
36404
|
const { semiont } = loadCachedClient(rawBusUrl);
|
|
36298
36405
|
const [rawResourceId, rawAnnotationId, targetResourceId] = options.args;
|
|
36299
|
-
const
|
|
36300
|
-
const
|
|
36301
|
-
await semiont.bind.body(
|
|
36406
|
+
const resourceId3 = toResourceId5(rawResourceId);
|
|
36407
|
+
const annotationId3 = toAnnotationId4(rawAnnotationId);
|
|
36408
|
+
await semiont.bind.body(resourceId3, annotationId3, [{
|
|
36302
36409
|
op: "add",
|
|
36303
36410
|
item: {
|
|
36304
36411
|
type: "SpecificResource",
|
|
@@ -36460,9 +36567,9 @@ async function runBrowse(options) {
|
|
|
36460
36567
|
}
|
|
36461
36568
|
label = `${rawResourceId}: ${resourceData?.name ?? rawResourceId}`;
|
|
36462
36569
|
} else if (subcommand === "annotation") {
|
|
36463
|
-
const
|
|
36464
|
-
const
|
|
36465
|
-
result = await (0, import_rxjs7.firstValueFrom)(semiont.browse.annotation(
|
|
36570
|
+
const resourceId3 = toResourceId6(rawResourceId);
|
|
36571
|
+
const annotationId3 = toAnnotationId5(rawAnnotationId);
|
|
36572
|
+
result = await (0, import_rxjs7.firstValueFrom)(semiont.browse.annotation(resourceId3, annotationId3).pipe((0, import_operators2.filter)(defined)));
|
|
36466
36573
|
label = `${rawAnnotationId}: annotation on ${rawResourceId}`;
|
|
36467
36574
|
} else if (subcommand === "references") {
|
|
36468
36575
|
const id = toResourceId6(rawResourceId);
|
|
@@ -36475,9 +36582,9 @@ async function runBrowse(options) {
|
|
|
36475
36582
|
result = events;
|
|
36476
36583
|
label = `${events.length} event${events.length !== 1 ? "s" : ""} for ${rawResourceId}`;
|
|
36477
36584
|
} else if (subcommand === "history") {
|
|
36478
|
-
const
|
|
36479
|
-
const
|
|
36480
|
-
result = await semiont.browse.annotationHistory(
|
|
36585
|
+
const resourceId3 = toResourceId6(rawResourceId);
|
|
36586
|
+
const annotationId3 = toAnnotationId5(rawAnnotationId);
|
|
36587
|
+
result = await semiont.browse.annotationHistory(resourceId3, annotationId3);
|
|
36481
36588
|
label = `history for annotation ${rawAnnotationId} on ${rawResourceId}`;
|
|
36482
36589
|
} else if (subcommand === "files") {
|
|
36483
36590
|
const dirPath = options.args[1];
|
|
@@ -37365,15 +37472,15 @@ var OutputFormatter = class {
|
|
|
37365
37472
|
`;
|
|
37366
37473
|
}
|
|
37367
37474
|
}
|
|
37368
|
-
const
|
|
37369
|
-
if (options.verbose &&
|
|
37370
|
-
const resourceInfo = this.formatResourceId(
|
|
37475
|
+
const resourceId3 = result.extensions?.resources || result.resourceId;
|
|
37476
|
+
if (options.verbose && resourceId3) {
|
|
37477
|
+
const resourceInfo = this.formatResourceId(resourceId3);
|
|
37371
37478
|
if (resourceInfo) {
|
|
37372
37479
|
output += ` ${c.dim}resource: ${resourceInfo}${c.reset}
|
|
37373
37480
|
`;
|
|
37374
37481
|
}
|
|
37375
|
-
if (
|
|
37376
|
-
output += ` ${c.cyan}console: ${
|
|
37482
|
+
if (resourceId3.aws?.consoleUrl) {
|
|
37483
|
+
output += ` ${c.cyan}console: ${resourceId3.aws.consoleUrl}${c.reset}
|
|
37377
37484
|
`;
|
|
37378
37485
|
}
|
|
37379
37486
|
}
|
|
@@ -37549,43 +37656,43 @@ var OutputFormatter = class {
|
|
|
37549
37656
|
/**
|
|
37550
37657
|
* Format resource identifier for display
|
|
37551
37658
|
*/
|
|
37552
|
-
static formatResourceId(
|
|
37553
|
-
if (!
|
|
37554
|
-
if (
|
|
37555
|
-
if (
|
|
37556
|
-
if (
|
|
37557
|
-
const parts =
|
|
37558
|
-
return parts[parts.length - 1] ||
|
|
37559
|
-
}
|
|
37560
|
-
const arnParts =
|
|
37659
|
+
static formatResourceId(resourceId3) {
|
|
37660
|
+
if (!resourceId3) return "-";
|
|
37661
|
+
if (resourceId3.aws) {
|
|
37662
|
+
if (resourceId3.aws.arn) {
|
|
37663
|
+
if (resourceId3.aws.arn.includes("/")) {
|
|
37664
|
+
const parts = resourceId3.aws.arn.split("/");
|
|
37665
|
+
return parts[parts.length - 1] || resourceId3.aws.arn;
|
|
37666
|
+
}
|
|
37667
|
+
const arnParts = resourceId3.aws.arn.split(":");
|
|
37561
37668
|
const resourcePart = arnParts[arnParts.length - 1] || "";
|
|
37562
37669
|
if (resourcePart.includes("/")) {
|
|
37563
37670
|
const subParts = resourcePart.split("/");
|
|
37564
37671
|
return subParts[subParts.length - 1];
|
|
37565
37672
|
}
|
|
37566
|
-
return resourcePart ||
|
|
37673
|
+
return resourcePart || resourceId3.aws.name || "AWS";
|
|
37567
37674
|
}
|
|
37568
|
-
return
|
|
37675
|
+
return resourceId3.aws.id || resourceId3.aws.name || "AWS";
|
|
37569
37676
|
}
|
|
37570
|
-
if (
|
|
37571
|
-
const name =
|
|
37572
|
-
const id =
|
|
37677
|
+
if (resourceId3.container) {
|
|
37678
|
+
const name = resourceId3.container.name || "";
|
|
37679
|
+
const id = resourceId3.container.id ? resourceId3.container.id.substring(0, 12) : "";
|
|
37573
37680
|
if (name && id) {
|
|
37574
37681
|
return `${name}:${id}`;
|
|
37575
37682
|
}
|
|
37576
37683
|
return name || id || "Container";
|
|
37577
37684
|
}
|
|
37578
|
-
if (
|
|
37579
|
-
if (
|
|
37580
|
-
return `PID:${
|
|
37685
|
+
if (resourceId3.process) {
|
|
37686
|
+
if (resourceId3.process.pid) {
|
|
37687
|
+
return `PID:${resourceId3.process.pid}`;
|
|
37581
37688
|
}
|
|
37582
|
-
return
|
|
37689
|
+
return resourceId3.process.path || "Process";
|
|
37583
37690
|
}
|
|
37584
|
-
if (
|
|
37585
|
-
return
|
|
37691
|
+
if (resourceId3.external) {
|
|
37692
|
+
return resourceId3.external.endpoint || resourceId3.external.path || "External";
|
|
37586
37693
|
}
|
|
37587
|
-
if (
|
|
37588
|
-
return
|
|
37694
|
+
if (resourceId3.mock) {
|
|
37695
|
+
return resourceId3.mock.id || "Mock";
|
|
37589
37696
|
}
|
|
37590
37697
|
return "-";
|
|
37591
37698
|
}
|
|
@@ -37875,7 +37982,7 @@ async function generateGlobalHelp() {
|
|
|
37875
37982
|
}
|
|
37876
37983
|
|
|
37877
37984
|
// src/cli.ts
|
|
37878
|
-
var VERSION = "0.
|
|
37985
|
+
var VERSION = "0.5.1";
|
|
37879
37986
|
function printVersion() {
|
|
37880
37987
|
console.log(`Semiont CLI v${VERSION}`);
|
|
37881
37988
|
}
|