@siglume/api-sdk 0.7.5 → 0.7.6

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.
@@ -2532,11 +2532,15 @@ var init_client = __esm({
2532
2532
  max_retries;
2533
2533
  fetchImpl;
2534
2534
  pendingConfirmations = /* @__PURE__ */ new Map();
2535
- constructor(options) {
2536
- if (!options.api_key) {
2537
- throw new SiglumeClientError("SIGLUME_API_KEY is required.");
2535
+ constructor(options = {}) {
2536
+ const envApiKey = typeof process !== "undefined" ? process.env?.SIGLUME_API_KEY : void 0;
2537
+ const resolvedApiKey = (options.api_key ?? envApiKey ?? "").trim();
2538
+ if (!resolvedApiKey) {
2539
+ throw new SiglumeClientError(
2540
+ "SIGLUME_API_KEY is required. Pass it as the api_key option or set the SIGLUME_API_KEY env var."
2541
+ );
2538
2542
  }
2539
- this.api_key = options.api_key;
2543
+ this.api_key = resolvedApiKey;
2540
2544
  this.agent_key = options.agent_key?.trim() || void 0;
2541
2545
  this.base_url = (options.base_url ?? DEFAULT_SIGLUME_API_BASE).replace(/\/+$/, "");
2542
2546
  this.timeout_ms = Math.max(1, options.timeout_ms ?? 15e3);
@@ -4599,7 +4603,7 @@ ${details}` : summary;
4599
4603
  const headers = new Headers({
4600
4604
  Authorization: `Bearer ${this.api_key}`,
4601
4605
  Accept: "application/json",
4602
- "User-Agent": "siglume-api-sdk-ts/0.6.0"
4606
+ "User-Agent": "siglume-api-sdk-ts/0.7.6"
4603
4607
  });
4604
4608
  if (options.headers) {
4605
4609
  for (const [key, value] of Object.entries(options.headers)) {
@@ -4801,7 +4805,7 @@ var init_metering = __esm({
4801
4805
  fetchImpl;
4802
4806
  constructor(options) {
4803
4807
  this.client = new SiglumeClient(options);
4804
- this.api_key = options.api_key;
4808
+ this.api_key = this.client.api_key;
4805
4809
  this.base_url = (options.base_url ?? DEFAULT_SIGLUME_API_BASE).replace(/\/+$/, "");
4806
4810
  this.timeout_ms = Math.max(1, options.timeout_ms ?? 15e3);
4807
4811
  this.max_retries = Math.max(1, Math.trunc(options.max_retries ?? 3));
@@ -4847,7 +4851,7 @@ var init_metering = __esm({
4847
4851
  const headers = new Headers({
4848
4852
  Authorization: `Bearer ${this.api_key}`,
4849
4853
  Accept: "application/json",
4850
- "User-Agent": "siglume-api-sdk-ts/0.6.0"
4854
+ "User-Agent": "siglume-api-sdk-ts/0.7.6"
4851
4855
  });
4852
4856
  let body;
4853
4857
  if (options.json_body) {
@@ -7818,10 +7822,18 @@ function operationReadmeTemplate(operation, manifest, warning) {
7818
7822
  "",
7819
7823
  "## Commands",
7820
7824
  "",
7825
+ "Start locally without a Siglume API key:",
7826
+ "",
7821
7827
  "```bash",
7822
- "siglume validate .",
7823
7828
  "siglume test .",
7824
7829
  "npm test -- tests/test_adapter.ts",
7830
+ "siglume score . --offline",
7831
+ "```",
7832
+ "",
7833
+ "After placeholders are replaced and `SIGLUME_API_KEY` is set, run the server-aligned checks and register:",
7834
+ "",
7835
+ "```bash",
7836
+ "siglume validate .",
7825
7837
  "siglume score . --remote",
7826
7838
  "siglume register . --confirm",
7827
7839
  "```",
@@ -8251,9 +8263,17 @@ function readmeTemplate(template) {
8251
8263
  "",
8252
8264
  "Suggested workflow:",
8253
8265
  "",
8266
+ "Start locally without a Siglume API key:",
8267
+ "",
8254
8268
  "```bash",
8255
- "siglume validate .",
8256
8269
  "siglume test .",
8270
+ "siglume score . --offline",
8271
+ "```",
8272
+ "",
8273
+ "After placeholders are replaced and `SIGLUME_API_KEY` is set, run the server-aligned checks and register:",
8274
+ "",
8275
+ "```bash",
8276
+ "siglume validate .",
8257
8277
  "siglume score . --remote",
8258
8278
  "siglume register . --confirm",
8259
8279
  "```",