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