@strand-js/core 0.1.6 → 0.1.7

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/README.md CHANGED
@@ -25,6 +25,7 @@ import { createStrandClient } from '@strand-js/core'
25
25
 
26
26
  const client = createStrandClient({
27
27
  baseUrl: '/api/strand',
28
+ headers: { 'x-api-key': 'your-token' }, // sent with every request
28
29
  retry: { maxAttempts: 3, backoff: 'exponential' },
29
30
  contextWindow: { strategy: 'truncate-oldest', maxTokens: 100_000 },
30
31
  })
package/dist/index.d.mts CHANGED
@@ -48,6 +48,7 @@ interface ContextWindowConfig {
48
48
  }
49
49
  interface StrandClientConfig {
50
50
  baseUrl: string;
51
+ headers?: Record<string, string>;
51
52
  retry?: RetryConfig;
52
53
  contextWindow?: ContextWindowConfig;
53
54
  }
package/dist/index.d.ts CHANGED
@@ -48,6 +48,7 @@ interface ContextWindowConfig {
48
48
  }
49
49
  interface StrandClientConfig {
50
50
  baseUrl: string;
51
+ headers?: Record<string, string>;
51
52
  retry?: RetryConfig;
52
53
  contextWindow?: ContextWindowConfig;
53
54
  }
package/dist/index.js CHANGED
@@ -182,6 +182,7 @@ var StrandClientImpl = class {
182
182
  constructor(config) {
183
183
  this.config = {
184
184
  baseUrl: config.baseUrl.replace(/\/$/, ""),
185
+ headers: config.headers ?? {},
185
186
  retry: {
186
187
  maxAttempts: config.retry?.maxAttempts ?? 3,
187
188
  backoff: config.retry?.backoff ?? "exponential",
@@ -205,7 +206,8 @@ var StrandClientImpl = class {
205
206
  method: "POST",
206
207
  headers: {
207
208
  "Content-Type": "application/json",
208
- Accept: "text/event-stream"
209
+ Accept: "text/event-stream",
210
+ ...this.config.headers
209
211
  },
210
212
  body,
211
213
  signal
package/dist/index.mjs CHANGED
@@ -144,6 +144,7 @@ var StrandClientImpl = class {
144
144
  constructor(config) {
145
145
  this.config = {
146
146
  baseUrl: config.baseUrl.replace(/\/$/, ""),
147
+ headers: config.headers ?? {},
147
148
  retry: {
148
149
  maxAttempts: config.retry?.maxAttempts ?? 3,
149
150
  backoff: config.retry?.backoff ?? "exponential",
@@ -167,7 +168,8 @@ var StrandClientImpl = class {
167
168
  method: "POST",
168
169
  headers: {
169
170
  "Content-Type": "application/json",
170
- Accept: "text/event-stream"
171
+ Accept: "text/event-stream",
172
+ ...this.config.headers
171
173
  },
172
174
  body,
173
175
  signal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strand-js/core",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "license": "MIT",
5
5
  "description": "Provider-agnostic AI state management — core types and client",
6
6
  "main": "./dist/index.js",