@axiom-lattice/client-sdk 2.1.60 → 2.1.61
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/abstract-client.d.ts +11 -0
- package/dist/abstract-client.d.ts.map +1 -1
- package/dist/abstract-client.js +32 -0
- package/dist/abstract-client.js.map +1 -1
- package/dist/export-import.d.ts +30 -0
- package/dist/export-import.d.ts.map +1 -0
- package/dist/export-import.js +81 -0
- package/dist/export-import.js.map +1 -0
- package/dist/index.d.ts +42 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +123 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +122 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1887,6 +1887,36 @@ var AbstractClient = class {
|
|
|
1887
1887
|
});
|
|
1888
1888
|
return result;
|
|
1889
1889
|
},
|
|
1890
|
+
/**
|
|
1891
|
+
* Enqueues a message into the thread's background queue without waiting for a response.
|
|
1892
|
+
* Uses the background flag so the server returns 202 immediately.
|
|
1893
|
+
* Response chunks are delivered through the shared ThreadStream SSE connection.
|
|
1894
|
+
* @param options - Options for the background message
|
|
1895
|
+
* @returns A promise resolving to the enqueued message ID
|
|
1896
|
+
*/
|
|
1897
|
+
sendBackground: async (options) => {
|
|
1898
|
+
const message = options.messages[options.messages.length - 1];
|
|
1899
|
+
const { command, threadId, files, assistantId, mode, ...rest } = options;
|
|
1900
|
+
const response = await this.makeRequest("/api/runs", {
|
|
1901
|
+
method: "POST",
|
|
1902
|
+
body: {
|
|
1903
|
+
assistant_id: assistantId || this.assistantId,
|
|
1904
|
+
thread_id: threadId,
|
|
1905
|
+
message: typeof message.content === "string" ? message.content : JSON.stringify(message.content),
|
|
1906
|
+
message_id: message.id,
|
|
1907
|
+
files,
|
|
1908
|
+
command,
|
|
1909
|
+
streaming: false,
|
|
1910
|
+
background: true,
|
|
1911
|
+
mode,
|
|
1912
|
+
...rest
|
|
1913
|
+
}
|
|
1914
|
+
});
|
|
1915
|
+
if (!response.success) {
|
|
1916
|
+
throw new Error(response.error || "Failed to enqueue message");
|
|
1917
|
+
}
|
|
1918
|
+
return { messageId: response.messageId, queued: response.queued };
|
|
1919
|
+
},
|
|
1890
1920
|
/**
|
|
1891
1921
|
* Sends a message to a thread and streams the response
|
|
1892
1922
|
* @param options - Options for streaming a message
|
|
@@ -3800,6 +3830,97 @@ var WorkspaceClient = class {
|
|
|
3800
3830
|
}
|
|
3801
3831
|
};
|
|
3802
3832
|
|
|
3833
|
+
// src/export-import.ts
|
|
3834
|
+
var ExportImportClient = class {
|
|
3835
|
+
constructor(config) {
|
|
3836
|
+
this.baseURL = config.baseURL;
|
|
3837
|
+
this.headers = {
|
|
3838
|
+
"Content-Type": "application/json",
|
|
3839
|
+
Authorization: `Bearer ${config.apiKey}`,
|
|
3840
|
+
...config.headers
|
|
3841
|
+
};
|
|
3842
|
+
}
|
|
3843
|
+
async request(url, options = {}) {
|
|
3844
|
+
const fullUrl = `${this.baseURL}${url}`;
|
|
3845
|
+
const response = await fetch(fullUrl, {
|
|
3846
|
+
...options,
|
|
3847
|
+
headers: {
|
|
3848
|
+
...this.headers,
|
|
3849
|
+
...options.headers
|
|
3850
|
+
}
|
|
3851
|
+
});
|
|
3852
|
+
if (!response.ok) {
|
|
3853
|
+
const err = await response.json().catch(() => ({}));
|
|
3854
|
+
throw new Error(
|
|
3855
|
+
err.message || `HTTP error! Status: ${response.status}`
|
|
3856
|
+
);
|
|
3857
|
+
}
|
|
3858
|
+
return response.json();
|
|
3859
|
+
}
|
|
3860
|
+
async getExportableTypes() {
|
|
3861
|
+
const response = await this.request(
|
|
3862
|
+
"/api/tenants/exportable-types"
|
|
3863
|
+
);
|
|
3864
|
+
return response.data || [];
|
|
3865
|
+
}
|
|
3866
|
+
async exportConfig(tenantId, entityTypes) {
|
|
3867
|
+
const response = await this.request(
|
|
3868
|
+
`/api/tenants/${tenantId}/export`,
|
|
3869
|
+
{
|
|
3870
|
+
method: "POST",
|
|
3871
|
+
body: JSON.stringify({ entityTypes })
|
|
3872
|
+
}
|
|
3873
|
+
);
|
|
3874
|
+
return response.data;
|
|
3875
|
+
}
|
|
3876
|
+
async exportConfigConfirm(tenantId, entityTypes) {
|
|
3877
|
+
const response = await this.request(
|
|
3878
|
+
`/api/tenants/${tenantId}/export/confirm`,
|
|
3879
|
+
{
|
|
3880
|
+
method: "POST",
|
|
3881
|
+
body: JSON.stringify({ entityTypes })
|
|
3882
|
+
}
|
|
3883
|
+
);
|
|
3884
|
+
return response.data;
|
|
3885
|
+
}
|
|
3886
|
+
getExportDownloadUrl(tenantId, jobId) {
|
|
3887
|
+
return `${this.baseURL}/api/tenants/${tenantId}/export/${jobId}/download`;
|
|
3888
|
+
}
|
|
3889
|
+
async importPreview(tenantId, file) {
|
|
3890
|
+
const formData = new FormData();
|
|
3891
|
+
formData.append("file", file);
|
|
3892
|
+
const fullUrl = `${this.baseURL}/api/tenants/${tenantId}/import/preview`;
|
|
3893
|
+
const headers = { ...this.headers };
|
|
3894
|
+
delete headers["Content-Type"];
|
|
3895
|
+
const response = await fetch(fullUrl, {
|
|
3896
|
+
method: "POST",
|
|
3897
|
+
headers,
|
|
3898
|
+
body: formData
|
|
3899
|
+
});
|
|
3900
|
+
if (!response.ok) {
|
|
3901
|
+
const err = await response.json().catch(() => ({}));
|
|
3902
|
+
throw new Error(
|
|
3903
|
+
err.message || `HTTP error! Status: ${response.status}`
|
|
3904
|
+
);
|
|
3905
|
+
}
|
|
3906
|
+
const json = await response.json();
|
|
3907
|
+
if (!json.success || !json.data) {
|
|
3908
|
+
throw new Error(json.error || "Import preview failed");
|
|
3909
|
+
}
|
|
3910
|
+
return json.data;
|
|
3911
|
+
}
|
|
3912
|
+
async importApply(tenantId, bundle, resolutions) {
|
|
3913
|
+
const response = await this.request(
|
|
3914
|
+
`/api/tenants/${tenantId}/import/apply`,
|
|
3915
|
+
{
|
|
3916
|
+
method: "POST",
|
|
3917
|
+
body: JSON.stringify({ bundle, resolutions })
|
|
3918
|
+
}
|
|
3919
|
+
);
|
|
3920
|
+
return response.data;
|
|
3921
|
+
}
|
|
3922
|
+
};
|
|
3923
|
+
|
|
3803
3924
|
// src/ChunkMessageMerger.ts
|
|
3804
3925
|
import { parse } from "best-effort-json-parser";
|
|
3805
3926
|
function createSimpleMessageMerger() {
|
|
@@ -3998,6 +4119,7 @@ export {
|
|
|
3998
4119
|
AuthenticationError,
|
|
3999
4120
|
Client,
|
|
4000
4121
|
EvalClient,
|
|
4122
|
+
ExportImportClient,
|
|
4001
4123
|
NetworkError,
|
|
4002
4124
|
ResourcesClient,
|
|
4003
4125
|
ScheduleExecutionType,
|