Rename .js to .mjs, extract helpers module
Move resolvePath and exec out of index.mjs into server/helpers.mjs so actions can import them directly rather than receiving them as arguments. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
22
client/conduit.mjs
Normal file
22
client/conduit.mjs
Normal file
@@ -0,0 +1,22 @@
|
||||
// Conduit client module — import this when using conduit programmatically.
|
||||
// Designed for use by Claude or other tools that want to call conduit actions.
|
||||
|
||||
const BASE_URL = process.env.CONDUIT_URL || "http://localhost:3015";
|
||||
|
||||
export async function callAction(action, params = {}) {
|
||||
const res = await fetch(`${BASE_URL}/action`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ action, ...params }),
|
||||
});
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export async function listActions() {
|
||||
return callAction("list-actions");
|
||||
}
|
||||
|
||||
export async function getQueue() {
|
||||
const res = await fetch(`${BASE_URL}/queue`);
|
||||
return res.json();
|
||||
}
|
||||
Reference in New Issue
Block a user