@axiom-lattice/client-sdk 4.6.0 → 4.7.0
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/__tests__/affinity-headers.test.d.ts +2 -0
- package/dist/__tests__/affinity-headers.test.d.ts.map +1 -0
- package/dist/__tests__/affinity-headers.test.js +62 -0
- package/dist/__tests__/affinity-headers.test.js.map +1 -0
- package/dist/__tests__/runtime-client.test.js +13 -0
- package/dist/__tests__/runtime-client.test.js.map +1 -1
- package/dist/__tests__/wechat-affinity.test.d.ts +2 -0
- package/dist/__tests__/wechat-affinity.test.d.ts.map +1 -0
- package/dist/__tests__/wechat-affinity.test.js +23 -0
- package/dist/__tests__/wechat-affinity.test.js.map +1 -0
- package/dist/abstract-client.d.ts.map +1 -1
- package/dist/abstract-client.js +2 -0
- package/dist/abstract-client.js.map +1 -1
- package/dist/client.d.ts +1 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +10 -0
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +24 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -5
- package/dist/index.mjs.map +1 -1
- package/dist/runtime-client.d.ts.map +1 -1
- package/dist/runtime-client.js +2 -0
- package/dist/runtime-client.js.map +1 -1
- package/dist/wechat-client.d.ts.map +1 -1
- package/dist/wechat-client.js +3 -0
- package/dist/wechat-client.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1887,6 +1887,7 @@ var ScheduledTaskStatus = /* @__PURE__ */ ((ScheduledTaskStatus2) => {
|
|
|
1887
1887
|
})(ScheduledTaskStatus || {});
|
|
1888
1888
|
|
|
1889
1889
|
// src/abstract-client.ts
|
|
1890
|
+
var import_protocols = require("@axiom-lattice/protocols");
|
|
1890
1891
|
var AbstractClient = class {
|
|
1891
1892
|
/**
|
|
1892
1893
|
* Creates a new AbstractClient instance
|
|
@@ -2017,7 +2018,8 @@ var AbstractClient = class {
|
|
|
2017
2018
|
return await this.makeRequest(
|
|
2018
2019
|
`/api/assistants/${params.assistantId}/threads/${params.threadId}/abort`,
|
|
2019
2020
|
{
|
|
2020
|
-
method: "POST"
|
|
2021
|
+
method: "POST",
|
|
2022
|
+
headers: (0, import_protocols.threadAffinityHeaders)(params.threadId)
|
|
2021
2023
|
}
|
|
2022
2024
|
);
|
|
2023
2025
|
}
|
|
@@ -3397,6 +3399,9 @@ var AbstractClient = class {
|
|
|
3397
3399
|
}
|
|
3398
3400
|
};
|
|
3399
3401
|
|
|
3402
|
+
// src/client.ts
|
|
3403
|
+
var import_protocols2 = require("@axiom-lattice/protocols");
|
|
3404
|
+
|
|
3400
3405
|
// src/resources-client.ts
|
|
3401
3406
|
var ResourcesClient = class {
|
|
3402
3407
|
constructor(baseURL, getHeaders) {
|
|
@@ -4319,6 +4324,7 @@ var _Client = class extends AbstractClient {
|
|
|
4319
4324
|
const requestHeaders = {
|
|
4320
4325
|
...this.headers,
|
|
4321
4326
|
...workspaceHeaders,
|
|
4327
|
+
...this.bodyAffinityHeaders(options?.body),
|
|
4322
4328
|
...options?.headers || {}
|
|
4323
4329
|
};
|
|
4324
4330
|
if (method === "DELETE" && !options?.body) {
|
|
@@ -4356,7 +4362,8 @@ var _Client = class extends AbstractClient {
|
|
|
4356
4362
|
const headers = {
|
|
4357
4363
|
"Content-Type": "application/json",
|
|
4358
4364
|
Accept: "text/event-stream",
|
|
4359
|
-
...this.getAllHeaders()
|
|
4365
|
+
...this.getAllHeaders(),
|
|
4366
|
+
...(0, import_protocols2.threadAffinityHeaders)(options.threadId)
|
|
4360
4367
|
};
|
|
4361
4368
|
const controller = new AbortController();
|
|
4362
4369
|
const { signal } = controller;
|
|
@@ -4454,11 +4461,18 @@ var _Client = class extends AbstractClient {
|
|
|
4454
4461
|
...workspaceHeaders
|
|
4455
4462
|
};
|
|
4456
4463
|
}
|
|
4464
|
+
bodyAffinityHeaders(body) {
|
|
4465
|
+
if (!body || typeof body !== "object" || body instanceof FormData)
|
|
4466
|
+
return {};
|
|
4467
|
+
const threadId = body.thread_id;
|
|
4468
|
+
return typeof threadId === "string" ? (0, import_protocols2.threadAffinityHeaders)(threadId) : {};
|
|
4469
|
+
}
|
|
4457
4470
|
streamRun(options, onEvent, onComplete, onError) {
|
|
4458
4471
|
const headers = {
|
|
4459
4472
|
"Content-Type": "application/json",
|
|
4460
4473
|
Accept: "text/event-stream",
|
|
4461
|
-
...this.getAllHeaders()
|
|
4474
|
+
...this.getAllHeaders(),
|
|
4475
|
+
...(0, import_protocols2.threadAffinityHeaders)(options.threadId)
|
|
4462
4476
|
};
|
|
4463
4477
|
const controller = new AbortController();
|
|
4464
4478
|
const { signal } = controller;
|
|
@@ -4568,9 +4582,11 @@ var RuntimeAxiomClient = class extends Client {
|
|
|
4568
4582
|
async makeRequest(url, options) {
|
|
4569
4583
|
await this.primeToken();
|
|
4570
4584
|
const method = options?.method ?? "GET";
|
|
4585
|
+
const affinity = this.bodyAffinityHeaders(options?.body);
|
|
4571
4586
|
const headers = {
|
|
4572
4587
|
"Content-Type": "application/json",
|
|
4573
4588
|
...this.identityHeaders(),
|
|
4589
|
+
...affinity,
|
|
4574
4590
|
...options?.headers ?? {}
|
|
4575
4591
|
};
|
|
4576
4592
|
const requestOptions = { method, headers };
|
|
@@ -4624,6 +4640,7 @@ var RuntimeAxiomClient = class extends Client {
|
|
|
4624
4640
|
};
|
|
4625
4641
|
|
|
4626
4642
|
// src/wechat-client.ts
|
|
4643
|
+
var import_protocols3 = require("@axiom-lattice/protocols");
|
|
4627
4644
|
var import_encoding = __toESM(require_encoding());
|
|
4628
4645
|
var WeChatClient = class extends AbstractClient {
|
|
4629
4646
|
/**
|
|
@@ -4721,7 +4738,8 @@ var WeChatClient = class extends AbstractClient {
|
|
|
4721
4738
|
const headers = {
|
|
4722
4739
|
"Content-Type": "application/json",
|
|
4723
4740
|
Authorization: `Bearer ${this.config.apiKey}`,
|
|
4724
|
-
...this.config.headers
|
|
4741
|
+
...this.config.headers,
|
|
4742
|
+
...(0, import_protocols3.threadAffinityHeaders)(options.threadId)
|
|
4725
4743
|
};
|
|
4726
4744
|
if (this.tenantId) {
|
|
4727
4745
|
headers["x-tenant-id"] = this.tenantId;
|
|
@@ -4835,7 +4853,8 @@ var WeChatClient = class extends AbstractClient {
|
|
|
4835
4853
|
const headers = {
|
|
4836
4854
|
"Content-Type": "application/json",
|
|
4837
4855
|
Authorization: `Bearer ${this.config.apiKey}`,
|
|
4838
|
-
...this.config.headers
|
|
4856
|
+
...this.config.headers,
|
|
4857
|
+
...(0, import_protocols3.threadAffinityHeaders)(options.threadId)
|
|
4839
4858
|
};
|
|
4840
4859
|
if (this.tenantId) {
|
|
4841
4860
|
headers["x-tenant-id"] = this.tenantId;
|