@clef-sh/agent 0.1.10-beta.60 → 0.1.11-beta.62

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/agent.cjs CHANGED
@@ -16109,10 +16109,10 @@ var require_client = __commonJS({
16109
16109
  var constants_1 = require_constants();
16110
16110
  var metadata_1 = require_metadata();
16111
16111
  var client_interceptors_1 = require_client_interceptors();
16112
- var CHANNEL_SYMBOL = Symbol();
16113
- var INTERCEPTOR_SYMBOL = Symbol();
16114
- var INTERCEPTOR_PROVIDER_SYMBOL = Symbol();
16115
- var CALL_INVOCATION_TRANSFORMER_SYMBOL = Symbol();
16112
+ var CHANNEL_SYMBOL = /* @__PURE__ */ Symbol();
16113
+ var INTERCEPTOR_SYMBOL = /* @__PURE__ */ Symbol();
16114
+ var INTERCEPTOR_PROVIDER_SYMBOL = /* @__PURE__ */ Symbol();
16115
+ var CALL_INVOCATION_TRANSFORMER_SYMBOL = /* @__PURE__ */ Symbol();
16116
16116
  function isFunction(arg) {
16117
16117
  return typeof arg === "function";
16118
16118
  }
@@ -36707,8 +36707,8 @@ var require_utils = __commonJS({
36707
36707
  Object.defineProperty(target, keys[i], Object.getOwnPropertyDescriptor(source, keys[i]));
36708
36708
  }
36709
36709
  };
36710
- module2.exports.wrapperSymbol = Symbol("wrapper");
36711
- module2.exports.implSymbol = Symbol("impl");
36710
+ module2.exports.wrapperSymbol = /* @__PURE__ */ Symbol("wrapper");
36711
+ module2.exports.implSymbol = /* @__PURE__ */ Symbol("impl");
36712
36712
  module2.exports.wrapperForImpl = function(impl) {
36713
36713
  return impl[module2.exports.wrapperSymbol];
36714
36714
  };
@@ -36901,7 +36901,7 @@ var require_url_state_machine = __commonJS({
36901
36901
  ws: 80,
36902
36902
  wss: 443
36903
36903
  };
36904
- var failure = Symbol("failure");
36904
+ var failure = /* @__PURE__ */ Symbol("failure");
36905
36905
  function countSymbols(str) {
36906
36906
  return punycode.ucs2.decode(str).length;
36907
36907
  }
@@ -38328,8 +38328,8 @@ var require_lib2 = __commonJS({
38328
38328
  var https2 = _interopDefault(require("https"));
38329
38329
  var zlib2 = _interopDefault(require("zlib"));
38330
38330
  var Readable2 = Stream.Readable;
38331
- var BUFFER = Symbol("buffer");
38332
- var TYPE = Symbol("type");
38331
+ var BUFFER = /* @__PURE__ */ Symbol("buffer");
38332
+ var TYPE = /* @__PURE__ */ Symbol("type");
38333
38333
  var Blob2 = class _Blob {
38334
38334
  constructor() {
38335
38335
  this[TYPE] = "";
@@ -38444,7 +38444,7 @@ var require_lib2 = __commonJS({
38444
38444
  convert = require("encoding").convert;
38445
38445
  } catch (e) {
38446
38446
  }
38447
- var INTERNALS = Symbol("Body internals");
38447
+ var INTERNALS = /* @__PURE__ */ Symbol("Body internals");
38448
38448
  var PassThrough = Stream.PassThrough;
38449
38449
  function Body(body) {
38450
38450
  var _this = this;
@@ -38784,7 +38784,7 @@ var require_lib2 = __commonJS({
38784
38784
  }
38785
38785
  return void 0;
38786
38786
  }
38787
- var MAP = Symbol("map");
38787
+ var MAP = /* @__PURE__ */ Symbol("map");
38788
38788
  var Headers2 = class _Headers {
38789
38789
  /**
38790
38790
  * Headers class
@@ -38992,7 +38992,7 @@ var require_lib2 = __commonJS({
38992
38992
  return [k.toLowerCase(), headers[MAP][k].join(", ")];
38993
38993
  });
38994
38994
  }
38995
- var INTERNAL = Symbol("internal");
38995
+ var INTERNAL = /* @__PURE__ */ Symbol("internal");
38996
38996
  function createHeadersIterator(target, kind) {
38997
38997
  const iterator = Object.create(HeadersIteratorPrototype);
38998
38998
  iterator[INTERNAL] = {
@@ -39061,7 +39061,7 @@ var require_lib2 = __commonJS({
39061
39061
  }
39062
39062
  return headers;
39063
39063
  }
39064
- var INTERNALS$1 = Symbol("Response internals");
39064
+ var INTERNALS$1 = /* @__PURE__ */ Symbol("Response internals");
39065
39065
  var STATUS_CODES = http3.STATUS_CODES;
39066
39066
  var Response3 = class _Response {
39067
39067
  constructor() {
@@ -39137,7 +39137,7 @@ var require_lib2 = __commonJS({
39137
39137
  enumerable: false,
39138
39138
  configurable: true
39139
39139
  });
39140
- var INTERNALS$2 = Symbol("Request internals");
39140
+ var INTERNALS$2 = /* @__PURE__ */ Symbol("Request internals");
39141
39141
  var URL4 = Url.URL || whatwgUrl.URL;
39142
39142
  var parse_url = Url.parse;
39143
39143
  var format_url = Url.format;
@@ -39691,7 +39691,7 @@ var require_common2 = __commonJS({
39691
39691
  var url_1 = require("url");
39692
39692
  var util_1 = require_util4();
39693
39693
  var extend_1 = __importDefault(require_extend());
39694
- exports2.GAXIOS_ERROR_SYMBOL = Symbol.for(`${util_1.pkg.name}-gaxios-error`);
39694
+ exports2.GAXIOS_ERROR_SYMBOL = /* @__PURE__ */ Symbol.for(`${util_1.pkg.name}-gaxios-error`);
39695
39695
  var GaxiosError = class _GaxiosError extends Error {
39696
39696
  /**
39697
39697
  * Support `instanceof` operator for `GaxiosError` across builds/duplicated files.
@@ -41160,7 +41160,7 @@ var require_dist = __commonJS({
41160
41160
  var http3 = __importStar(require("http"));
41161
41161
  var https_1 = require("https");
41162
41162
  __exportStar(require_helpers(), exports2);
41163
- var INTERNAL = Symbol("AgentBaseInternalState");
41163
+ var INTERNAL = /* @__PURE__ */ Symbol("AgentBaseInternalState");
41164
41164
  var Agent = class extends http3.Agent {
41165
41165
  constructor(opts) {
41166
41166
  super(opts);
@@ -64803,13 +64803,13 @@ var require_async_iterator = __commonJS({
64803
64803
  return (hint === "string" ? String : Number)(input);
64804
64804
  }
64805
64805
  var finished = require_end_of_stream();
64806
- var kLastResolve = Symbol("lastResolve");
64807
- var kLastReject = Symbol("lastReject");
64808
- var kError = Symbol("error");
64809
- var kEnded = Symbol("ended");
64810
- var kLastPromise = Symbol("lastPromise");
64811
- var kHandlePromise = Symbol("handlePromise");
64812
- var kStream = Symbol("stream");
64806
+ var kLastResolve = /* @__PURE__ */ Symbol("lastResolve");
64807
+ var kLastReject = /* @__PURE__ */ Symbol("lastReject");
64808
+ var kError = /* @__PURE__ */ Symbol("error");
64809
+ var kEnded = /* @__PURE__ */ Symbol("ended");
64810
+ var kLastPromise = /* @__PURE__ */ Symbol("lastPromise");
64811
+ var kHandlePromise = /* @__PURE__ */ Symbol("handlePromise");
64812
+ var kStream = /* @__PURE__ */ Symbol("stream");
64813
64813
  function createIterResult(value, done) {
64814
64814
  return {
64815
64815
  value,
@@ -102939,8 +102939,8 @@ var knownContextKeys, TracingContextImpl;
102939
102939
  var init_tracingContext = __esm({
102940
102940
  "../../node_modules/@azure/core-tracing/dist/esm/tracingContext.js"() {
102941
102941
  knownContextKeys = {
102942
- span: Symbol.for("@azure/core-tracing span"),
102943
- namespace: Symbol.for("@azure/core-tracing namespace")
102942
+ span: /* @__PURE__ */ Symbol.for("@azure/core-tracing span"),
102943
+ namespace: /* @__PURE__ */ Symbol.for("@azure/core-tracing namespace")
102944
102944
  };
102945
102945
  TracingContextImpl = class _TracingContextImpl {
102946
102946
  _contextMap;
@@ -112853,7 +112853,7 @@ var require_range = __commonJS({
112853
112853
  var require_comparator = __commonJS({
112854
112854
  "../../node_modules/semver/classes/comparator.js"(exports2, module2) {
112855
112855
  "use strict";
112856
- var ANY = Symbol("SemVer ANY");
112856
+ var ANY = /* @__PURE__ */ Symbol("SemVer ANY");
112857
112857
  var Comparator = class _Comparator {
112858
112858
  static get ANY() {
112859
112859
  return ANY;
@@ -119687,7 +119687,7 @@ var require_dist3 = __commonJS({
119687
119687
  var http3 = __importStar(require("http"));
119688
119688
  var https_1 = require("https");
119689
119689
  __exportStar(require_helpers2(), exports2);
119690
- var INTERNAL = Symbol("AgentBaseInternalState");
119690
+ var INTERNAL = /* @__PURE__ */ Symbol("AgentBaseInternalState");
119691
119691
  var Agent = class extends http3.Agent {
119692
119692
  constructor(opts) {
119693
119693
  super(opts);
@@ -121498,7 +121498,7 @@ var rawContent;
121498
121498
  var init_file = __esm({
121499
121499
  "../../node_modules/@azure/core-rest-pipeline/dist/esm/util/file.js"() {
121500
121500
  init_esm4();
121501
- rawContent = Symbol("rawContent");
121501
+ rawContent = /* @__PURE__ */ Symbol("rawContent");
121502
121502
  }
121503
121503
  });
121504
121504
 
@@ -122352,7 +122352,7 @@ var originalRequestSymbol;
122352
122352
  var init_operationHelpers = __esm({
122353
122353
  "../../node_modules/@azure/core-client/dist/esm/operationHelpers.js"() {
122354
122354
  init_state2();
122355
- originalRequestSymbol = Symbol.for("@azure/core-client original request");
122355
+ originalRequestSymbol = /* @__PURE__ */ Symbol.for("@azure/core-client original request");
122356
122356
  }
122357
122357
  });
122358
122358
 
@@ -147921,7 +147921,7 @@ var require_shams = __commonJS({
147921
147921
  return true;
147922
147922
  }
147923
147923
  var obj = {};
147924
- var sym = Symbol("test");
147924
+ var sym = /* @__PURE__ */ Symbol("test");
147925
147925
  var symObj = Object(sym);
147926
147926
  if (typeof sym === "string") {
147927
147927
  return false;
@@ -147980,7 +147980,7 @@ var require_has_symbols = __commonJS({
147980
147980
  if (typeof origSymbol("foo") !== "symbol") {
147981
147981
  return false;
147982
147982
  }
147983
- if (typeof Symbol("bar") !== "symbol") {
147983
+ if (typeof /* @__PURE__ */ Symbol("bar") !== "symbol") {
147984
147984
  return false;
147985
147985
  }
147986
147986
  return hasSymbolSham();
@@ -160647,19 +160647,8 @@ var require_dist6 = __commonJS({
160647
160647
  var NOOP_VALUE = (value) => value;
160648
160648
  var ID_START = /^[$_\p{ID_Start}]$/u;
160649
160649
  var ID_CONTINUE = /^[$\u200c\u200d\p{ID_Continue}]$/u;
160650
- var SIMPLE_TOKENS = {
160651
- // Groups.
160652
- "{": "{",
160653
- "}": "}",
160654
- // Reserved.
160655
- "(": "(",
160656
- ")": ")",
160657
- "[": "[",
160658
- "]": "]",
160659
- "+": "+",
160660
- "?": "?",
160661
- "!": "!"
160662
- };
160650
+ var ID = /^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u;
160651
+ var SIMPLE_TOKENS = "{}()[]+?!";
160663
160652
  function escapeText(str) {
160664
160653
  return str.replace(/[{}()\[\]+?!:*\\]/g, "\\$&");
160665
160654
  }
@@ -160698,8 +160687,8 @@ var require_dist6 = __commonJS({
160698
160687
  } while (ID_CONTINUE.test(chars[index]));
160699
160688
  } else if (chars[index] === '"') {
160700
160689
  let quoteStart = index;
160701
- while (index++ < chars.length) {
160702
- if (chars[index] === '"') {
160690
+ while (index < chars.length) {
160691
+ if (chars[++index] === '"') {
160703
160692
  index++;
160704
160693
  quoteStart = 0;
160705
160694
  break;
@@ -160718,18 +160707,17 @@ var require_dist6 = __commonJS({
160718
160707
  return value;
160719
160708
  }
160720
160709
  while (index < chars.length) {
160721
- const value = chars[index];
160722
- const type = SIMPLE_TOKENS[value];
160723
- if (type) {
160724
- tokens.push({ type, index: index++, value });
160710
+ const value = chars[index++];
160711
+ if (SIMPLE_TOKENS.includes(value)) {
160712
+ tokens.push({ type: value, index, value });
160725
160713
  } else if (value === "\\") {
160726
- tokens.push({ type: "escape", index: index++, value: chars[index++] });
160714
+ tokens.push({ type: "escape", index, value: chars[index++] });
160727
160715
  } else if (value === ":") {
160728
- tokens.push({ type: "param", index: index++, value: name3() });
160716
+ tokens.push({ type: "param", index, value: name3() });
160729
160717
  } else if (value === "*") {
160730
- tokens.push({ type: "wildcard", index: index++, value: name3() });
160718
+ tokens.push({ type: "wildcard", index, value: name3() });
160731
160719
  } else {
160732
- tokens.push({ type: "char", index: index++, value });
160720
+ tokens.push({ type: "char", index, value });
160733
160721
  }
160734
160722
  }
160735
160723
  tokens.push({ type: "end", index, value: "" });
@@ -160866,106 +160854,129 @@ var require_dist6 = __commonJS({
160866
160854
  function pathToRegexp(path4, options = {}) {
160867
160855
  const { delimiter = DEFAULT_DELIMITER, end = true, sensitive = false, trailing = true } = options;
160868
160856
  const keys = [];
160869
- const flags = sensitive ? "" : "i";
160870
160857
  const sources = [];
160871
- for (const input of pathsToArray(path4, [])) {
160872
- const data = typeof input === "object" ? input : parse4(input, options);
160873
- for (const tokens of flatten(data.tokens, 0, [])) {
160874
- sources.push(toRegExpSource(tokens, delimiter, keys, data.originalPath));
160858
+ const paths = [path4];
160859
+ let combinations = 0;
160860
+ while (paths.length) {
160861
+ const path5 = paths.shift();
160862
+ if (Array.isArray(path5)) {
160863
+ paths.push(...path5);
160864
+ continue;
160875
160865
  }
160866
+ const data = typeof path5 === "object" ? path5 : parse4(path5, options);
160867
+ flatten(data.tokens, 0, [], (tokens) => {
160868
+ if (combinations++ >= 256) {
160869
+ throw new PathError("Too many path combinations", data.originalPath);
160870
+ }
160871
+ sources.push(toRegExpSource(tokens, delimiter, keys, data.originalPath));
160872
+ });
160876
160873
  }
160877
160874
  let pattern = `^(?:${sources.join("|")})`;
160878
160875
  if (trailing)
160879
- pattern += `(?:${escape2(delimiter)}$)?`;
160880
- pattern += end ? "$" : `(?=${escape2(delimiter)}|$)`;
160881
- const regexp = new RegExp(pattern, flags);
160882
- return { regexp, keys };
160883
- }
160884
- function pathsToArray(paths, init) {
160885
- if (Array.isArray(paths)) {
160886
- for (const p of paths)
160887
- pathsToArray(p, init);
160888
- } else {
160889
- init.push(paths);
160890
- }
160891
- return init;
160876
+ pattern += "(?:" + escape2(delimiter) + "$)?";
160877
+ pattern += end ? "$" : "(?=" + escape2(delimiter) + "|$)";
160878
+ return { regexp: new RegExp(pattern, sensitive ? "" : "i"), keys };
160892
160879
  }
160893
- function* flatten(tokens, index, init) {
160894
- if (index === tokens.length) {
160895
- return yield init;
160896
- }
160897
- const token = tokens[index];
160898
- if (token.type === "group") {
160899
- for (const seq of flatten(token.tokens, 0, init.slice())) {
160900
- yield* flatten(tokens, index + 1, seq);
160880
+ function flatten(tokens, index, result, callback) {
160881
+ while (index < tokens.length) {
160882
+ const token = tokens[index++];
160883
+ if (token.type === "group") {
160884
+ flatten(token.tokens, 0, result.slice(), (seq) => flatten(tokens, index, seq, callback));
160885
+ continue;
160901
160886
  }
160902
- } else {
160903
- init.push(token);
160887
+ result.push(token);
160904
160888
  }
160905
- yield* flatten(tokens, index + 1, init);
160889
+ callback(result);
160906
160890
  }
160907
160891
  function toRegExpSource(tokens, delimiter, keys, originalPath) {
160908
160892
  let result = "";
160909
160893
  let backtrack = "";
160910
- let isSafeSegmentParam = true;
160911
- for (const token of tokens) {
160894
+ let wildcardBacktrack = "";
160895
+ let prevCaptureType = 0;
160896
+ let hasSegmentCapture = 0;
160897
+ let index = 0;
160898
+ function hasInSegment(index2, type) {
160899
+ while (index2 < tokens.length) {
160900
+ const token = tokens[index2++];
160901
+ if (token.type === type)
160902
+ return true;
160903
+ if (token.type === "text") {
160904
+ if (token.value.includes(delimiter))
160905
+ break;
160906
+ }
160907
+ }
160908
+ return false;
160909
+ }
160910
+ function peekText(index2) {
160911
+ let result2 = "";
160912
+ while (index2 < tokens.length) {
160913
+ const token = tokens[index2++];
160914
+ if (token.type !== "text")
160915
+ break;
160916
+ result2 += token.value;
160917
+ }
160918
+ return result2;
160919
+ }
160920
+ while (index < tokens.length) {
160921
+ const token = tokens[index++];
160912
160922
  if (token.type === "text") {
160913
160923
  result += escape2(token.value);
160914
160924
  backtrack += token.value;
160915
- isSafeSegmentParam || (isSafeSegmentParam = token.value.includes(delimiter));
160925
+ if (prevCaptureType === 2)
160926
+ wildcardBacktrack += token.value;
160927
+ if (token.value.includes(delimiter))
160928
+ hasSegmentCapture = 0;
160916
160929
  continue;
160917
160930
  }
160918
160931
  if (token.type === "param" || token.type === "wildcard") {
160919
- if (!isSafeSegmentParam && !backtrack) {
160932
+ if (prevCaptureType && !backtrack) {
160920
160933
  throw new PathError(`Missing text before "${token.name}" ${token.type}`, originalPath);
160921
160934
  }
160922
160935
  if (token.type === "param") {
160923
- result += `(${negate(delimiter, isSafeSegmentParam ? "" : backtrack)}+)`;
160936
+ result += hasSegmentCapture & 2 ? `(${negate(delimiter, backtrack)}+)` : hasInSegment(index, "wildcard") ? `(${negate(delimiter, peekText(index))}+)` : hasSegmentCapture & 1 ? `(${negate(delimiter, backtrack)}+|${escape2(backtrack)})` : `(${negate(delimiter, "")}+)`;
160937
+ hasSegmentCapture |= prevCaptureType = 1;
160924
160938
  } else {
160925
- result += `([\\s\\S]+)`;
160939
+ result += hasSegmentCapture & 2 ? `(${negate(backtrack, "")}+)` : wildcardBacktrack ? `(${negate(wildcardBacktrack, "")}+|${negate(delimiter, "")}+)` : `([^]+)`;
160940
+ wildcardBacktrack = "";
160941
+ hasSegmentCapture |= prevCaptureType = 2;
160926
160942
  }
160927
160943
  keys.push(token);
160928
160944
  backtrack = "";
160929
- isSafeSegmentParam = false;
160930
160945
  continue;
160931
160946
  }
160947
+ throw new TypeError(`Unknown token type: ${token.type}`);
160932
160948
  }
160933
160949
  return result;
160934
160950
  }
160935
- function negate(delimiter, backtrack) {
160936
- if (backtrack.length < 2) {
160937
- if (delimiter.length < 2)
160938
- return `[^${escape2(delimiter + backtrack)}]`;
160939
- return `(?:(?!${escape2(delimiter)})[^${escape2(backtrack)}])`;
160940
- }
160941
- if (delimiter.length < 2) {
160942
- return `(?:(?!${escape2(backtrack)})[^${escape2(delimiter)}])`;
160943
- }
160944
- return `(?:(?!${escape2(backtrack)}|${escape2(delimiter)})[\\s\\S])`;
160945
- }
160946
- function stringifyTokens(tokens) {
160951
+ function negate(a, b) {
160952
+ if (b.length > a.length)
160953
+ return negate(b, a);
160954
+ if (a === b)
160955
+ b = "";
160956
+ if (b.length > 1)
160957
+ return `(?:(?!${escape2(a)}|${escape2(b)})[^])`;
160958
+ if (a.length > 1)
160959
+ return `(?:(?!${escape2(a)})[^${escape2(b)}])`;
160960
+ return `[^${escape2(a + b)}]`;
160961
+ }
160962
+ function stringifyTokens(tokens, index) {
160947
160963
  let value = "";
160948
- let i = 0;
160949
- function name3(value2) {
160950
- const isSafe = isNameSafe(value2) && isNextNameSafe(tokens[i]);
160951
- return isSafe ? value2 : JSON.stringify(value2);
160952
- }
160953
- while (i < tokens.length) {
160954
- const token = tokens[i++];
160964
+ while (index < tokens.length) {
160965
+ const token = tokens[index++];
160955
160966
  if (token.type === "text") {
160956
160967
  value += escapeText(token.value);
160957
160968
  continue;
160958
160969
  }
160959
160970
  if (token.type === "group") {
160960
- value += `{${stringifyTokens(token.tokens)}}`;
160971
+ value += "{" + stringifyTokens(token.tokens, 0) + "}";
160961
160972
  continue;
160962
160973
  }
160963
160974
  if (token.type === "param") {
160964
- value += `:${name3(token.name)}`;
160975
+ value += ":" + stringifyName(token.name, tokens[index]);
160965
160976
  continue;
160966
160977
  }
160967
160978
  if (token.type === "wildcard") {
160968
- value += `*${name3(token.name)}`;
160979
+ value += "*" + stringifyName(token.name, tokens[index]);
160969
160980
  continue;
160970
160981
  }
160971
160982
  throw new TypeError(`Unknown token type: ${token.type}`);
@@ -160973,16 +160984,15 @@ var require_dist6 = __commonJS({
160973
160984
  return value;
160974
160985
  }
160975
160986
  function stringify4(data) {
160976
- return stringifyTokens(data.tokens);
160977
- }
160978
- function isNameSafe(name3) {
160979
- const [first, ...rest] = name3;
160980
- return ID_START.test(first) && rest.every((char) => ID_CONTINUE.test(char));
160987
+ return stringifyTokens(data.tokens, 0);
160981
160988
  }
160982
- function isNextNameSafe(token) {
160983
- if (token && token.type === "text")
160984
- return !ID_CONTINUE.test(token.value[0]);
160985
- return true;
160989
+ function stringifyName(name3, next) {
160990
+ if (!ID.test(name3))
160991
+ return JSON.stringify(name3);
160992
+ if ((next === null || next === void 0 ? void 0 : next.type) === "text" && ID_CONTINUE.test(next.value[0])) {
160993
+ return JSON.stringify(name3);
160994
+ }
160995
+ return name3;
160986
160996
  }
160987
160997
  }
160988
160998
  });
@@ -184525,7 +184535,9 @@ var HttpArtifactSource = class {
184525
184535
  async fetch() {
184526
184536
  const res = await fetch(this.url);
184527
184537
  if (!res.ok) {
184528
- throw new Error(`Failed to fetch artifact from ${this.describe()}: ${res.status}`);
184538
+ throw new Error(
184539
+ `Failed to fetch artifact from ${this.describe()}: ${res.status} ${res.statusText}`
184540
+ );
184529
184541
  }
184530
184542
  const raw = await res.text();
184531
184543
  const etag = res.headers.get("etag") ?? void 0;
@@ -184884,8 +184896,41 @@ var LambdaExtension = class {
184884
184896
  }
184885
184897
  };
184886
184898
 
184899
+ // src/initial-fetch.ts
184900
+ var INITIAL_FETCH_RETRIES = 3;
184901
+ var INITIAL_RETRY_BASE_MS = 2e3;
184902
+ async function initialFetch(poller, jitMode, encryptedStore, cache, sourceDesc) {
184903
+ let lastErr;
184904
+ for (let attempt = 1; attempt <= INITIAL_FETCH_RETRIES; attempt++) {
184905
+ try {
184906
+ if (jitMode) {
184907
+ await poller.fetchAndValidate();
184908
+ const artifact = encryptedStore.get();
184909
+ const { values } = await poller.getDecryptor().decrypt(artifact);
184910
+ cache.swap(values, artifact.keys, artifact.revision);
184911
+ } else {
184912
+ await poller.fetchAndDecrypt();
184913
+ }
184914
+ return;
184915
+ } catch (err) {
184916
+ lastErr = err instanceof Error ? err : new Error(String(err));
184917
+ if (attempt < INITIAL_FETCH_RETRIES) {
184918
+ const delayMs = INITIAL_RETRY_BASE_MS * 2 ** (attempt - 1);
184919
+ console.error(
184920
+ `[clef-agent] initial fetch failed (attempt ${attempt}/${INITIAL_FETCH_RETRIES}): ${lastErr.message}. Retrying in ${delayMs}ms...`
184921
+ );
184922
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
184923
+ }
184924
+ }
184925
+ }
184926
+ const hint = lastErr?.message.includes("403") ? "Check that the IAM role or credentials have read access to the artifact." : lastErr?.message.includes("404") || lastErr?.message.includes("NoSuchKey") ? "The artifact does not exist yet. Has it been deployed with `clef pack`?" : "Check the artifact URL and network connectivity.";
184927
+ throw new Error(
184928
+ `Failed to fetch artifact from ${sourceDesc} after ${INITIAL_FETCH_RETRIES} attempts: ${lastErr?.message}. ${hint}`
184929
+ );
184930
+ }
184931
+
184887
184932
  // package.json
184888
- var version5 = "0.1.10-beta.60";
184933
+ var version5 = "0.1.11-beta.62";
184889
184934
 
184890
184935
  // src/main.ts
184891
184936
  var isLambda = !!process.env.AWS_LAMBDA_RUNTIME_API;
@@ -184926,14 +184971,10 @@ async function main() {
184926
184971
  encryptedStore,
184927
184972
  onError: (err) => console.error(`[clef-agent] poll error: ${err.message}`)
184928
184973
  });
184929
- if (jitMode) {
184930
- await poller.fetchAndValidate();
184931
- const artifact = encryptedStore.get();
184932
- const { values } = await poller.getDecryptor().decrypt(artifact);
184933
- cache.swap(values, artifact.keys, artifact.revision);
184934
- } else {
184935
- await poller.fetchAndDecrypt();
184936
- }
184974
+ const sourceDesc = source.describe();
184975
+ console.log(`[clef-agent] source: ${sourceDesc}`);
184976
+ console.log(`[clef-agent] fetching initial artifact...`);
184977
+ await initialFetch(poller, jitMode, encryptedStore, cache, sourceDesc);
184937
184978
  let telemetry;
184938
184979
  if (config.telemetry) {
184939
184980
  const headers = {};
@@ -185001,6 +185042,9 @@ main().catch((err) => {
185001
185042
  console.error(`[clef-agent] config error: ${err.message}`);
185002
185043
  } else {
185003
185044
  console.error(`[clef-agent] fatal: ${err.message}`);
185045
+ if (err instanceof Error && err.stack) {
185046
+ console.error(err.stack);
185047
+ }
185004
185048
  }
185005
185049
  process.exit(1);
185006
185050
  });