@strand-js/core 0.1.6 → 0.1.8
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 +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -1
- package/dist/index.mjs +4 -1
- package/package.json +1 -1
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
package/dist/index.d.ts
CHANGED
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
|
|
@@ -465,6 +467,7 @@ function toolToJsonSchema(tool2) {
|
|
|
465
467
|
const schema = (0, import_zod_to_json_schema.zodToJsonSchema)(tool2.parameters, { target: "openApi3" });
|
|
466
468
|
const inner = schema;
|
|
467
469
|
delete inner["$schema"];
|
|
470
|
+
if (!inner["type"]) inner["type"] = "object";
|
|
468
471
|
return inner;
|
|
469
472
|
}
|
|
470
473
|
|
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
|
|
@@ -427,6 +429,7 @@ function toolToJsonSchema(tool2) {
|
|
|
427
429
|
const schema = zodToJsonSchema(tool2.parameters, { target: "openApi3" });
|
|
428
430
|
const inner = schema;
|
|
429
431
|
delete inner["$schema"];
|
|
432
|
+
if (!inner["type"]) inner["type"] = "object";
|
|
430
433
|
return inner;
|
|
431
434
|
}
|
|
432
435
|
|