@semiont/cli 0.2.2-build.11 → 0.2.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.
Files changed (2) hide show
  1. package/dist/cli.mjs +320 -1180
  2. package/package.json +4 -1
package/dist/cli.mjs CHANGED
@@ -15765,14 +15765,6 @@ var init_backend_paths = __esm({
15765
15765
  }
15766
15766
  });
15767
15767
 
15768
- // ../../packages/api-client/dist/types.js
15769
- var require_types = __commonJS({
15770
- "../../packages/api-client/dist/types.js"(exports) {
15771
- "use strict";
15772
- Object.defineProperty(exports, "__esModule", { value: true });
15773
- }
15774
- });
15775
-
15776
15768
  // ../../node_modules/ky/distribution/errors/HTTPError.js
15777
15769
  var HTTPError;
15778
15770
  var init_HTTPError = __esm({
@@ -16243,9 +16235,6 @@ var init_options = __esm({
16243
16235
  });
16244
16236
 
16245
16237
  // ../../node_modules/ky/distribution/utils/type-guards.js
16246
- function isKyError(error46) {
16247
- return isHTTPError(error46) || isTimeoutError(error46);
16248
- }
16249
16238
  function isHTTPError(error46) {
16250
16239
  return error46 instanceof HTTPError || error46?.name === HTTPError.name;
16251
16240
  }
@@ -16512,24 +16501,12 @@ var init_Ky = __esm({
16512
16501
  });
16513
16502
 
16514
16503
  // ../../node_modules/ky/distribution/index.js
16515
- var distribution_exports = {};
16516
- __export(distribution_exports, {
16517
- HTTPError: () => HTTPError,
16518
- TimeoutError: () => TimeoutError,
16519
- default: () => distribution_default,
16520
- isHTTPError: () => isHTTPError,
16521
- isKyError: () => isKyError,
16522
- isTimeoutError: () => isTimeoutError
16523
- });
16524
16504
  var createInstance, ky, distribution_default;
16525
16505
  var init_distribution = __esm({
16526
16506
  "../../node_modules/ky/distribution/index.js"() {
16527
16507
  init_Ky();
16528
16508
  init_constants();
16529
16509
  init_merge();
16530
- init_HTTPError();
16531
- init_TimeoutError();
16532
- init_type_guards();
16533
16510
  createInstance = (defaults2) => {
16534
16511
  const ky2 = (input, options) => Ky.create(input, validateAndMerge(defaults2, options));
16535
16512
  for (const method of requestMethods) {
@@ -16550,141 +16527,131 @@ var init_distribution = __esm({
16550
16527
  }
16551
16528
  });
16552
16529
 
16553
- // ../../packages/api-client/dist/sse/stream.js
16554
- var require_stream = __commonJS({
16555
- "../../packages/api-client/dist/sse/stream.js"(exports) {
16556
- "use strict";
16557
- Object.defineProperty(exports, "__esModule", { value: true });
16558
- exports.createSSEStream = createSSEStream;
16559
- function createSSEStream(url2, fetchOptions, config2) {
16560
- const abortController = new AbortController();
16561
- let progressCallback = null;
16562
- let completeCallback = null;
16563
- let errorCallback = null;
16564
- const customHandlers = /* @__PURE__ */ new Map();
16565
- let closed = false;
16566
- const connect = async () => {
16567
- try {
16568
- const response = await fetch(url2, {
16569
- ...fetchOptions,
16570
- signal: abortController.signal,
16571
- headers: {
16572
- ...fetchOptions.headers,
16573
- "Accept": "text/event-stream"
16574
- }
16575
- });
16576
- if (!response.ok) {
16577
- const errorData = await response.json().catch(() => ({}));
16578
- throw new Error(errorData.message || `HTTP ${response.status}: ${response.statusText}`);
16579
- }
16580
- if (!response.body) {
16581
- throw new Error("Response body is null - server did not return a stream");
16582
- }
16583
- const reader = response.body.getReader();
16584
- const decoder = new TextDecoder();
16585
- let buffer = "";
16586
- let eventType = "";
16587
- let eventData = "";
16588
- let eventId = "";
16589
- while (true) {
16590
- const { done, value } = await reader.read();
16591
- if (done || closed)
16592
- break;
16593
- buffer += decoder.decode(value, { stream: true });
16594
- const lines = buffer.split("\n");
16595
- buffer = lines.pop() || "";
16596
- for (const line of lines) {
16597
- if (line.startsWith("event:")) {
16598
- eventType = line.slice(6).trim();
16599
- } else if (line.startsWith("data:")) {
16600
- eventData = line.slice(5).trim();
16601
- } else if (line.startsWith("id:")) {
16602
- eventId = line.slice(3).trim();
16603
- } else if (line === "") {
16604
- if (eventData && !closed) {
16605
- handleEvent(eventType, eventData, eventId);
16606
- if (closed)
16607
- break;
16608
- eventType = "";
16609
- eventData = "";
16610
- eventId = "";
16611
- }
16612
- }
16613
- }
16614
- if (closed)
16615
- break;
16616
- }
16617
- } catch (error46) {
16618
- if (error46 instanceof Error && error46.name !== "AbortError") {
16619
- errorCallback?.(error46);
16620
- }
16530
+ // ../../packages/api-client/dist/index.js
16531
+ function createSSEStream(url2, fetchOptions, config2) {
16532
+ const abortController = new AbortController();
16533
+ let progressCallback = null;
16534
+ let completeCallback = null;
16535
+ let errorCallback = null;
16536
+ const customHandlers = /* @__PURE__ */ new Map();
16537
+ let closed = false;
16538
+ const connect = async () => {
16539
+ try {
16540
+ const response = await fetch(url2, {
16541
+ ...fetchOptions,
16542
+ signal: abortController.signal,
16543
+ headers: {
16544
+ ...fetchOptions.headers,
16545
+ "Accept": "text/event-stream"
16621
16546
  }
16622
- };
16623
- const handleEvent = (eventType, data, _id) => {
16624
- if (data.startsWith(":")) {
16547
+ });
16548
+ if (!response.ok) {
16549
+ const errorData = await response.json().catch(() => ({}));
16550
+ throw new Error(errorData.message || `HTTP ${response.status}: ${response.statusText}`);
16551
+ }
16552
+ if (!response.body) {
16553
+ throw new Error("Response body is null - server did not return a stream");
16554
+ }
16555
+ const reader = response.body.getReader();
16556
+ const decoder = new TextDecoder();
16557
+ let buffer = "";
16558
+ let eventType = "";
16559
+ let eventData = "";
16560
+ let eventId = "";
16561
+ while (true) {
16562
+ const { done, value } = await reader.read();
16563
+ if (done || closed) break;
16564
+ buffer += decoder.decode(value, { stream: true });
16565
+ const lines = buffer.split("\n");
16566
+ buffer = lines.pop() || "";
16567
+ for (const line of lines) {
16568
+ if (line.startsWith("event:")) {
16569
+ eventType = line.slice(6).trim();
16570
+ } else if (line.startsWith("data:")) {
16571
+ eventData = line.slice(5).trim();
16572
+ } else if (line.startsWith("id:")) {
16573
+ eventId = line.slice(3).trim();
16574
+ } else if (line === "") {
16575
+ if (eventData && !closed) {
16576
+ handleEvent(eventType, eventData, eventId);
16577
+ if (closed) break;
16578
+ eventType = "";
16579
+ eventData = "";
16580
+ eventId = "";
16581
+ }
16582
+ }
16583
+ }
16584
+ if (closed) break;
16585
+ }
16586
+ } catch (error46) {
16587
+ if (error46 instanceof Error && error46.name !== "AbortError") {
16588
+ errorCallback?.(error46);
16589
+ }
16590
+ }
16591
+ };
16592
+ const handleEvent = (eventType, data, _id) => {
16593
+ if (data.startsWith(":")) {
16594
+ return;
16595
+ }
16596
+ try {
16597
+ const parsed = JSON.parse(data);
16598
+ if (config2.customEventHandler) {
16599
+ const handler = customHandlers.get(eventType);
16600
+ if (handler) {
16601
+ handler(parsed);
16625
16602
  return;
16626
16603
  }
16627
- try {
16628
- const parsed = JSON.parse(data);
16629
- if (config2.customEventHandler) {
16630
- const handler = customHandlers.get(eventType);
16631
- if (handler) {
16632
- handler(parsed);
16633
- return;
16634
- }
16635
- progressCallback?.(parsed);
16636
- return;
16637
- }
16638
- if (config2.progressEvents.includes(eventType)) {
16639
- progressCallback?.(parsed);
16640
- }
16641
- if (config2.completeEvent && eventType === config2.completeEvent) {
16642
- completeCallback?.(parsed);
16643
- closed = true;
16644
- abortController.abort();
16645
- }
16646
- if (config2.errorEvent && eventType === config2.errorEvent) {
16647
- errorCallback?.(new Error(parsed.message || "Stream error"));
16648
- closed = true;
16649
- abortController.abort();
16650
- }
16651
- } catch (error46) {
16652
- console.error("[SSE] Failed to parse event data:", error46);
16653
- console.error("[SSE] Event type:", eventType);
16654
- console.error("[SSE] Data:", data);
16655
- }
16656
- };
16657
- connect();
16658
- return {
16659
- onProgress(callback) {
16660
- progressCallback = callback;
16661
- },
16662
- onComplete(callback) {
16663
- completeCallback = callback;
16664
- },
16665
- onError(callback) {
16666
- errorCallback = callback;
16667
- },
16668
- close() {
16669
- abortController.abort();
16670
- },
16671
- // Internal method for custom event handlers (used by resourceEvents)
16672
- on(event, callback) {
16673
- customHandlers.set(event, callback);
16674
- }
16675
- };
16604
+ progressCallback?.(parsed);
16605
+ return;
16606
+ }
16607
+ if (config2.progressEvents.includes(eventType)) {
16608
+ progressCallback?.(parsed);
16609
+ }
16610
+ if (config2.completeEvent && eventType === config2.completeEvent) {
16611
+ completeCallback?.(parsed);
16612
+ closed = true;
16613
+ abortController.abort();
16614
+ }
16615
+ if (config2.errorEvent && eventType === config2.errorEvent) {
16616
+ errorCallback?.(new Error(parsed.message || "Stream error"));
16617
+ closed = true;
16618
+ abortController.abort();
16619
+ }
16620
+ } catch (error46) {
16621
+ console.error("[SSE] Failed to parse event data:", error46);
16622
+ console.error("[SSE] Event type:", eventType);
16623
+ console.error("[SSE] Data:", data);
16676
16624
  }
16677
- }
16678
- });
16679
-
16680
- // ../../packages/api-client/dist/sse/index.js
16681
- var require_sse = __commonJS({
16682
- "../../packages/api-client/dist/sse/index.js"(exports) {
16625
+ };
16626
+ connect();
16627
+ return {
16628
+ onProgress(callback) {
16629
+ progressCallback = callback;
16630
+ },
16631
+ onComplete(callback) {
16632
+ completeCallback = callback;
16633
+ },
16634
+ onError(callback) {
16635
+ errorCallback = callback;
16636
+ },
16637
+ close() {
16638
+ abortController.abort();
16639
+ },
16640
+ // Internal method for custom event handlers (used by resourceEvents)
16641
+ on(event, callback) {
16642
+ customHandlers.set(event, callback);
16643
+ }
16644
+ };
16645
+ }
16646
+ function baseUrl(value) {
16647
+ return value;
16648
+ }
16649
+ var SSEClient, APIError, SemiontApiClient, LOCALES, localeByCode;
16650
+ var init_dist = __esm({
16651
+ "../../packages/api-client/dist/index.js"() {
16683
16652
  "use strict";
16684
- Object.defineProperty(exports, "__esModule", { value: true });
16685
- exports.SSEClient = void 0;
16686
- var stream_1 = require_stream();
16687
- var SSEClient = class {
16653
+ init_distribution();
16654
+ SSEClient = class {
16688
16655
  baseUrl;
16689
16656
  accessToken = null;
16690
16657
  constructor(config2) {
@@ -16762,15 +16729,19 @@ var require_sse = __commonJS({
16762
16729
  detectAnnotations(resourceId, request) {
16763
16730
  const id = this.extractId(resourceId);
16764
16731
  const url2 = `${this.baseUrl}/resources/${id}/detect-annotations-stream`;
16765
- return (0, stream_1.createSSEStream)(url2, {
16766
- method: "POST",
16767
- headers: this.getHeaders(),
16768
- body: JSON.stringify(request)
16769
- }, {
16770
- progressEvents: ["detection-started", "detection-progress"],
16771
- completeEvent: "detection-complete",
16772
- errorEvent: "detection-error"
16773
- });
16732
+ return createSSEStream(
16733
+ url2,
16734
+ {
16735
+ method: "POST",
16736
+ headers: this.getHeaders(),
16737
+ body: JSON.stringify(request)
16738
+ },
16739
+ {
16740
+ progressEvents: ["detection-started", "detection-progress"],
16741
+ completeEvent: "detection-complete",
16742
+ errorEvent: "detection-error"
16743
+ }
16744
+ );
16774
16745
  }
16775
16746
  /**
16776
16747
  * Generate resource from annotation (streaming)
@@ -16811,15 +16782,19 @@ var require_sse = __commonJS({
16811
16782
  const resId = this.extractId(resourceId);
16812
16783
  const annId = this.extractId(annotationId);
16813
16784
  const url2 = `${this.baseUrl}/resources/${resId}/annotations/${annId}/generate-resource-stream`;
16814
- return (0, stream_1.createSSEStream)(url2, {
16815
- method: "POST",
16816
- headers: this.getHeaders(),
16817
- body: JSON.stringify(request)
16818
- }, {
16819
- progressEvents: ["generation-started", "generation-progress"],
16820
- completeEvent: "generation-complete",
16821
- errorEvent: "generation-error"
16822
- });
16785
+ return createSSEStream(
16786
+ url2,
16787
+ {
16788
+ method: "POST",
16789
+ headers: this.getHeaders(),
16790
+ body: JSON.stringify(request)
16791
+ },
16792
+ {
16793
+ progressEvents: ["generation-started", "generation-progress"],
16794
+ completeEvent: "generation-complete",
16795
+ errorEvent: "generation-error"
16796
+ }
16797
+ );
16823
16798
  }
16824
16799
  /**
16825
16800
  * Detect highlights in a resource (streaming)
@@ -16857,15 +16832,19 @@ var require_sse = __commonJS({
16857
16832
  detectHighlights(resourceId, request = {}) {
16858
16833
  const id = this.extractId(resourceId);
16859
16834
  const url2 = `${this.baseUrl}/resources/${id}/detect-highlights-stream`;
16860
- return (0, stream_1.createSSEStream)(url2, {
16861
- method: "POST",
16862
- headers: this.getHeaders(),
16863
- body: JSON.stringify(request)
16864
- }, {
16865
- progressEvents: ["highlight-detection-started", "highlight-detection-progress"],
16866
- completeEvent: "highlight-detection-complete",
16867
- errorEvent: "highlight-detection-error"
16868
- });
16835
+ return createSSEStream(
16836
+ url2,
16837
+ {
16838
+ method: "POST",
16839
+ headers: this.getHeaders(),
16840
+ body: JSON.stringify(request)
16841
+ },
16842
+ {
16843
+ progressEvents: ["highlight-detection-started", "highlight-detection-progress"],
16844
+ completeEvent: "highlight-detection-complete",
16845
+ errorEvent: "highlight-detection-error"
16846
+ }
16847
+ );
16869
16848
  }
16870
16849
  /**
16871
16850
  * Detect assessments in a resource (streaming)
@@ -16903,15 +16882,19 @@ var require_sse = __commonJS({
16903
16882
  detectAssessments(resourceId, request = {}) {
16904
16883
  const id = this.extractId(resourceId);
16905
16884
  const url2 = `${this.baseUrl}/resources/${id}/detect-assessments-stream`;
16906
- return (0, stream_1.createSSEStream)(url2, {
16907
- method: "POST",
16908
- headers: this.getHeaders(),
16909
- body: JSON.stringify(request)
16910
- }, {
16911
- progressEvents: ["assessment-detection-started", "assessment-detection-progress"],
16912
- completeEvent: "assessment-detection-complete",
16913
- errorEvent: "assessment-detection-error"
16914
- });
16885
+ return createSSEStream(
16886
+ url2,
16887
+ {
16888
+ method: "POST",
16889
+ headers: this.getHeaders(),
16890
+ body: JSON.stringify(request)
16891
+ },
16892
+ {
16893
+ progressEvents: ["assessment-detection-started", "assessment-detection-progress"],
16894
+ completeEvent: "assessment-detection-complete",
16895
+ errorEvent: "assessment-detection-error"
16896
+ }
16897
+ );
16915
16898
  }
16916
16899
  /**
16917
16900
  * Detect comments in a resource (streaming)
@@ -16950,15 +16933,19 @@ var require_sse = __commonJS({
16950
16933
  detectComments(resourceId, request = {}) {
16951
16934
  const id = this.extractId(resourceId);
16952
16935
  const url2 = `${this.baseUrl}/resources/${id}/detect-comments-stream`;
16953
- return (0, stream_1.createSSEStream)(url2, {
16954
- method: "POST",
16955
- headers: this.getHeaders(),
16956
- body: JSON.stringify(request)
16957
- }, {
16958
- progressEvents: ["comment-detection-started", "comment-detection-progress"],
16959
- completeEvent: "comment-detection-complete",
16960
- errorEvent: "comment-detection-error"
16961
- });
16936
+ return createSSEStream(
16937
+ url2,
16938
+ {
16939
+ method: "POST",
16940
+ headers: this.getHeaders(),
16941
+ body: JSON.stringify(request)
16942
+ },
16943
+ {
16944
+ progressEvents: ["comment-detection-started", "comment-detection-progress"],
16945
+ completeEvent: "comment-detection-complete",
16946
+ errorEvent: "comment-detection-error"
16947
+ }
16948
+ );
16962
16949
  }
16963
16950
  /**
16964
16951
  * Detect tags in a resource (streaming)
@@ -16998,15 +16985,19 @@ var require_sse = __commonJS({
16998
16985
  detectTags(resourceId, request) {
16999
16986
  const id = this.extractId(resourceId);
17000
16987
  const url2 = `${this.baseUrl}/resources/${id}/detect-tags-stream`;
17001
- return (0, stream_1.createSSEStream)(url2, {
17002
- method: "POST",
17003
- headers: this.getHeaders(),
17004
- body: JSON.stringify(request)
17005
- }, {
17006
- progressEvents: ["tag-detection-started", "tag-detection-progress"],
17007
- completeEvent: "tag-detection-complete",
17008
- errorEvent: "tag-detection-error"
17009
- });
16988
+ return createSSEStream(
16989
+ url2,
16990
+ {
16991
+ method: "POST",
16992
+ headers: this.getHeaders(),
16993
+ body: JSON.stringify(request)
16994
+ },
16995
+ {
16996
+ progressEvents: ["tag-detection-started", "tag-detection-progress"],
16997
+ completeEvent: "tag-detection-complete",
16998
+ errorEvent: "tag-detection-error"
16999
+ }
17000
+ );
17010
17001
  }
17011
17002
  /**
17012
17003
  * Subscribe to resource events (long-lived stream)
@@ -17041,40 +17032,26 @@ var require_sse = __commonJS({
17041
17032
  resourceEvents(resourceId) {
17042
17033
  const id = this.extractId(resourceId);
17043
17034
  const url2 = `${this.baseUrl}/resources/${id}/events/stream`;
17044
- return (0, stream_1.createSSEStream)(url2, {
17045
- method: "GET",
17046
- headers: this.getHeaders()
17047
- }, {
17048
- progressEvents: ["*"],
17049
- // Accept all event types
17050
- completeEvent: null,
17051
- // Long-lived stream - no completion
17052
- errorEvent: "error",
17053
- // Generic error event
17054
- customEventHandler: true
17055
- // Use custom event handling
17056
- });
17035
+ return createSSEStream(
17036
+ url2,
17037
+ {
17038
+ method: "GET",
17039
+ headers: this.getHeaders()
17040
+ },
17041
+ {
17042
+ progressEvents: ["*"],
17043
+ // Accept all event types
17044
+ completeEvent: null,
17045
+ // Long-lived stream - no completion
17046
+ errorEvent: "error",
17047
+ // Generic error event
17048
+ customEventHandler: true
17049
+ // Use custom event handling
17050
+ }
17051
+ );
17057
17052
  }
17058
17053
  };
17059
- exports.SSEClient = SSEClient;
17060
- }
17061
- });
17062
-
17063
- // ../../packages/api-client/dist/client.js
17064
- var require_client = __commonJS({
17065
- "../../packages/api-client/dist/client.js"(exports) {
17066
- "use strict";
17067
- var __importDefault = exports && exports.__importDefault || function(mod) {
17068
- return mod && mod.__esModule ? mod : { "default": mod };
17069
- };
17070
- Object.defineProperty(exports, "__esModule", { value: true });
17071
- exports.SemiontApiClient = exports.APIError = void 0;
17072
- var ky_1 = __importDefault((init_distribution(), __toCommonJS(distribution_exports)));
17073
- var sse_1 = require_sse();
17074
- var APIError3 = class extends Error {
17075
- status;
17076
- statusText;
17077
- details;
17054
+ APIError = class extends Error {
17078
17055
  constructor(message, status, statusText, details) {
17079
17056
  super(message);
17080
17057
  this.status = status;
@@ -17083,8 +17060,7 @@ var require_client = __commonJS({
17083
17060
  this.name = "APIError";
17084
17061
  }
17085
17062
  };
17086
- exports.APIError = APIError3;
17087
- var SemiontApiClient3 = class {
17063
+ SemiontApiClient = class {
17088
17064
  http;
17089
17065
  baseUrl;
17090
17066
  accessToken = null;
@@ -17108,9 +17084,9 @@ var require_client = __commonJS({
17108
17084
  */
17109
17085
  sse;
17110
17086
  constructor(config2) {
17111
- const { baseUrl: baseUrl3, accessToken, timeout: timeout2 = 3e4, retry = 2 } = config2;
17112
- this.baseUrl = baseUrl3.endsWith("/") ? baseUrl3.slice(0, -1) : baseUrl3;
17113
- this.http = ky_1.default.create({
17087
+ const { baseUrl: baseUrl2, accessToken: accessToken2, timeout: timeout2 = 3e4, retry = 2 } = config2;
17088
+ this.baseUrl = baseUrl2.endsWith("/") ? baseUrl2.slice(0, -1) : baseUrl2;
17089
+ this.http = distribution_default.create({
17114
17090
  timeout: timeout2,
17115
17091
  retry,
17116
17092
  hooks: {
@@ -17126,17 +17102,22 @@ var require_client = __commonJS({
17126
17102
  const { response } = error46;
17127
17103
  if (response) {
17128
17104
  const body = await response.json().catch(() => ({}));
17129
- throw new APIError3(body.message || `HTTP ${response.status}: ${response.statusText}`, response.status, response.statusText, body);
17105
+ throw new APIError(
17106
+ body.message || `HTTP ${response.status}: ${response.statusText}`,
17107
+ response.status,
17108
+ response.statusText,
17109
+ body
17110
+ );
17130
17111
  }
17131
17112
  return error46;
17132
17113
  }
17133
17114
  ]
17134
17115
  }
17135
17116
  });
17136
- if (accessToken) {
17137
- this.accessToken = accessToken;
17117
+ if (accessToken2) {
17118
+ this.accessToken = accessToken2;
17138
17119
  }
17139
- this.sse = new sse_1.SSEClient({
17120
+ this.sse = new SSEClient({
17140
17121
  baseUrl: this.baseUrl,
17141
17122
  accessToken: this.accessToken || void 0
17142
17123
  });
@@ -17158,8 +17139,8 @@ var require_client = __commonJS({
17158
17139
  // ============================================================================
17159
17140
  // AUTHENTICATION
17160
17141
  // ============================================================================
17161
- async authenticatePassword(email3, password) {
17162
- const response = await this.http.post(`${this.baseUrl}/api/tokens/password`, { json: { email: email3, password } }).json();
17142
+ async authenticatePassword(email22, password) {
17143
+ const response = await this.http.post(`${this.baseUrl}/api/tokens/password`, { json: { email: email22, password } }).json();
17163
17144
  if (response.token) {
17164
17145
  this.setAccessToken(response.token);
17165
17146
  }
@@ -17239,8 +17220,8 @@ var require_client = __commonJS({
17239
17220
  }
17240
17221
  return this.http.post(`${this.baseUrl}/resources`, { body: formData }).json();
17241
17222
  }
17242
- async getResource(resourceUri) {
17243
- return this.http.get(resourceUri).json();
17223
+ async getResource(resourceUri2) {
17224
+ return this.http.get(resourceUri2).json();
17244
17225
  }
17245
17226
  /**
17246
17227
  * Get resource representation using W3C content negotiation
@@ -17264,8 +17245,8 @@ var require_client = __commonJS({
17264
17245
  * const { data, contentType } = await client.getResourceRepresentation(rUri, { accept: 'application/pdf' });
17265
17246
  * ```
17266
17247
  */
17267
- async getResourceRepresentation(resourceUri, options) {
17268
- const response = await this.http.get(resourceUri, {
17248
+ async getResourceRepresentation(resourceUri2, options) {
17249
+ const response = await this.http.get(resourceUri2, {
17269
17250
  headers: {
17270
17251
  Accept: options?.accept || "text/plain"
17271
17252
  }
@@ -17309,8 +17290,8 @@ var require_client = __commonJS({
17309
17290
  * }
17310
17291
  * ```
17311
17292
  */
17312
- async getResourceRepresentationStream(resourceUri, options) {
17313
- const response = await this.http.get(resourceUri, {
17293
+ async getResourceRepresentationStream(resourceUri2, options) {
17294
+ const response = await this.http.get(resourceUri2, {
17314
17295
  headers: {
17315
17296
  Accept: options?.accept || "text/plain"
17316
17297
  }
@@ -17323,35 +17304,35 @@ var require_client = __commonJS({
17323
17304
  }
17324
17305
  async listResources(limit2, archived, query) {
17325
17306
  const searchParams = new URLSearchParams();
17326
- if (limit2)
17327
- searchParams.append("limit", limit2.toString());
17328
- if (archived !== void 0)
17329
- searchParams.append("archived", archived.toString());
17330
- if (query)
17331
- searchParams.append("q", query);
17307
+ if (limit2) searchParams.append("limit", limit2.toString());
17308
+ if (archived !== void 0) searchParams.append("archived", archived.toString());
17309
+ if (query) searchParams.append("q", query);
17332
17310
  return this.http.get(`${this.baseUrl}/resources`, { searchParams }).json();
17333
17311
  }
17334
- async updateResource(resourceUri, data) {
17335
- return this.http.patch(resourceUri, { json: data }).json();
17312
+ async updateResource(resourceUri2, data) {
17313
+ return this.http.patch(resourceUri2, { json: data }).json();
17336
17314
  }
17337
- async getResourceEvents(resourceUri) {
17338
- return this.http.get(`${resourceUri}/events`).json();
17315
+ async getResourceEvents(resourceUri2) {
17316
+ return this.http.get(`${resourceUri2}/events`).json();
17339
17317
  }
17340
- async getResourceAnnotations(resourceUri) {
17341
- return this.http.get(`${resourceUri}/annotations`).json();
17318
+ async getResourceAnnotations(resourceUri2) {
17319
+ return this.http.get(`${resourceUri2}/annotations`).json();
17342
17320
  }
17343
- async getAnnotationLLMContext(resourceUri, annotationId, options) {
17321
+ async getAnnotationLLMContext(resourceUri2, annotationId, options) {
17344
17322
  const searchParams = new URLSearchParams();
17345
17323
  if (options?.contextWindow) {
17346
17324
  searchParams.append("contextWindow", options.contextWindow.toString());
17347
17325
  }
17348
- return this.http.get(`${resourceUri}/annotations/${annotationId}/llm-context`, { searchParams }).json();
17326
+ return this.http.get(
17327
+ `${resourceUri2}/annotations/${annotationId}/llm-context`,
17328
+ { searchParams }
17329
+ ).json();
17349
17330
  }
17350
- async getResourceReferencedBy(resourceUri) {
17351
- return this.http.get(`${resourceUri}/referenced-by`).json();
17331
+ async getResourceReferencedBy(resourceUri2) {
17332
+ return this.http.get(`${resourceUri2}/referenced-by`).json();
17352
17333
  }
17353
- async generateCloneToken(resourceUri) {
17354
- return this.http.post(`${resourceUri}/clone-with-token`).json();
17334
+ async generateCloneToken(resourceUri2) {
17335
+ return this.http.post(`${resourceUri2}/clone-with-token`).json();
17355
17336
  }
17356
17337
  async getResourceByToken(token) {
17357
17338
  return this.http.get(`${this.baseUrl}/api/resources/token/${token}`).json();
@@ -17362,31 +17343,30 @@ var require_client = __commonJS({
17362
17343
  // ============================================================================
17363
17344
  // ANNOTATIONS
17364
17345
  // ============================================================================
17365
- async createAnnotation(resourceUri, data) {
17366
- return this.http.post(`${resourceUri}/annotations`, { json: data }).json();
17346
+ async createAnnotation(resourceUri2, data) {
17347
+ return this.http.post(`${resourceUri2}/annotations`, { json: data }).json();
17367
17348
  }
17368
- async getAnnotation(annotationUri) {
17369
- return this.http.get(annotationUri).json();
17349
+ async getAnnotation(annotationUri2) {
17350
+ return this.http.get(annotationUri2).json();
17370
17351
  }
17371
- async getResourceAnnotation(annotationUri) {
17372
- return this.http.get(annotationUri).json();
17352
+ async getResourceAnnotation(annotationUri2) {
17353
+ return this.http.get(annotationUri2).json();
17373
17354
  }
17374
- async listAnnotations(resourceUri, motivation) {
17355
+ async listAnnotations(resourceUri2, motivation) {
17375
17356
  const searchParams = new URLSearchParams();
17376
- if (motivation)
17377
- searchParams.append("motivation", motivation);
17378
- return this.http.get(`${resourceUri}/annotations`, { searchParams }).json();
17357
+ if (motivation) searchParams.append("motivation", motivation);
17358
+ return this.http.get(`${resourceUri2}/annotations`, { searchParams }).json();
17379
17359
  }
17380
- async deleteAnnotation(annotationUri) {
17381
- await this.http.delete(annotationUri);
17360
+ async deleteAnnotation(annotationUri2) {
17361
+ await this.http.delete(annotationUri2);
17382
17362
  }
17383
- async updateAnnotationBody(annotationUri, data) {
17384
- return this.http.put(`${annotationUri}/body`, {
17363
+ async updateAnnotationBody(annotationUri2, data) {
17364
+ return this.http.put(`${annotationUri2}/body`, {
17385
17365
  json: data
17386
17366
  }).json();
17387
17367
  }
17388
- async getAnnotationHistory(annotationUri) {
17389
- return this.http.get(`${annotationUri}/history`).json();
17368
+ async getAnnotationHistory(annotationUri2) {
17369
+ return this.http.get(`${annotationUri2}/history`).json();
17390
17370
  }
17391
17371
  // ============================================================================
17392
17372
  // ENTITY TYPES
@@ -17452,17 +17432,13 @@ var require_client = __commonJS({
17452
17432
  // ============================================================================
17453
17433
  // LLM CONTEXT
17454
17434
  // ============================================================================
17455
- async getResourceLLMContext(resourceUri, options) {
17435
+ async getResourceLLMContext(resourceUri2, options) {
17456
17436
  const searchParams = new URLSearchParams();
17457
- if (options?.depth !== void 0)
17458
- searchParams.append("depth", options.depth.toString());
17459
- if (options?.maxResources !== void 0)
17460
- searchParams.append("maxResources", options.maxResources.toString());
17461
- if (options?.includeContent !== void 0)
17462
- searchParams.append("includeContent", options.includeContent.toString());
17463
- if (options?.includeSummary !== void 0)
17464
- searchParams.append("includeSummary", options.includeSummary.toString());
17465
- return this.http.get(`${resourceUri}/llm-context`, { searchParams }).json();
17437
+ if (options?.depth !== void 0) searchParams.append("depth", options.depth.toString());
17438
+ if (options?.maxResources !== void 0) searchParams.append("maxResources", options.maxResources.toString());
17439
+ if (options?.includeContent !== void 0) searchParams.append("includeContent", options.includeContent.toString());
17440
+ if (options?.includeSummary !== void 0) searchParams.append("includeSummary", options.includeSummary.toString());
17441
+ return this.http.get(`${resourceUri2}/llm-context`, { searchParams }).json();
17466
17442
  }
17467
17443
  // ============================================================================
17468
17444
  // SYSTEM STATUS
@@ -17474,621 +17450,7 @@ var require_client = __commonJS({
17474
17450
  return this.http.get(`${this.baseUrl}/api/status`).json();
17475
17451
  }
17476
17452
  };
17477
- exports.SemiontApiClient = SemiontApiClient3;
17478
- }
17479
- });
17480
-
17481
- // ../../packages/api-client/dist/branded-types.js
17482
- var require_branded_types = __commonJS({
17483
- "../../packages/api-client/dist/branded-types.js"(exports) {
17484
- "use strict";
17485
- Object.defineProperty(exports, "__esModule", { value: true });
17486
- exports.email = email3;
17487
- exports.authCode = authCode;
17488
- exports.googleCredential = googleCredential;
17489
- exports.accessToken = accessToken;
17490
- exports.refreshToken = refreshToken;
17491
- exports.mcpToken = mcpToken;
17492
- exports.cloneToken = cloneToken;
17493
- exports.jobId = jobId;
17494
- exports.userDID = userDID;
17495
- exports.entityType = entityType;
17496
- exports.searchQuery = searchQuery;
17497
- exports.baseUrl = baseUrl3;
17498
- exports.resourceUri = resourceUri;
17499
- exports.annotationUri = annotationUri;
17500
- exports.resourceAnnotationUri = resourceAnnotationUri;
17501
- function email3(value) {
17502
- return value;
17503
- }
17504
- function authCode(value) {
17505
- return value;
17506
- }
17507
- function googleCredential(value) {
17508
- return value;
17509
- }
17510
- function accessToken(value) {
17511
- return value;
17512
- }
17513
- function refreshToken(value) {
17514
- return value;
17515
- }
17516
- function mcpToken(value) {
17517
- return value;
17518
- }
17519
- function cloneToken(value) {
17520
- return value;
17521
- }
17522
- function jobId(value) {
17523
- return value;
17524
- }
17525
- function userDID(value) {
17526
- return value;
17527
- }
17528
- function entityType(value) {
17529
- return value;
17530
- }
17531
- function searchQuery(value) {
17532
- return value;
17533
- }
17534
- function baseUrl3(value) {
17535
- return value;
17536
- }
17537
- function resourceUri(uri) {
17538
- if (!uri.startsWith("http://") && !uri.startsWith("https://")) {
17539
- throw new TypeError(`Expected ResourceUri, got: ${uri}`);
17540
- }
17541
- return uri;
17542
- }
17543
- function annotationUri(uri) {
17544
- if (!uri.startsWith("http://") && !uri.startsWith("https://")) {
17545
- throw new TypeError(`Expected AnnotationUri, got: ${uri}`);
17546
- }
17547
- return uri;
17548
- }
17549
- function resourceAnnotationUri(uri) {
17550
- if (!uri.startsWith("http://") && !uri.startsWith("https://")) {
17551
- throw new TypeError(`Expected ResourceAnnotationUri, got: ${uri}`);
17552
- }
17553
- if (!uri.includes("/resources/") || !uri.includes("/annotations/")) {
17554
- throw new TypeError(`Expected nested ResourceAnnotationUri format, got: ${uri}`);
17555
- }
17556
- return uri;
17557
- }
17558
- }
17559
- });
17560
-
17561
- // ../../packages/api-client/dist/utils/annotations.js
17562
- var require_annotations = __commonJS({
17563
- "../../packages/api-client/dist/utils/annotations.js"(exports) {
17564
- "use strict";
17565
- Object.defineProperty(exports, "__esModule", { value: true });
17566
- exports.getBodySource = getBodySource;
17567
- exports.getBodyType = getBodyType;
17568
- exports.isBodyResolved = isBodyResolved;
17569
- exports.getTargetSource = getTargetSource;
17570
- exports.getTargetSelector = getTargetSelector;
17571
- exports.hasTargetSelector = hasTargetSelector;
17572
- exports.getEntityTypes = getEntityTypes;
17573
- exports.isHighlight = isHighlight;
17574
- exports.isReference = isReference;
17575
- exports.isAssessment = isAssessment;
17576
- exports.isComment = isComment;
17577
- exports.isTag = isTag;
17578
- exports.getCommentText = getCommentText;
17579
- exports.getTagCategory = getTagCategory;
17580
- exports.getTagSchemaId = getTagSchemaId;
17581
- exports.isStubReference = isStubReference;
17582
- exports.isResolvedReference = isResolvedReference;
17583
- exports.getExactText = getExactText;
17584
- exports.getAnnotationExactText = getAnnotationExactText;
17585
- exports.getPrimarySelector = getPrimarySelector;
17586
- exports.getTextPositionSelector = getTextPositionSelector;
17587
- exports.getTextQuoteSelector = getTextQuoteSelector;
17588
- exports.getSvgSelector = getSvgSelector;
17589
- exports.validateSvgMarkup = validateSvgMarkup;
17590
- exports.extractBoundingBox = extractBoundingBox;
17591
- var branded_types_1 = require_branded_types();
17592
- function getBodySource(body) {
17593
- if (Array.isArray(body)) {
17594
- for (const item of body) {
17595
- if (typeof item === "object" && item !== null && "type" in item && "source" in item) {
17596
- const itemType = item.type;
17597
- const itemSource = item.source;
17598
- if (itemType === "SpecificResource" && typeof itemSource === "string") {
17599
- return (0, branded_types_1.resourceUri)(itemSource);
17600
- }
17601
- }
17602
- }
17603
- return null;
17604
- }
17605
- if (typeof body === "object" && body !== null && "type" in body && "source" in body) {
17606
- const bodyType = body.type;
17607
- const bodySource = body.source;
17608
- if (bodyType === "SpecificResource" && typeof bodySource === "string") {
17609
- return (0, branded_types_1.resourceUri)(bodySource);
17610
- }
17611
- }
17612
- return null;
17613
- }
17614
- function getBodyType(body) {
17615
- if (Array.isArray(body)) {
17616
- if (body.length === 0) {
17617
- return null;
17618
- }
17619
- if (typeof body[0] === "object" && body[0] !== null && "type" in body[0]) {
17620
- const firstType = body[0].type;
17621
- if (firstType === "TextualBody" || firstType === "SpecificResource") {
17622
- return firstType;
17623
- }
17624
- }
17625
- return null;
17626
- }
17627
- if (typeof body === "object" && body !== null && "type" in body) {
17628
- const bodyType = body.type;
17629
- if (bodyType === "TextualBody" || bodyType === "SpecificResource") {
17630
- return bodyType;
17631
- }
17632
- }
17633
- return null;
17634
- }
17635
- function isBodyResolved(body) {
17636
- return getBodySource(body) !== null;
17637
- }
17638
- function getTargetSource(target) {
17639
- if (typeof target === "string") {
17640
- return (0, branded_types_1.resourceUri)(target);
17641
- }
17642
- return (0, branded_types_1.resourceUri)(target.source);
17643
- }
17644
- function getTargetSelector(target) {
17645
- if (typeof target === "string") {
17646
- return void 0;
17647
- }
17648
- return target.selector;
17649
- }
17650
- function hasTargetSelector(target) {
17651
- return typeof target !== "string" && target.selector !== void 0;
17652
- }
17653
- function getEntityTypes(annotation) {
17654
- if (Array.isArray(annotation.body)) {
17655
- const entityTags = [];
17656
- for (const item of annotation.body) {
17657
- if (typeof item === "object" && item !== null && "type" in item && "value" in item && "purpose" in item) {
17658
- const itemType = item.type;
17659
- const itemValue = item.value;
17660
- const itemPurpose = item.purpose;
17661
- if (itemType === "TextualBody" && itemPurpose === "tagging" && typeof itemValue === "string" && itemValue.length > 0) {
17662
- entityTags.push(itemValue);
17663
- }
17664
- }
17665
- }
17666
- return entityTags;
17667
- }
17668
- return [];
17669
- }
17670
- function isHighlight(annotation) {
17671
- return annotation.motivation === "highlighting";
17672
- }
17673
- function isReference(annotation) {
17674
- return annotation.motivation === "linking";
17675
- }
17676
- function isAssessment(annotation) {
17677
- return annotation.motivation === "assessing";
17678
- }
17679
- function isComment(annotation) {
17680
- return annotation.motivation === "commenting";
17681
- }
17682
- function isTag(annotation) {
17683
- return annotation.motivation === "tagging";
17684
- }
17685
- function getCommentText(annotation) {
17686
- if (!isComment(annotation))
17687
- return void 0;
17688
- const body = Array.isArray(annotation.body) ? annotation.body[0] : annotation.body;
17689
- if (body && "value" in body) {
17690
- return body.value;
17691
- }
17692
- return void 0;
17693
- }
17694
- function getTagCategory(annotation) {
17695
- if (!isTag(annotation))
17696
- return void 0;
17697
- const bodies = Array.isArray(annotation.body) ? annotation.body : [annotation.body];
17698
- const taggingBody = bodies.find((b) => b && "purpose" in b && b.purpose === "tagging");
17699
- if (taggingBody && "value" in taggingBody) {
17700
- return taggingBody.value;
17701
- }
17702
- return void 0;
17703
- }
17704
- function getTagSchemaId(annotation) {
17705
- if (!isTag(annotation))
17706
- return void 0;
17707
- const bodies = Array.isArray(annotation.body) ? annotation.body : [annotation.body];
17708
- const classifyingBody = bodies.find((b) => b && "purpose" in b && b.purpose === "classifying");
17709
- if (classifyingBody && "value" in classifyingBody) {
17710
- return classifyingBody.value;
17711
- }
17712
- return void 0;
17713
- }
17714
- function isStubReference(annotation) {
17715
- return isReference(annotation) && !isBodyResolved(annotation.body);
17716
- }
17717
- function isResolvedReference(annotation) {
17718
- return isReference(annotation) && isBodyResolved(annotation.body);
17719
- }
17720
- function getExactText(selector) {
17721
- if (!selector) {
17722
- return "";
17723
- }
17724
- const selectors = Array.isArray(selector) ? selector : [selector];
17725
- const quoteSelector = selectors.find((s) => s.type === "TextQuoteSelector");
17726
- if (quoteSelector) {
17727
- return quoteSelector.exact;
17728
- }
17729
- return "";
17730
- }
17731
- function getAnnotationExactText(annotation) {
17732
- const selector = getTargetSelector(annotation.target);
17733
- return getExactText(selector);
17734
- }
17735
- function getPrimarySelector(selector) {
17736
- if (Array.isArray(selector)) {
17737
- if (selector.length === 0) {
17738
- throw new Error("Empty selector array");
17739
- }
17740
- const first = selector[0];
17741
- if (!first) {
17742
- throw new Error("Invalid selector array");
17743
- }
17744
- return first;
17745
- }
17746
- return selector;
17747
- }
17748
- function getTextPositionSelector(selector) {
17749
- if (!selector)
17750
- return null;
17751
- const selectors = Array.isArray(selector) ? selector : [selector];
17752
- const found = selectors.find((s) => s.type === "TextPositionSelector");
17753
- if (!found)
17754
- return null;
17755
- return found.type === "TextPositionSelector" ? found : null;
17756
- }
17757
- function getTextQuoteSelector(selector) {
17758
- const selectors = Array.isArray(selector) ? selector : [selector];
17759
- const found = selectors.find((s) => s.type === "TextQuoteSelector");
17760
- if (!found)
17761
- return null;
17762
- return found.type === "TextQuoteSelector" ? found : null;
17763
- }
17764
- function getSvgSelector(selector) {
17765
- if (!selector)
17766
- return null;
17767
- const selectors = Array.isArray(selector) ? selector : [selector];
17768
- const found = selectors.find((s) => s.type === "SvgSelector");
17769
- if (!found)
17770
- return null;
17771
- return found.type === "SvgSelector" ? found : null;
17772
- }
17773
- function validateSvgMarkup(svg) {
17774
- if (!svg.includes('xmlns="http://www.w3.org/2000/svg"')) {
17775
- return 'SVG must include xmlns="http://www.w3.org/2000/svg" attribute';
17776
- }
17777
- if (!svg.includes("<svg") || !svg.includes("</svg>")) {
17778
- return "SVG must have opening and closing tags";
17779
- }
17780
- const shapeElements = ["rect", "circle", "ellipse", "polygon", "polyline", "path", "line"];
17781
- const hasShape = shapeElements.some((shape) => svg.includes(`<${shape}`) || svg.includes(`<${shape} `));
17782
- if (!hasShape) {
17783
- return "SVG must contain at least one shape element (rect, circle, ellipse, polygon, polyline, path, or line)";
17784
- }
17785
- return null;
17786
- }
17787
- function extractBoundingBox(svg) {
17788
- const viewBoxMatch = svg.match(/<svg[^>]*viewBox="([^"]+)"/);
17789
- if (viewBoxMatch) {
17790
- const values = viewBoxMatch[1].split(/\s+/).map(parseFloat);
17791
- if (values.length === 4 && values.every((v) => !isNaN(v))) {
17792
- return {
17793
- x: values[0],
17794
- y: values[1],
17795
- width: values[2],
17796
- height: values[3]
17797
- };
17798
- }
17799
- }
17800
- const svgTagMatch = svg.match(/<svg[^>]*>/);
17801
- if (svgTagMatch) {
17802
- const svgTag = svgTagMatch[0];
17803
- const widthMatch = svgTag.match(/width="([^"]+)"/);
17804
- const heightMatch = svgTag.match(/height="([^"]+)"/);
17805
- if (widthMatch && heightMatch) {
17806
- const width = parseFloat(widthMatch[1]);
17807
- const height = parseFloat(heightMatch[1]);
17808
- if (!isNaN(width) && !isNaN(height)) {
17809
- return { x: 0, y: 0, width, height };
17810
- }
17811
- }
17812
- }
17813
- return null;
17814
- }
17815
- }
17816
- });
17817
-
17818
- // ../../packages/api-client/dist/utils/events.js
17819
- var require_events = __commonJS({
17820
- "../../packages/api-client/dist/utils/events.js"(exports) {
17821
- "use strict";
17822
- Object.defineProperty(exports, "__esModule", { value: true });
17823
- exports.getAnnotationUriFromEvent = getAnnotationUriFromEvent;
17824
- exports.isEventRelatedToAnnotation = isEventRelatedToAnnotation;
17825
- exports.isResourceEvent = isResourceEvent;
17826
- exports.formatEventType = formatEventType;
17827
- exports.getEventEmoji = getEventEmoji;
17828
- exports.formatRelativeTime = formatRelativeTime;
17829
- exports.getEventDisplayContent = getEventDisplayContent;
17830
- exports.getEventEntityTypes = getEventEntityTypes;
17831
- exports.getResourceCreationDetails = getResourceCreationDetails;
17832
- var annotations_1 = require_annotations();
17833
- function getAnnotationUriFromEvent(event) {
17834
- const eventData = event.event;
17835
- const payload = eventData.payload;
17836
- if (!payload) {
17837
- return null;
17838
- }
17839
- switch (eventData.type) {
17840
- case "annotation.added":
17841
- return payload.annotation?.id || null;
17842
- case "annotation.removed":
17843
- case "annotation.body.updated":
17844
- if (payload.annotationId && eventData.resourceId) {
17845
- try {
17846
- const resourceUri = eventData.resourceId;
17847
- const baseUrl3 = resourceUri.substring(0, resourceUri.lastIndexOf("/resources/"));
17848
- return `${baseUrl3}/annotations/${payload.annotationId}`;
17849
- } catch (e) {
17850
- return null;
17851
- }
17852
- }
17853
- return null;
17854
- default:
17855
- return null;
17856
- }
17857
- }
17858
- function isEventRelatedToAnnotation(event, annotationUri) {
17859
- const eventAnnotationUri = getAnnotationUriFromEvent(event);
17860
- return eventAnnotationUri === annotationUri;
17861
- }
17862
- function isResourceEvent(event) {
17863
- return event && typeof event.event === "object" && typeof event.event.id === "string" && typeof event.event.timestamp === "string" && typeof event.event.resourceId === "string" && typeof event.event.type === "string" && typeof event.metadata === "object" && typeof event.metadata.sequenceNumber === "number";
17864
- }
17865
- function formatEventType(type2, t, payload) {
17866
- switch (type2) {
17867
- case "resource.created":
17868
- return t("resourceCreated");
17869
- case "resource.cloned":
17870
- return t("resourceCloned");
17871
- case "resource.archived":
17872
- return t("resourceArchived");
17873
- case "resource.unarchived":
17874
- return t("resourceUnarchived");
17875
- case "annotation.added": {
17876
- const motivation = payload?.annotation?.motivation;
17877
- if (motivation === "highlighting")
17878
- return t("highlightAdded");
17879
- if (motivation === "linking")
17880
- return t("referenceCreated");
17881
- if (motivation === "assessing")
17882
- return t("assessmentAdded");
17883
- return t("annotationAdded");
17884
- }
17885
- case "annotation.removed": {
17886
- return t("annotationRemoved");
17887
- }
17888
- case "annotation.body.updated": {
17889
- return t("annotationBodyUpdated");
17890
- }
17891
- case "entitytag.added":
17892
- return t("entitytagAdded");
17893
- case "entitytag.removed":
17894
- return t("entitytagRemoved");
17895
- case "entitytype.added":
17896
- return t("entitytypeAdded");
17897
- case "job.completed":
17898
- case "job.started":
17899
- case "job.progress":
17900
- case "job.failed":
17901
- return t("jobEvent");
17902
- default:
17903
- const _exhaustiveCheck = type2;
17904
- return _exhaustiveCheck;
17905
- }
17906
- }
17907
- function getEventEmoji(type2, payload) {
17908
- switch (type2) {
17909
- case "resource.created":
17910
- case "resource.cloned":
17911
- case "resource.archived":
17912
- case "resource.unarchived":
17913
- return "\u{1F4C4}";
17914
- case "annotation.added": {
17915
- const motivation = payload?.annotation?.motivation;
17916
- if (motivation === "highlighting")
17917
- return "\u{1F7E1}";
17918
- if (motivation === "linking")
17919
- return "\u{1F535}";
17920
- if (motivation === "assessing")
17921
- return "\u{1F534}";
17922
- return "\u{1F4DD}";
17923
- }
17924
- case "annotation.removed": {
17925
- return "\u{1F5D1}\uFE0F";
17926
- }
17927
- case "annotation.body.updated": {
17928
- return "\u270F\uFE0F";
17929
- }
17930
- case "entitytag.added":
17931
- case "entitytag.removed":
17932
- return "\u{1F3F7}\uFE0F";
17933
- case "entitytype.added":
17934
- return "\u{1F3F7}\uFE0F";
17935
- // Same emoji as entitytag (global entity type collection)
17936
- case "job.completed":
17937
- return "\u{1F517}";
17938
- // Link emoji for linked document creation
17939
- case "job.started":
17940
- case "job.progress":
17941
- return "\u2699\uFE0F";
17942
- // Gear for job processing
17943
- case "job.failed":
17944
- return "\u274C";
17945
- // X mark for failed jobs
17946
- default:
17947
- const _exhaustiveCheck = type2;
17948
- return _exhaustiveCheck;
17949
- }
17950
- }
17951
- function formatRelativeTime(timestamp2, t) {
17952
- const date5 = new Date(timestamp2);
17953
- const now = /* @__PURE__ */ new Date();
17954
- const diffMs = now.getTime() - date5.getTime();
17955
- const diffMins = Math.floor(diffMs / 6e4);
17956
- const diffHours = Math.floor(diffMs / 36e5);
17957
- const diffDays = Math.floor(diffMs / 864e5);
17958
- if (diffMins < 1)
17959
- return t("justNow");
17960
- if (diffMins < 60)
17961
- return t("minutesAgo", { count: diffMins });
17962
- if (diffHours < 24)
17963
- return t("hoursAgo", { count: diffHours });
17964
- if (diffDays < 7)
17965
- return t("daysAgo", { count: diffDays });
17966
- return date5.toLocaleDateString();
17967
- }
17968
- function truncateText(text, maxLength = 50) {
17969
- const trimmed = text.trim();
17970
- return trimmed.length > maxLength ? trimmed.substring(0, maxLength) + "..." : trimmed;
17971
- }
17972
- function getEventDisplayContent(event, annotations, allEvents) {
17973
- const eventData = event.event;
17974
- const payload = eventData.payload;
17975
- switch (eventData.type) {
17976
- case "resource.created":
17977
- case "resource.cloned": {
17978
- return { exact: payload.name, isQuoted: false, isTag: false };
17979
- }
17980
- // Unified annotation events
17981
- case "annotation.body.updated": {
17982
- const annotation = annotations.find((a) => a.id.endsWith(`/annotations/${payload.annotationId}`));
17983
- if (annotation?.target) {
17984
- try {
17985
- const targetSelector = (0, annotations_1.getTargetSelector)(annotation.target);
17986
- const exact = (0, annotations_1.getExactText)(targetSelector);
17987
- if (exact) {
17988
- return { exact: truncateText(exact), isQuoted: true, isTag: false };
17989
- }
17990
- } catch {
17991
- }
17992
- }
17993
- return null;
17994
- }
17995
- case "annotation.removed": {
17996
- const addedEvent = allEvents.find((e) => e.event.type === "annotation.added" && e.event.payload.annotation?.id?.endsWith(`/annotations/${payload.annotationId}`));
17997
- if (addedEvent) {
17998
- const addedPayload = addedEvent.event.payload;
17999
- try {
18000
- const exact = (0, annotations_1.getExactText)(addedPayload.annotation.target.selector);
18001
- if (exact) {
18002
- return { exact: truncateText(exact), isQuoted: true, isTag: false };
18003
- }
18004
- } catch {
18005
- }
18006
- }
18007
- return null;
18008
- }
18009
- case "annotation.added": {
18010
- try {
18011
- const exact = (0, annotations_1.getExactText)(payload.annotation.target.selector);
18012
- if (exact) {
18013
- return { exact: truncateText(exact), isQuoted: true, isTag: false };
18014
- }
18015
- } catch {
18016
- }
18017
- return null;
18018
- }
18019
- case "entitytag.added":
18020
- case "entitytag.removed": {
18021
- return { exact: payload.entityType, isQuoted: false, isTag: true };
18022
- }
18023
- case "job.completed": {
18024
- if (payload.annotationUri) {
18025
- const annotation = annotations.find((a) => a.id === payload.annotationUri);
18026
- if (annotation?.target) {
18027
- try {
18028
- const targetSelector = (0, annotations_1.getTargetSelector)(annotation.target);
18029
- const exact = (0, annotations_1.getExactText)(targetSelector);
18030
- if (exact) {
18031
- return { exact: truncateText(exact), isQuoted: true, isTag: false };
18032
- }
18033
- } catch {
18034
- }
18035
- }
18036
- }
18037
- return null;
18038
- }
18039
- default:
18040
- return null;
18041
- }
18042
- }
18043
- function getEventEntityTypes(event) {
18044
- const eventData = event.event;
18045
- if (eventData.type === "annotation.added") {
18046
- const payload = eventData.payload;
18047
- const motivation = payload?.annotation?.motivation;
18048
- if (motivation === "linking") {
18049
- return payload.annotation?.body?.entityTypes ?? [];
18050
- }
18051
- }
18052
- return [];
18053
- }
18054
- function getResourceCreationDetails(event) {
18055
- const eventData = event.event;
18056
- const payload = eventData.payload;
18057
- if (eventData.type === "resource.created") {
18058
- return {
18059
- type: "created",
18060
- method: payload.creationMethod || "unknown",
18061
- userId: eventData.userId,
18062
- metadata: payload.metadata
18063
- };
18064
- }
18065
- if (eventData.type === "resource.cloned") {
18066
- return {
18067
- type: "cloned",
18068
- method: payload.creationMethod || "clone",
18069
- userId: eventData.userId,
18070
- sourceDocId: payload.parentResourceId,
18071
- parentResourceId: payload.parentResourceId,
18072
- metadata: payload.metadata
18073
- };
18074
- }
18075
- return null;
18076
- }
18077
- }
18078
- });
18079
-
18080
- // ../../packages/api-client/dist/utils/locales.js
18081
- var require_locales = __commonJS({
18082
- "../../packages/api-client/dist/utils/locales.js"(exports) {
18083
- "use strict";
18084
- Object.defineProperty(exports, "__esModule", { value: true });
18085
- exports.LOCALES = void 0;
18086
- exports.getLocaleInfo = getLocaleInfo;
18087
- exports.getLocaleNativeName = getLocaleNativeName;
18088
- exports.getLocaleEnglishName = getLocaleEnglishName;
18089
- exports.formatLocaleDisplay = formatLocaleDisplay;
18090
- exports.getAllLocaleCodes = getAllLocaleCodes;
18091
- exports.LOCALES = [
17453
+ LOCALES = [
18092
17454
  { code: "ar", nativeName: "\u0627\u0644\u0639\u0631\u0628\u064A\u0629", englishName: "Arabic" },
18093
17455
  { code: "bn", nativeName: "\u09AC\u09BE\u0982\u09B2\u09BE", englishName: "Bengali" },
18094
17456
  { code: "cs", nativeName: "\u010Ce\u0161tina", englishName: "Czech" },
@@ -18119,247 +17481,22 @@ var require_locales = __commonJS({
18119
17481
  { code: "vi", nativeName: "Ti\u1EBFng Vi\u1EC7t", englishName: "Vietnamese" },
18120
17482
  { code: "zh", nativeName: "\u4E2D\u6587", englishName: "Chinese" }
18121
17483
  ];
18122
- var localeByCode = new Map(exports.LOCALES.map((locale) => [locale.code.toLowerCase(), locale]));
18123
- function getLocaleInfo(code) {
18124
- if (!code)
18125
- return void 0;
18126
- return localeByCode.get(code.toLowerCase());
18127
- }
18128
- function getLocaleNativeName(code) {
18129
- return getLocaleInfo(code)?.nativeName;
18130
- }
18131
- function getLocaleEnglishName(code) {
18132
- return getLocaleInfo(code)?.englishName;
18133
- }
18134
- function formatLocaleDisplay(code) {
18135
- if (!code)
18136
- return void 0;
18137
- const info = getLocaleInfo(code);
18138
- if (!info)
18139
- return code;
18140
- return `${info.nativeName} (${code.toLowerCase()})`;
18141
- }
18142
- function getAllLocaleCodes() {
18143
- return exports.LOCALES.map((l) => l.code);
18144
- }
18145
- }
18146
- });
18147
-
18148
- // ../../packages/api-client/dist/utils/resources.js
18149
- var require_resources = __commonJS({
18150
- "../../packages/api-client/dist/utils/resources.js"(exports) {
18151
- "use strict";
18152
- Object.defineProperty(exports, "__esModule", { value: true });
18153
- exports.getResourceId = getResourceId;
18154
- exports.getPrimaryRepresentation = getPrimaryRepresentation;
18155
- exports.getPrimaryMediaType = getPrimaryMediaType;
18156
- exports.getChecksum = getChecksum;
18157
- exports.getLanguage = getLanguage;
18158
- function getResourceId(resource) {
18159
- if (!resource)
18160
- return void 0;
18161
- const fullId = resource["@id"];
18162
- if (fullId.includes("/resources/")) {
18163
- const parts = fullId.split("/resources/");
18164
- const lastPart = parts[parts.length - 1];
18165
- return lastPart || void 0;
18166
- }
18167
- return void 0;
18168
- }
18169
- function getPrimaryRepresentation(resource) {
18170
- if (!resource?.representations)
18171
- return void 0;
18172
- const reps = Array.isArray(resource.representations) ? resource.representations : [resource.representations];
18173
- return reps[0];
18174
- }
18175
- function getPrimaryMediaType(resource) {
18176
- return getPrimaryRepresentation(resource)?.mediaType;
18177
- }
18178
- function getChecksum(resource) {
18179
- return getPrimaryRepresentation(resource)?.checksum;
18180
- }
18181
- function getLanguage(resource) {
18182
- return getPrimaryRepresentation(resource)?.language;
18183
- }
18184
- }
18185
- });
18186
-
18187
- // ../../packages/api-client/dist/utils/validation.js
18188
- var require_validation = __commonJS({
18189
- "../../packages/api-client/dist/utils/validation.js"(exports) {
18190
- "use strict";
18191
- Object.defineProperty(exports, "__esModule", { value: true });
18192
- exports.JWTTokenSchema = void 0;
18193
- exports.validateData = validateData;
18194
- exports.isValidEmail = isValidEmail;
18195
- exports.JWTTokenSchema = {
18196
- parse(token) {
18197
- if (typeof token !== "string") {
18198
- throw new Error("Token must be a string");
18199
- }
18200
- if (!token || token.length === 0) {
18201
- throw new Error("Token is required");
18202
- }
18203
- const jwtRegex = /^[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_]+\.[A-Za-z0-9\-_]*$/;
18204
- if (!jwtRegex.test(token)) {
18205
- throw new Error("Invalid JWT token format");
18206
- }
18207
- return token;
18208
- },
18209
- safeParse(token) {
18210
- try {
18211
- const validated = this.parse(token);
18212
- return { success: true, data: validated };
18213
- } catch (error46) {
18214
- return {
18215
- success: false,
18216
- error: error46 instanceof Error ? error46.message : "Invalid JWT token"
18217
- };
18218
- }
18219
- }
18220
- };
18221
- function validateData(schema2, data) {
18222
- try {
18223
- const validated = schema2.parse(data);
18224
- return { success: true, data: validated };
18225
- } catch (error46) {
18226
- return {
18227
- success: false,
18228
- error: error46 instanceof Error ? error46.message : "Validation failed"
18229
- };
18230
- }
18231
- }
18232
- function isValidEmail(email3) {
18233
- if (email3.length < 1 || email3.length > 255) {
18234
- return false;
18235
- }
18236
- const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
18237
- return emailRegex.test(email3);
18238
- }
18239
- }
18240
- });
18241
-
18242
- // ../../packages/api-client/dist/utils/index.js
18243
- var require_utils = __commonJS({
18244
- "../../packages/api-client/dist/utils/index.js"(exports) {
18245
- "use strict";
18246
- var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
18247
- if (k2 === void 0) k2 = k;
18248
- var desc = Object.getOwnPropertyDescriptor(m, k);
18249
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18250
- desc = { enumerable: true, get: function() {
18251
- return m[k];
18252
- } };
18253
- }
18254
- Object.defineProperty(o, k2, desc);
18255
- }) : (function(o, m, k, k2) {
18256
- if (k2 === void 0) k2 = k;
18257
- o[k2] = m[k];
18258
- }));
18259
- var __exportStar = exports && exports.__exportStar || function(m, exports2) {
18260
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
18261
- };
18262
- Object.defineProperty(exports, "__esModule", { value: true });
18263
- __exportStar(require_annotations(), exports);
18264
- __exportStar(require_events(), exports);
18265
- __exportStar(require_locales(), exports);
18266
- __exportStar(require_resources(), exports);
18267
- __exportStar(require_validation(), exports);
18268
- }
18269
- });
18270
-
18271
- // ../../packages/api-client/dist/mime-utils.js
18272
- var require_mime_utils = __commonJS({
18273
- "../../packages/api-client/dist/mime-utils.js"(exports) {
18274
- "use strict";
18275
- Object.defineProperty(exports, "__esModule", { value: true });
18276
- exports.getExtensionForMimeType = getExtensionForMimeType;
18277
- exports.isImageMimeType = isImageMimeType;
18278
- exports.isTextMimeType = isTextMimeType;
18279
- exports.getMimeCategory = getMimeCategory;
18280
- function getExtensionForMimeType(mimeType) {
18281
- const map3 = {
18282
- "text/plain": "txt",
18283
- "text/markdown": "md",
18284
- "image/png": "png",
18285
- "image/jpeg": "jpg"
18286
- };
18287
- return map3[mimeType] || "dat";
18288
- }
18289
- function isImageMimeType(mimeType) {
18290
- return mimeType === "image/png" || mimeType === "image/jpeg";
18291
- }
18292
- function isTextMimeType(mimeType) {
18293
- return mimeType === "text/plain" || mimeType === "text/markdown";
18294
- }
18295
- function getMimeCategory(mimeType) {
18296
- if (isTextMimeType(mimeType)) {
18297
- return "text";
18298
- }
18299
- if (isImageMimeType(mimeType)) {
18300
- return "image";
18301
- }
18302
- return "unsupported";
18303
- }
18304
- }
18305
- });
18306
-
18307
- // ../../packages/api-client/dist/index.js
18308
- var require_dist = __commonJS({
18309
- "../../packages/api-client/dist/index.js"(exports) {
18310
- "use strict";
18311
- var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
18312
- if (k2 === void 0) k2 = k;
18313
- var desc = Object.getOwnPropertyDescriptor(m, k);
18314
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18315
- desc = { enumerable: true, get: function() {
18316
- return m[k];
18317
- } };
18318
- }
18319
- Object.defineProperty(o, k2, desc);
18320
- }) : (function(o, m, k, k2) {
18321
- if (k2 === void 0) k2 = k;
18322
- o[k2] = m[k];
18323
- }));
18324
- var __exportStar = exports && exports.__exportStar || function(m, exports2) {
18325
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
18326
- };
18327
- Object.defineProperty(exports, "__esModule", { value: true });
18328
- exports.getMimeCategory = exports.isTextMimeType = exports.isImageMimeType = exports.getExtensionForMimeType = exports.SSEClient = void 0;
18329
- __exportStar(require_types(), exports);
18330
- __exportStar(require_client(), exports);
18331
- var sse_1 = require_sse();
18332
- Object.defineProperty(exports, "SSEClient", { enumerable: true, get: function() {
18333
- return sse_1.SSEClient;
18334
- } });
18335
- __exportStar(require_utils(), exports);
18336
- var mime_utils_1 = require_mime_utils();
18337
- Object.defineProperty(exports, "getExtensionForMimeType", { enumerable: true, get: function() {
18338
- return mime_utils_1.getExtensionForMimeType;
18339
- } });
18340
- Object.defineProperty(exports, "isImageMimeType", { enumerable: true, get: function() {
18341
- return mime_utils_1.isImageMimeType;
18342
- } });
18343
- Object.defineProperty(exports, "isTextMimeType", { enumerable: true, get: function() {
18344
- return mime_utils_1.isTextMimeType;
18345
- } });
18346
- Object.defineProperty(exports, "getMimeCategory", { enumerable: true, get: function() {
18347
- return mime_utils_1.getMimeCategory;
18348
- } });
18349
- __exportStar(require_branded_types(), exports);
17484
+ localeByCode = new Map(
17485
+ LOCALES.map((locale) => [locale.code.toLowerCase(), locale])
17486
+ );
18350
17487
  }
18351
17488
  });
18352
17489
 
18353
17490
  // src/platforms/posix/handlers/backend-check.ts
18354
17491
  import * as fs9 from "fs";
18355
- var import_api_client, checkBackendService, backendCheckDescriptor;
17492
+ var checkBackendService, backendCheckDescriptor;
18356
17493
  var init_backend_check = __esm({
18357
17494
  "src/platforms/posix/handlers/backend-check.ts"() {
18358
17495
  "use strict";
18359
17496
  init_network_utils();
18360
17497
  init_state_manager();
18361
17498
  init_backend_paths();
18362
- import_api_client = __toESM(require_dist(), 1);
17499
+ init_dist();
18363
17500
  checkBackendService = async (context) => {
18364
17501
  const { service, savedState } = context;
18365
17502
  const config2 = service.config;
@@ -18420,7 +17557,7 @@ var init_backend_check = __esm({
18420
17557
  }
18421
17558
  if (status === "running" || status === "unknown") {
18422
17559
  const localUrl = `http://localhost:${config2.port}`;
18423
- const client = new import_api_client.SemiontApiClient({ baseUrl: (0, import_api_client.baseUrl)(localUrl) });
17560
+ const client = new SemiontApiClient({ baseUrl: baseUrl(localUrl) });
18424
17561
  try {
18425
17562
  const healthData = await client.healthCheck();
18426
17563
  healthy = true;
@@ -21841,11 +20978,11 @@ var init_platform2 = __esm({
21841
20978
 
21842
20979
  // src/platforms/container/handlers/web-check.ts
21843
20980
  import { execSync as execSync16 } from "child_process";
21844
- var import_api_client2, checkWebContainer, webCheckDescriptor;
20981
+ var checkWebContainer, webCheckDescriptor;
21845
20982
  var init_web_check = __esm({
21846
20983
  "src/platforms/container/handlers/web-check.ts"() {
21847
20984
  "use strict";
21848
- import_api_client2 = __toESM(require_dist(), 1);
20985
+ init_dist();
21849
20986
  checkWebContainer = async (context) => {
21850
20987
  const { platform, service, runtime, containerName } = context;
21851
20988
  const config2 = service.config;
@@ -21892,7 +21029,7 @@ var init_web_check = __esm({
21892
21029
  try {
21893
21030
  if (isBackend) {
21894
21031
  const backendConfig = config2;
21895
- const client = new import_api_client2.SemiontApiClient({ baseUrl: (0, import_api_client2.baseUrl)(backendConfig.publicURL) });
21032
+ const client = new SemiontApiClient({ baseUrl: baseUrl(backendConfig.publicURL) });
21896
21033
  try {
21897
21034
  const healthData = await client.healthCheck();
21898
21035
  health = {
@@ -29160,13 +28297,13 @@ var init_errors3 = __esm({
29160
28297
  });
29161
28298
 
29162
28299
  // ../../node_modules/@anthropic-ai/sdk/core/error.mjs
29163
- var AnthropicError, APIError, APIUserAbortError, APIConnectionError, APIConnectionTimeoutError, BadRequestError, AuthenticationError, PermissionDeniedError, NotFoundError, ConflictError, UnprocessableEntityError, RateLimitError, InternalServerError;
28300
+ var AnthropicError, APIError2, APIUserAbortError, APIConnectionError, APIConnectionTimeoutError, BadRequestError, AuthenticationError, PermissionDeniedError, NotFoundError, ConflictError, UnprocessableEntityError, RateLimitError, InternalServerError;
29164
28301
  var init_error = __esm({
29165
28302
  "../../node_modules/@anthropic-ai/sdk/core/error.mjs"() {
29166
28303
  init_errors3();
29167
28304
  AnthropicError = class extends Error {
29168
28305
  };
29169
- APIError = class _APIError extends AnthropicError {
28306
+ APIError2 = class _APIError extends AnthropicError {
29170
28307
  constructor(status, error46, message, headers) {
29171
28308
  super(`${_APIError.makeMessage(status, error46, message)}`);
29172
28309
  this.status = status;
@@ -29219,12 +28356,12 @@ var init_error = __esm({
29219
28356
  return new _APIError(status, error46, message, headers);
29220
28357
  }
29221
28358
  };
29222
- APIUserAbortError = class extends APIError {
28359
+ APIUserAbortError = class extends APIError2 {
29223
28360
  constructor({ message } = {}) {
29224
28361
  super(void 0, void 0, message || "Request was aborted.", void 0);
29225
28362
  }
29226
28363
  };
29227
- APIConnectionError = class extends APIError {
28364
+ APIConnectionError = class extends APIError2 {
29228
28365
  constructor({ message, cause }) {
29229
28366
  super(void 0, void 0, message || "Connection error.", void 0);
29230
28367
  if (cause)
@@ -29236,21 +28373,21 @@ var init_error = __esm({
29236
28373
  super({ message: message ?? "Request timed out." });
29237
28374
  }
29238
28375
  };
29239
- BadRequestError = class extends APIError {
28376
+ BadRequestError = class extends APIError2 {
29240
28377
  };
29241
- AuthenticationError = class extends APIError {
28378
+ AuthenticationError = class extends APIError2 {
29242
28379
  };
29243
- PermissionDeniedError = class extends APIError {
28380
+ PermissionDeniedError = class extends APIError2 {
29244
28381
  };
29245
- NotFoundError = class extends APIError {
28382
+ NotFoundError = class extends APIError2 {
29246
28383
  };
29247
- ConflictError = class extends APIError {
28384
+ ConflictError = class extends APIError2 {
29248
28385
  };
29249
- UnprocessableEntityError = class extends APIError {
28386
+ UnprocessableEntityError = class extends APIError2 {
29250
28387
  };
29251
- RateLimitError = class extends APIError {
28388
+ RateLimitError = class extends APIError2 {
29252
28389
  };
29253
- InternalServerError = class extends APIError {
28390
+ InternalServerError = class extends APIError2 {
29254
28391
  };
29255
28392
  }
29256
28393
  });
@@ -29842,7 +28979,7 @@ var init_streaming = __esm({
29842
28979
  continue;
29843
28980
  }
29844
28981
  if (sse.event === "error") {
29845
- throw new APIError(void 0, safeJSON(sse.data) ?? sse.data, void 0, response.headers);
28982
+ throw new APIError2(void 0, safeJSON(sse.data) ?? sse.data, void 0, response.headers);
29846
28983
  }
29847
28984
  }
29848
28985
  done = true;
@@ -33207,7 +32344,7 @@ var init_client = __esm({
33207
32344
  return `stainless-node-retry-${uuid42()}`;
33208
32345
  }
33209
32346
  makeStatusError(status, error46, message, headers) {
33210
- return APIError.generate(status, error46, message, headers);
32347
+ return APIError2.generate(status, error46, message, headers);
33211
32348
  }
33212
32349
  buildURL(path34, query, defaultBaseURL) {
33213
32350
  const baseURL = !__classPrivateFieldGet(this, _BaseAnthropic_instances, "m", _BaseAnthropic_baseURLOverridden).call(this) && defaultBaseURL || this.baseURL;
@@ -33525,7 +32662,7 @@ var init_client = __esm({
33525
32662
  BaseAnthropic.AI_PROMPT = AI_PROMPT;
33526
32663
  BaseAnthropic.DEFAULT_TIMEOUT = 6e5;
33527
32664
  BaseAnthropic.AnthropicError = AnthropicError;
33528
- BaseAnthropic.APIError = APIError;
32665
+ BaseAnthropic.APIError = APIError2;
33529
32666
  BaseAnthropic.APIConnectionError = APIConnectionError;
33530
32667
  BaseAnthropic.APIConnectionTimeoutError = APIConnectionTimeoutError;
33531
32668
  BaseAnthropic.APIUserAbortError = APIUserAbortError;
@@ -33642,13 +32779,13 @@ var init_errors4 = __esm({
33642
32779
  });
33643
32780
 
33644
32781
  // ../../node_modules/openai/core/error.mjs
33645
- var OpenAIError, APIError2, APIUserAbortError2, APIConnectionError2, APIConnectionTimeoutError2, BadRequestError2, AuthenticationError2, PermissionDeniedError2, NotFoundError2, ConflictError2, UnprocessableEntityError2, RateLimitError2, InternalServerError2, LengthFinishReasonError, ContentFilterFinishReasonError, InvalidWebhookSignatureError;
32782
+ var OpenAIError, APIError3, APIUserAbortError2, APIConnectionError2, APIConnectionTimeoutError2, BadRequestError2, AuthenticationError2, PermissionDeniedError2, NotFoundError2, ConflictError2, UnprocessableEntityError2, RateLimitError2, InternalServerError2, LengthFinishReasonError, ContentFilterFinishReasonError, InvalidWebhookSignatureError;
33646
32783
  var init_error3 = __esm({
33647
32784
  "../../node_modules/openai/core/error.mjs"() {
33648
32785
  init_errors4();
33649
32786
  OpenAIError = class extends Error {
33650
32787
  };
33651
- APIError2 = class _APIError extends OpenAIError {
32788
+ APIError3 = class _APIError extends OpenAIError {
33652
32789
  constructor(status, error46, message, headers) {
33653
32790
  super(`${_APIError.makeMessage(status, error46, message)}`);
33654
32791
  this.status = status;
@@ -33705,12 +32842,12 @@ var init_error3 = __esm({
33705
32842
  return new _APIError(status, error46, message, headers);
33706
32843
  }
33707
32844
  };
33708
- APIUserAbortError2 = class extends APIError2 {
32845
+ APIUserAbortError2 = class extends APIError3 {
33709
32846
  constructor({ message } = {}) {
33710
32847
  super(void 0, void 0, message || "Request was aborted.", void 0);
33711
32848
  }
33712
32849
  };
33713
- APIConnectionError2 = class extends APIError2 {
32850
+ APIConnectionError2 = class extends APIError3 {
33714
32851
  constructor({ message, cause }) {
33715
32852
  super(void 0, void 0, message || "Connection error.", void 0);
33716
32853
  if (cause)
@@ -33722,21 +32859,21 @@ var init_error3 = __esm({
33722
32859
  super({ message: message ?? "Request timed out." });
33723
32860
  }
33724
32861
  };
33725
- BadRequestError2 = class extends APIError2 {
32862
+ BadRequestError2 = class extends APIError3 {
33726
32863
  };
33727
- AuthenticationError2 = class extends APIError2 {
32864
+ AuthenticationError2 = class extends APIError3 {
33728
32865
  };
33729
- PermissionDeniedError2 = class extends APIError2 {
32866
+ PermissionDeniedError2 = class extends APIError3 {
33730
32867
  };
33731
- NotFoundError2 = class extends APIError2 {
32868
+ NotFoundError2 = class extends APIError3 {
33732
32869
  };
33733
- ConflictError2 = class extends APIError2 {
32870
+ ConflictError2 = class extends APIError3 {
33734
32871
  };
33735
- UnprocessableEntityError2 = class extends APIError2 {
32872
+ UnprocessableEntityError2 = class extends APIError3 {
33736
32873
  };
33737
- RateLimitError2 = class extends APIError2 {
32874
+ RateLimitError2 = class extends APIError3 {
33738
32875
  };
33739
- InternalServerError2 = class extends APIError2 {
32876
+ InternalServerError2 = class extends APIError3 {
33740
32877
  };
33741
32878
  LengthFinishReasonError = class extends OpenAIError {
33742
32879
  constructor() {
@@ -34732,7 +33869,7 @@ var init_streaming3 = __esm({
34732
33869
  throw e;
34733
33870
  }
34734
33871
  if (data && data.error) {
34735
- throw new APIError2(void 0, data.error, void 0, response.headers);
33872
+ throw new APIError3(void 0, data.error, void 0, response.headers);
34736
33873
  }
34737
33874
  yield data;
34738
33875
  } else {
@@ -34745,7 +33882,7 @@ var init_streaming3 = __esm({
34745
33882
  throw e;
34746
33883
  }
34747
33884
  if (sse.event == "error") {
34748
- throw new APIError2(void 0, data.error, data.message, void 0);
33885
+ throw new APIError3(void 0, data.error, data.message, void 0);
34749
33886
  }
34750
33887
  yield { event: sse.event, data };
34751
33888
  }
@@ -40505,7 +39642,7 @@ var init_client2 = __esm({
40505
39642
  return `stainless-node-retry-${uuid43()}`;
40506
39643
  }
40507
39644
  makeStatusError(status, error46, message, headers) {
40508
- return APIError2.generate(status, error46, message, headers);
39645
+ return APIError3.generate(status, error46, message, headers);
40509
39646
  }
40510
39647
  async _callApiKey() {
40511
39648
  const apiKey = this._options.apiKey;
@@ -40827,7 +39964,7 @@ var init_client2 = __esm({
40827
39964
  OpenAI.OpenAI = _a3;
40828
39965
  OpenAI.DEFAULT_TIMEOUT = 6e5;
40829
39966
  OpenAI.OpenAIError = OpenAIError;
40830
- OpenAI.APIError = APIError2;
39967
+ OpenAI.APIError = APIError3;
40831
39968
  OpenAI.APIConnectionError = APIConnectionError2;
40832
39969
  OpenAI.APIConnectionTimeoutError = APIConnectionTimeoutError2;
40833
39970
  OpenAI.APIUserAbortError = APIUserAbortError2;
@@ -42897,6 +42034,9 @@ var require_package = __commonJS({
42897
42034
  bin: {
42898
42035
  semiont: "./dist/cli.mjs"
42899
42036
  },
42037
+ engines: {
42038
+ node: ">=20.18.1"
42039
+ },
42900
42040
  files: [
42901
42041
  "dist",
42902
42042
  "README.md",