@axiom-lattice/client-sdk 7.1.0 → 7.2.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__/mcpAppShareRuntimeClient.test.d.ts +2 -0
- package/dist/__tests__/mcpAppShareRuntimeClient.test.d.ts.map +1 -0
- package/dist/__tests__/mcpAppShareRuntimeClient.test.js +39 -0
- package/dist/__tests__/mcpAppShareRuntimeClient.test.js.map +1 -0
- package/dist/index.d.ts +50 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -0
- package/dist/index.mjs.map +1 -1
- package/dist/mcpAppShareRuntimeClient.d.ts +48 -0
- package/dist/mcpAppShareRuntimeClient.d.ts.map +1 -0
- package/dist/mcpAppShareRuntimeClient.js +55 -0
- package/dist/mcpAppShareRuntimeClient.js.map +1 -0
- package/dist/resources-client.d.ts +2 -2
- package/dist/resources-client.d.ts.map +1 -1
- package/dist/resources-client.js.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -5996,12 +5996,57 @@ function createSimpleMessageMerger() {
|
|
|
5996
5996
|
reset
|
|
5997
5997
|
};
|
|
5998
5998
|
}
|
|
5999
|
+
|
|
6000
|
+
// src/mcpAppShareRuntimeClient.ts
|
|
6001
|
+
var McpAppShareRuntimeClient = class {
|
|
6002
|
+
constructor(options) {
|
|
6003
|
+
this.baseURL = options.baseURL.replace(/\/$/, "");
|
|
6004
|
+
this.token = options.token;
|
|
6005
|
+
this.config = { baseURL: this.baseURL };
|
|
6006
|
+
this.mcpApps = {
|
|
6007
|
+
getResource: (ref) => this.request("resource", { ref }),
|
|
6008
|
+
rpc: (ref, method, params) => this.request("rpc", { ref, method, params })
|
|
6009
|
+
};
|
|
6010
|
+
}
|
|
6011
|
+
/** Load the app identity and a fresh first tool result. */
|
|
6012
|
+
async bootstrap() {
|
|
6013
|
+
return this.get("bootstrap");
|
|
6014
|
+
}
|
|
6015
|
+
/** Exchange the share password for the unlock cookie. */
|
|
6016
|
+
async unlock(password) {
|
|
6017
|
+
await this.request("unlock", { password });
|
|
6018
|
+
}
|
|
6019
|
+
async get(path) {
|
|
6020
|
+
const response = await fetch(`${this.baseURL}/api/mcp-app-shares/${this.token}/${path}`, {
|
|
6021
|
+
credentials: "include"
|
|
6022
|
+
});
|
|
6023
|
+
return this.parse(response);
|
|
6024
|
+
}
|
|
6025
|
+
async request(path, body) {
|
|
6026
|
+
const response = await fetch(`${this.baseURL}/api/mcp-app-shares/${this.token}/${path}`, {
|
|
6027
|
+
method: "POST",
|
|
6028
|
+
credentials: "include",
|
|
6029
|
+
headers: { "content-type": "application/json" },
|
|
6030
|
+
body: JSON.stringify(body)
|
|
6031
|
+
});
|
|
6032
|
+
return this.parse(response);
|
|
6033
|
+
}
|
|
6034
|
+
async parse(response) {
|
|
6035
|
+
const body = await response.json().catch(() => ({}));
|
|
6036
|
+
if (!response.ok) {
|
|
6037
|
+
const code = typeof body === "object" && body !== null && "error" in body ? String(body.error) : `HTTP_${response.status}`;
|
|
6038
|
+
throw new Error(code);
|
|
6039
|
+
}
|
|
6040
|
+
return body;
|
|
6041
|
+
}
|
|
6042
|
+
};
|
|
5999
6043
|
export {
|
|
6000
6044
|
AbstractClient,
|
|
6001
6045
|
ApiError,
|
|
6002
6046
|
AuthenticationError,
|
|
6003
6047
|
Client,
|
|
6004
6048
|
ExportImportClient,
|
|
6049
|
+
McpAppShareRuntimeClient,
|
|
6005
6050
|
NetworkError,
|
|
6006
6051
|
ProjectRoomClientError,
|
|
6007
6052
|
ProjectRoomsClient,
|