@axiom-lattice/client-sdk 2.1.60 → 2.1.63
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 +19 -1
- package/dist/abstract-client.d.ts.map +1 -1
- package/dist/abstract-client.js +46 -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 +50 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +139 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +138 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
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
|
|
@@ -2586,6 +2616,22 @@ var AbstractClient = class {
|
|
|
2586
2616
|
if (!response.data)
|
|
2587
2617
|
throw new ApiError("Failed to complete task", 500);
|
|
2588
2618
|
return response.data;
|
|
2619
|
+
},
|
|
2620
|
+
workItems: {
|
|
2621
|
+
list: async (taskId, params) => {
|
|
2622
|
+
const searchParams = new URLSearchParams();
|
|
2623
|
+
if (params?.action)
|
|
2624
|
+
searchParams.set("action", params.action);
|
|
2625
|
+
if (params?.limit)
|
|
2626
|
+
searchParams.set("limit", String(params.limit));
|
|
2627
|
+
if (params?.offset)
|
|
2628
|
+
searchParams.set("offset", String(params.offset));
|
|
2629
|
+
const qs = searchParams.toString();
|
|
2630
|
+
const response = await this.makeRequest(
|
|
2631
|
+
`/api/tasks/${taskId}/work-items${qs ? `?${qs}` : ""}`
|
|
2632
|
+
);
|
|
2633
|
+
return response.data;
|
|
2634
|
+
}
|
|
2589
2635
|
}
|
|
2590
2636
|
};
|
|
2591
2637
|
this.menu = {
|
|
@@ -3800,6 +3846,97 @@ var WorkspaceClient = class {
|
|
|
3800
3846
|
}
|
|
3801
3847
|
};
|
|
3802
3848
|
|
|
3849
|
+
// src/export-import.ts
|
|
3850
|
+
var ExportImportClient = class {
|
|
3851
|
+
constructor(config) {
|
|
3852
|
+
this.baseURL = config.baseURL;
|
|
3853
|
+
this.headers = {
|
|
3854
|
+
"Content-Type": "application/json",
|
|
3855
|
+
Authorization: `Bearer ${config.apiKey}`,
|
|
3856
|
+
...config.headers
|
|
3857
|
+
};
|
|
3858
|
+
}
|
|
3859
|
+
async request(url, options = {}) {
|
|
3860
|
+
const fullUrl = `${this.baseURL}${url}`;
|
|
3861
|
+
const response = await fetch(fullUrl, {
|
|
3862
|
+
...options,
|
|
3863
|
+
headers: {
|
|
3864
|
+
...this.headers,
|
|
3865
|
+
...options.headers
|
|
3866
|
+
}
|
|
3867
|
+
});
|
|
3868
|
+
if (!response.ok) {
|
|
3869
|
+
const err = await response.json().catch(() => ({}));
|
|
3870
|
+
throw new Error(
|
|
3871
|
+
err.message || `HTTP error! Status: ${response.status}`
|
|
3872
|
+
);
|
|
3873
|
+
}
|
|
3874
|
+
return response.json();
|
|
3875
|
+
}
|
|
3876
|
+
async getExportableTypes() {
|
|
3877
|
+
const response = await this.request(
|
|
3878
|
+
"/api/tenants/exportable-types"
|
|
3879
|
+
);
|
|
3880
|
+
return response.data || [];
|
|
3881
|
+
}
|
|
3882
|
+
async exportConfig(tenantId, entityTypes) {
|
|
3883
|
+
const response = await this.request(
|
|
3884
|
+
`/api/tenants/${tenantId}/export`,
|
|
3885
|
+
{
|
|
3886
|
+
method: "POST",
|
|
3887
|
+
body: JSON.stringify({ entityTypes })
|
|
3888
|
+
}
|
|
3889
|
+
);
|
|
3890
|
+
return response.data;
|
|
3891
|
+
}
|
|
3892
|
+
async exportConfigConfirm(tenantId, entityTypes) {
|
|
3893
|
+
const response = await this.request(
|
|
3894
|
+
`/api/tenants/${tenantId}/export/confirm`,
|
|
3895
|
+
{
|
|
3896
|
+
method: "POST",
|
|
3897
|
+
body: JSON.stringify({ entityTypes })
|
|
3898
|
+
}
|
|
3899
|
+
);
|
|
3900
|
+
return response.data;
|
|
3901
|
+
}
|
|
3902
|
+
getExportDownloadUrl(tenantId, jobId) {
|
|
3903
|
+
return `${this.baseURL}/api/tenants/${tenantId}/export/${jobId}/download`;
|
|
3904
|
+
}
|
|
3905
|
+
async importPreview(tenantId, file) {
|
|
3906
|
+
const formData = new FormData();
|
|
3907
|
+
formData.append("file", file);
|
|
3908
|
+
const fullUrl = `${this.baseURL}/api/tenants/${tenantId}/import/preview`;
|
|
3909
|
+
const headers = { ...this.headers };
|
|
3910
|
+
delete headers["Content-Type"];
|
|
3911
|
+
const response = await fetch(fullUrl, {
|
|
3912
|
+
method: "POST",
|
|
3913
|
+
headers,
|
|
3914
|
+
body: formData
|
|
3915
|
+
});
|
|
3916
|
+
if (!response.ok) {
|
|
3917
|
+
const err = await response.json().catch(() => ({}));
|
|
3918
|
+
throw new Error(
|
|
3919
|
+
err.message || `HTTP error! Status: ${response.status}`
|
|
3920
|
+
);
|
|
3921
|
+
}
|
|
3922
|
+
const json = await response.json();
|
|
3923
|
+
if (!json.success || !json.data) {
|
|
3924
|
+
throw new Error(json.error || "Import preview failed");
|
|
3925
|
+
}
|
|
3926
|
+
return json.data;
|
|
3927
|
+
}
|
|
3928
|
+
async importApply(tenantId, bundle, resolutions) {
|
|
3929
|
+
const response = await this.request(
|
|
3930
|
+
`/api/tenants/${tenantId}/import/apply`,
|
|
3931
|
+
{
|
|
3932
|
+
method: "POST",
|
|
3933
|
+
body: JSON.stringify({ bundle, resolutions })
|
|
3934
|
+
}
|
|
3935
|
+
);
|
|
3936
|
+
return response.data;
|
|
3937
|
+
}
|
|
3938
|
+
};
|
|
3939
|
+
|
|
3803
3940
|
// src/ChunkMessageMerger.ts
|
|
3804
3941
|
import { parse } from "best-effort-json-parser";
|
|
3805
3942
|
function createSimpleMessageMerger() {
|
|
@@ -3998,6 +4135,7 @@ export {
|
|
|
3998
4135
|
AuthenticationError,
|
|
3999
4136
|
Client,
|
|
4000
4137
|
EvalClient,
|
|
4138
|
+
ExportImportClient,
|
|
4001
4139
|
NetworkError,
|
|
4002
4140
|
ResourcesClient,
|
|
4003
4141
|
ScheduleExecutionType,
|