@agentproto/adapter-pi 0.3.10 → 0.3.11

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.
@@ -18793,189 +18793,13 @@ function mediaTypeEssence(header) {
18793
18793
  }
18794
18794
  }
18795
18795
 
18796
- // ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/index.js
18797
- var ParseError2 = class extends Error {
18798
- constructor(message, options) {
18799
- super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
18800
- }
18801
- };
18802
- var LF2 = 10;
18803
- var CR2 = 13;
18804
- var SPACE2 = 32;
18805
- function noop2(_arg) {
18806
- }
18807
- function createParser2(config2) {
18808
- if (typeof config2 == "function")
18809
- throw new TypeError(
18810
- "`config` must be an object, got a function instead. Did you mean `createParser({onEvent: fn})`?"
18811
- );
18812
- const { onEvent = noop2, onError = noop2, onRetry = noop2, onComment, maxBufferSize } = config2, pendingFragments = [];
18813
- let pendingFragmentsLength = 0, isFirstChunk = true, id, data = "", dataLines = 0, eventType, terminated = false;
18814
- function feed(chunk) {
18815
- if (terminated)
18816
- throw new Error(
18817
- "Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing."
18818
- );
18819
- if (isFirstChunk && (isFirstChunk = false, chunk.charCodeAt(0) === 239 && chunk.charCodeAt(1) === 187 && chunk.charCodeAt(2) === 191 && (chunk = chunk.slice(3))), pendingFragments.length === 0) {
18820
- const trailing2 = processLines(chunk);
18821
- trailing2 !== "" && (pendingFragments.push(trailing2), pendingFragmentsLength = trailing2.length), checkBufferSize();
18822
- return;
18823
- }
18824
- if (chunk.indexOf(`
18825
- `) === -1 && chunk.indexOf("\r") === -1) {
18826
- pendingFragments.push(chunk), pendingFragmentsLength += chunk.length, checkBufferSize();
18827
- return;
18828
- }
18829
- pendingFragments.push(chunk);
18830
- const input = pendingFragments.join("");
18831
- pendingFragments.length = 0, pendingFragmentsLength = 0;
18832
- const trailing = processLines(input);
18833
- trailing !== "" && (pendingFragments.push(trailing), pendingFragmentsLength = trailing.length), checkBufferSize();
18834
- }
18835
- function checkBufferSize() {
18836
- maxBufferSize !== void 0 && (pendingFragmentsLength + data.length <= maxBufferSize || (terminated = true, pendingFragments.length = 0, pendingFragmentsLength = 0, id = void 0, data = "", dataLines = 0, eventType = void 0, onError(
18837
- new ParseError2(`Buffered data exceeded max buffer size of ${maxBufferSize} characters`, {
18838
- type: "max-buffer-size-exceeded"
18839
- })
18840
- )));
18841
- }
18842
- function processLines(chunk) {
18843
- let searchIndex = 0;
18844
- if (chunk.indexOf("\r") === -1) {
18845
- let lfIndex = chunk.indexOf(`
18846
- `, searchIndex);
18847
- for (; lfIndex !== -1; ) {
18848
- if (searchIndex === lfIndex) {
18849
- dataLines > 0 && onEvent({ id, event: eventType, data }), id = void 0, data = "", dataLines = 0, eventType = void 0, searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
18850
- `, searchIndex);
18851
- continue;
18852
- }
18853
- const firstCharCode = chunk.charCodeAt(searchIndex);
18854
- if (isDataPrefix2(chunk, searchIndex, firstCharCode)) {
18855
- const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE2 ? searchIndex + 6 : searchIndex + 5, value = chunk.slice(valueStart, lfIndex);
18856
- if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF2) {
18857
- onEvent({ id, event: eventType, data: value }), id = void 0, data = "", eventType = void 0, searchIndex = lfIndex + 2, lfIndex = chunk.indexOf(`
18858
- `, searchIndex);
18859
- continue;
18860
- }
18861
- data = dataLines === 0 ? value : `${data}
18862
- ${value}`, dataLines++;
18863
- } else isEventPrefix2(chunk, searchIndex, firstCharCode) ? eventType = chunk.slice(
18864
- chunk.charCodeAt(searchIndex + 6) === SPACE2 ? searchIndex + 7 : searchIndex + 6,
18865
- lfIndex
18866
- ) || void 0 : parseLine(chunk, searchIndex, lfIndex);
18867
- searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
18868
- `, searchIndex);
18869
- }
18870
- return chunk.slice(searchIndex);
18871
- }
18872
- for (; searchIndex < chunk.length; ) {
18873
- const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
18874
- `, searchIndex);
18875
- let lineEnd = -1;
18876
- if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = crIndex < lfIndex ? crIndex : lfIndex : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1)
18877
- break;
18878
- parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) === CR2 && chunk.charCodeAt(searchIndex) === LF2 && searchIndex++;
18879
- }
18880
- return chunk.slice(searchIndex);
18881
- }
18882
- function parseLine(chunk, start, end) {
18883
- if (start === end) {
18884
- dispatchEvent();
18885
- return;
18886
- }
18887
- const firstCharCode = chunk.charCodeAt(start);
18888
- if (isDataPrefix2(chunk, start, firstCharCode)) {
18889
- const valueStart = chunk.charCodeAt(start + 5) === SPACE2 ? start + 6 : start + 5, value2 = chunk.slice(valueStart, end);
18890
- data = dataLines === 0 ? value2 : `${data}
18891
- ${value2}`, dataLines++;
18892
- return;
18893
- }
18894
- if (isEventPrefix2(chunk, start, firstCharCode)) {
18895
- eventType = chunk.slice(chunk.charCodeAt(start + 6) === SPACE2 ? start + 7 : start + 6, end) || void 0;
18896
- return;
18897
- }
18898
- if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
18899
- const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE2 ? start + 4 : start + 3, end);
18900
- id = value2.includes("\0") ? void 0 : value2;
18901
- return;
18902
- }
18903
- if (firstCharCode === 58) {
18904
- if (onComment) {
18905
- const line2 = chunk.slice(start, end);
18906
- onComment(line2.slice(chunk.charCodeAt(start + 1) === SPACE2 ? 2 : 1));
18907
- }
18908
- return;
18909
- }
18910
- const line = chunk.slice(start, end), fieldSeparatorIndex = line.indexOf(":");
18911
- if (fieldSeparatorIndex === -1) {
18912
- processField(line, "", line);
18913
- return;
18914
- }
18915
- const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE2 ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
18916
- processField(field, value, line);
18917
- }
18918
- function processField(field, value, line) {
18919
- switch (field) {
18920
- case "event":
18921
- eventType = value || void 0;
18922
- break;
18923
- case "data":
18924
- data = dataLines === 0 ? value : `${data}
18925
- ${value}`, dataLines++;
18926
- break;
18927
- case "id":
18928
- id = value.includes("\0") ? void 0 : value;
18929
- break;
18930
- case "retry":
18931
- /^\d+$/.test(value) ? onRetry(parseInt(value, 10)) : onError(
18932
- new ParseError2(`Invalid \`retry\` value: "${value}"`, {
18933
- type: "invalid-retry",
18934
- value,
18935
- line
18936
- })
18937
- );
18938
- break;
18939
- default:
18940
- onError(
18941
- new ParseError2(
18942
- `Unknown field "${field.length > 20 ? `${field.slice(0, 20)}\u2026` : field}"`,
18943
- { type: "unknown-field", field, value, line }
18944
- )
18945
- );
18946
- break;
18947
- }
18948
- }
18949
- function dispatchEvent() {
18950
- dataLines > 0 && onEvent({
18951
- id,
18952
- event: eventType,
18953
- data
18954
- }), id = void 0, data = "", dataLines = 0, eventType = void 0;
18955
- }
18956
- function reset(options = {}) {
18957
- if (options.consume && pendingFragments.length > 0) {
18958
- const incompleteLine = pendingFragments.join("");
18959
- parseLine(incompleteLine, 0, incompleteLine.length);
18960
- }
18961
- isFirstChunk = true, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0, pendingFragmentsLength = 0, terminated = false;
18962
- }
18963
- return { feed, reset };
18964
- }
18965
- function isDataPrefix2(chunk, i, firstCharCode) {
18966
- return firstCharCode === 100 && chunk.charCodeAt(i + 1) === 97 && chunk.charCodeAt(i + 2) === 116 && chunk.charCodeAt(i + 3) === 97 && chunk.charCodeAt(i + 4) === 58;
18967
- }
18968
- function isEventPrefix2(chunk, i, firstCharCode) {
18969
- return firstCharCode === 101 && chunk.charCodeAt(i + 1) === 118 && chunk.charCodeAt(i + 2) === 101 && chunk.charCodeAt(i + 3) === 110 && chunk.charCodeAt(i + 4) === 116 && chunk.charCodeAt(i + 5) === 58;
18970
- }
18971
-
18972
- // ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/stream.js
18796
+ // ../../node_modules/.pnpm/eventsource-parser@3.1.1/node_modules/eventsource-parser/dist/stream.js
18973
18797
  var EventSourceParserStream = class extends TransformStream {
18974
18798
  constructor({ onError, onRetry, onComment, maxBufferSize } = {}) {
18975
18799
  let parser;
18976
18800
  super({
18977
18801
  start(controller) {
18978
- parser = createParser2({
18802
+ parser = createParser({
18979
18803
  onEvent: (event) => {
18980
18804
  controller.enqueue(event);
18981
18805
  },