@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.js
CHANGED
|
@@ -1833,6 +1833,7 @@ __export(src_exports, {
|
|
|
1833
1833
|
AuthenticationError: () => AuthenticationError,
|
|
1834
1834
|
Client: () => Client,
|
|
1835
1835
|
EvalClient: () => EvalClient,
|
|
1836
|
+
ExportImportClient: () => ExportImportClient,
|
|
1836
1837
|
NetworkError: () => NetworkError,
|
|
1837
1838
|
ResourcesClient: () => ResourcesClient,
|
|
1838
1839
|
ScheduleExecutionType: () => ScheduleExecutionType,
|
|
@@ -1911,6 +1912,36 @@ var AbstractClient = class {
|
|
|
1911
1912
|
});
|
|
1912
1913
|
return result;
|
|
1913
1914
|
},
|
|
1915
|
+
/**
|
|
1916
|
+
* Enqueues a message into the thread's background queue without waiting for a response.
|
|
1917
|
+
* Uses the background flag so the server returns 202 immediately.
|
|
1918
|
+
* Response chunks are delivered through the shared ThreadStream SSE connection.
|
|
1919
|
+
* @param options - Options for the background message
|
|
1920
|
+
* @returns A promise resolving to the enqueued message ID
|
|
1921
|
+
*/
|
|
1922
|
+
sendBackground: async (options) => {
|
|
1923
|
+
const message = options.messages[options.messages.length - 1];
|
|
1924
|
+
const { command, threadId, files, assistantId, mode, ...rest } = options;
|
|
1925
|
+
const response = await this.makeRequest("/api/runs", {
|
|
1926
|
+
method: "POST",
|
|
1927
|
+
body: {
|
|
1928
|
+
assistant_id: assistantId || this.assistantId,
|
|
1929
|
+
thread_id: threadId,
|
|
1930
|
+
message: typeof message.content === "string" ? message.content : JSON.stringify(message.content),
|
|
1931
|
+
message_id: message.id,
|
|
1932
|
+
files,
|
|
1933
|
+
command,
|
|
1934
|
+
streaming: false,
|
|
1935
|
+
background: true,
|
|
1936
|
+
mode,
|
|
1937
|
+
...rest
|
|
1938
|
+
}
|
|
1939
|
+
});
|
|
1940
|
+
if (!response.success) {
|
|
1941
|
+
throw new Error(response.error || "Failed to enqueue message");
|
|
1942
|
+
}
|
|
1943
|
+
return { messageId: response.messageId, queued: response.queued };
|
|
1944
|
+
},
|
|
1914
1945
|
/**
|
|
1915
1946
|
* Sends a message to a thread and streams the response
|
|
1916
1947
|
* @param options - Options for streaming a message
|
|
@@ -2610,6 +2641,22 @@ var AbstractClient = class {
|
|
|
2610
2641
|
if (!response.data)
|
|
2611
2642
|
throw new ApiError("Failed to complete task", 500);
|
|
2612
2643
|
return response.data;
|
|
2644
|
+
},
|
|
2645
|
+
workItems: {
|
|
2646
|
+
list: async (taskId, params) => {
|
|
2647
|
+
const searchParams = new URLSearchParams();
|
|
2648
|
+
if (params?.action)
|
|
2649
|
+
searchParams.set("action", params.action);
|
|
2650
|
+
if (params?.limit)
|
|
2651
|
+
searchParams.set("limit", String(params.limit));
|
|
2652
|
+
if (params?.offset)
|
|
2653
|
+
searchParams.set("offset", String(params.offset));
|
|
2654
|
+
const qs = searchParams.toString();
|
|
2655
|
+
const response = await this.makeRequest(
|
|
2656
|
+
`/api/tasks/${taskId}/work-items${qs ? `?${qs}` : ""}`
|
|
2657
|
+
);
|
|
2658
|
+
return response.data;
|
|
2659
|
+
}
|
|
2613
2660
|
}
|
|
2614
2661
|
};
|
|
2615
2662
|
this.menu = {
|
|
@@ -3824,6 +3871,97 @@ var WorkspaceClient = class {
|
|
|
3824
3871
|
}
|
|
3825
3872
|
};
|
|
3826
3873
|
|
|
3874
|
+
// src/export-import.ts
|
|
3875
|
+
var ExportImportClient = class {
|
|
3876
|
+
constructor(config) {
|
|
3877
|
+
this.baseURL = config.baseURL;
|
|
3878
|
+
this.headers = {
|
|
3879
|
+
"Content-Type": "application/json",
|
|
3880
|
+
Authorization: `Bearer ${config.apiKey}`,
|
|
3881
|
+
...config.headers
|
|
3882
|
+
};
|
|
3883
|
+
}
|
|
3884
|
+
async request(url, options = {}) {
|
|
3885
|
+
const fullUrl = `${this.baseURL}${url}`;
|
|
3886
|
+
const response = await fetch(fullUrl, {
|
|
3887
|
+
...options,
|
|
3888
|
+
headers: {
|
|
3889
|
+
...this.headers,
|
|
3890
|
+
...options.headers
|
|
3891
|
+
}
|
|
3892
|
+
});
|
|
3893
|
+
if (!response.ok) {
|
|
3894
|
+
const err = await response.json().catch(() => ({}));
|
|
3895
|
+
throw new Error(
|
|
3896
|
+
err.message || `HTTP error! Status: ${response.status}`
|
|
3897
|
+
);
|
|
3898
|
+
}
|
|
3899
|
+
return response.json();
|
|
3900
|
+
}
|
|
3901
|
+
async getExportableTypes() {
|
|
3902
|
+
const response = await this.request(
|
|
3903
|
+
"/api/tenants/exportable-types"
|
|
3904
|
+
);
|
|
3905
|
+
return response.data || [];
|
|
3906
|
+
}
|
|
3907
|
+
async exportConfig(tenantId, entityTypes) {
|
|
3908
|
+
const response = await this.request(
|
|
3909
|
+
`/api/tenants/${tenantId}/export`,
|
|
3910
|
+
{
|
|
3911
|
+
method: "POST",
|
|
3912
|
+
body: JSON.stringify({ entityTypes })
|
|
3913
|
+
}
|
|
3914
|
+
);
|
|
3915
|
+
return response.data;
|
|
3916
|
+
}
|
|
3917
|
+
async exportConfigConfirm(tenantId, entityTypes) {
|
|
3918
|
+
const response = await this.request(
|
|
3919
|
+
`/api/tenants/${tenantId}/export/confirm`,
|
|
3920
|
+
{
|
|
3921
|
+
method: "POST",
|
|
3922
|
+
body: JSON.stringify({ entityTypes })
|
|
3923
|
+
}
|
|
3924
|
+
);
|
|
3925
|
+
return response.data;
|
|
3926
|
+
}
|
|
3927
|
+
getExportDownloadUrl(tenantId, jobId) {
|
|
3928
|
+
return `${this.baseURL}/api/tenants/${tenantId}/export/${jobId}/download`;
|
|
3929
|
+
}
|
|
3930
|
+
async importPreview(tenantId, file) {
|
|
3931
|
+
const formData = new FormData();
|
|
3932
|
+
formData.append("file", file);
|
|
3933
|
+
const fullUrl = `${this.baseURL}/api/tenants/${tenantId}/import/preview`;
|
|
3934
|
+
const headers = { ...this.headers };
|
|
3935
|
+
delete headers["Content-Type"];
|
|
3936
|
+
const response = await fetch(fullUrl, {
|
|
3937
|
+
method: "POST",
|
|
3938
|
+
headers,
|
|
3939
|
+
body: formData
|
|
3940
|
+
});
|
|
3941
|
+
if (!response.ok) {
|
|
3942
|
+
const err = await response.json().catch(() => ({}));
|
|
3943
|
+
throw new Error(
|
|
3944
|
+
err.message || `HTTP error! Status: ${response.status}`
|
|
3945
|
+
);
|
|
3946
|
+
}
|
|
3947
|
+
const json = await response.json();
|
|
3948
|
+
if (!json.success || !json.data) {
|
|
3949
|
+
throw new Error(json.error || "Import preview failed");
|
|
3950
|
+
}
|
|
3951
|
+
return json.data;
|
|
3952
|
+
}
|
|
3953
|
+
async importApply(tenantId, bundle, resolutions) {
|
|
3954
|
+
const response = await this.request(
|
|
3955
|
+
`/api/tenants/${tenantId}/import/apply`,
|
|
3956
|
+
{
|
|
3957
|
+
method: "POST",
|
|
3958
|
+
body: JSON.stringify({ bundle, resolutions })
|
|
3959
|
+
}
|
|
3960
|
+
);
|
|
3961
|
+
return response.data;
|
|
3962
|
+
}
|
|
3963
|
+
};
|
|
3964
|
+
|
|
3827
3965
|
// src/ChunkMessageMerger.ts
|
|
3828
3966
|
var import_best_effort_json_parser = require("best-effort-json-parser");
|
|
3829
3967
|
function createSimpleMessageMerger() {
|
|
@@ -4023,6 +4161,7 @@ function createSimpleMessageMerger() {
|
|
|
4023
4161
|
AuthenticationError,
|
|
4024
4162
|
Client,
|
|
4025
4163
|
EvalClient,
|
|
4164
|
+
ExportImportClient,
|
|
4026
4165
|
NetworkError,
|
|
4027
4166
|
ResourcesClient,
|
|
4028
4167
|
ScheduleExecutionType,
|