@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.
package/dist/index.d.cts CHANGED
@@ -1611,7 +1611,7 @@ declare function buildOperationMetadata(payload: Record<string, unknown>, option
1611
1611
  declare const DEFAULT_SIGLUME_API_BASE = "https://siglume.com/v1";
1612
1612
  type FetchLike$1 = typeof fetch;
1613
1613
  interface SiglumeClientOptions {
1614
- api_key: string;
1614
+ api_key?: string;
1615
1615
  agent_key?: string;
1616
1616
  base_url?: string;
1617
1617
  timeout_ms?: number;
@@ -2177,7 +2177,7 @@ declare class SiglumeClient implements SiglumeClientShape {
2177
2177
  readonly max_retries: number;
2178
2178
  private readonly fetchImpl;
2179
2179
  private readonly pendingConfirmations;
2180
- constructor(options: SiglumeClientOptions);
2180
+ constructor(options?: SiglumeClientOptions);
2181
2181
  close(): void;
2182
2182
  auto_register(manifest: AppManifest | Record<string, unknown>, tool_manual: ToolManual | Record<string, unknown>, options?: {
2183
2183
  source_code?: string;
package/dist/index.d.ts CHANGED
@@ -1611,7 +1611,7 @@ declare function buildOperationMetadata(payload: Record<string, unknown>, option
1611
1611
  declare const DEFAULT_SIGLUME_API_BASE = "https://siglume.com/v1";
1612
1612
  type FetchLike$1 = typeof fetch;
1613
1613
  interface SiglumeClientOptions {
1614
- api_key: string;
1614
+ api_key?: string;
1615
1615
  agent_key?: string;
1616
1616
  base_url?: string;
1617
1617
  timeout_ms?: number;
@@ -2177,7 +2177,7 @@ declare class SiglumeClient implements SiglumeClientShape {
2177
2177
  readonly max_retries: number;
2178
2178
  private readonly fetchImpl;
2179
2179
  private readonly pendingConfirmations;
2180
- constructor(options: SiglumeClientOptions);
2180
+ constructor(options?: SiglumeClientOptions);
2181
2181
  close(): void;
2182
2182
  auto_register(manifest: AppManifest | Record<string, unknown>, tool_manual: ToolManual | Record<string, unknown>, options?: {
2183
2183
  source_code?: string;
package/dist/index.js CHANGED
@@ -2822,11 +2822,15 @@ var init_client = __esm({
2822
2822
  max_retries;
2823
2823
  fetchImpl;
2824
2824
  pendingConfirmations = /* @__PURE__ */ new Map();
2825
- constructor(options) {
2826
- if (!options.api_key) {
2827
- throw new SiglumeClientError("SIGLUME_API_KEY is required.");
2825
+ constructor(options = {}) {
2826
+ const envApiKey = typeof process !== "undefined" ? process.env?.SIGLUME_API_KEY : void 0;
2827
+ const resolvedApiKey = (options.api_key ?? envApiKey ?? "").trim();
2828
+ if (!resolvedApiKey) {
2829
+ throw new SiglumeClientError(
2830
+ "SIGLUME_API_KEY is required. Pass it as the api_key option or set the SIGLUME_API_KEY env var."
2831
+ );
2828
2832
  }
2829
- this.api_key = options.api_key;
2833
+ this.api_key = resolvedApiKey;
2830
2834
  this.agent_key = options.agent_key?.trim() || void 0;
2831
2835
  this.base_url = (options.base_url ?? DEFAULT_SIGLUME_API_BASE).replace(/\/+$/, "");
2832
2836
  this.timeout_ms = Math.max(1, options.timeout_ms ?? 15e3);
@@ -4889,7 +4893,7 @@ ${details}` : summary;
4889
4893
  const headers = new Headers({
4890
4894
  Authorization: `Bearer ${this.api_key}`,
4891
4895
  Accept: "application/json",
4892
- "User-Agent": "siglume-api-sdk-ts/0.6.0"
4896
+ "User-Agent": "siglume-api-sdk-ts/0.7.6"
4893
4897
  });
4894
4898
  if (options.headers) {
4895
4899
  for (const [key, value] of Object.entries(options.headers)) {
@@ -5091,7 +5095,7 @@ var init_metering = __esm({
5091
5095
  fetchImpl;
5092
5096
  constructor(options) {
5093
5097
  this.client = new SiglumeClient(options);
5094
- this.api_key = options.api_key;
5098
+ this.api_key = this.client.api_key;
5095
5099
  this.base_url = (options.base_url ?? DEFAULT_SIGLUME_API_BASE).replace(/\/+$/, "");
5096
5100
  this.timeout_ms = Math.max(1, options.timeout_ms ?? 15e3);
5097
5101
  this.max_retries = Math.max(1, Math.trunc(options.max_retries ?? 3));
@@ -5137,7 +5141,7 @@ var init_metering = __esm({
5137
5141
  const headers = new Headers({
5138
5142
  Authorization: `Bearer ${this.api_key}`,
5139
5143
  Accept: "application/json",
5140
- "User-Agent": "siglume-api-sdk-ts/0.6.0"
5144
+ "User-Agent": "siglume-api-sdk-ts/0.7.6"
5141
5145
  });
5142
5146
  let body;
5143
5147
  if (options.json_body) {
@@ -5243,7 +5247,7 @@ var SiglumeBuyerClient = class {
5243
5247
  warnedFeatures = /* @__PURE__ */ new Set();
5244
5248
  constructor(options) {
5245
5249
  this.client = new SiglumeClient(options);
5246
- this.api_key = options.api_key;
5250
+ this.api_key = this.client.api_key;
5247
5251
  this.base_url = (options.base_url ?? DEFAULT_SIGLUME_API_BASE).replace(/\/+$/, "");
5248
5252
  this.timeout_ms = Math.max(1, options.timeout_ms ?? 15e3);
5249
5253
  this.max_retries = Math.max(1, Math.trunc(options.max_retries ?? 3));
@@ -5420,7 +5424,7 @@ var SiglumeBuyerClient = class {
5420
5424
  const headers = new Headers({
5421
5425
  Authorization: `Bearer ${this.api_key}`,
5422
5426
  Accept: "application/json",
5423
- "User-Agent": "siglume-api-sdk-ts/0.6.0"
5427
+ "User-Agent": "siglume-api-sdk-ts/0.7.6"
5424
5428
  });
5425
5429
  let body;
5426
5430
  if (options.json_body) {