Fix ccc-queue triggering client main() on import

Move resolve_queue_item into conduit.mjs factory and have ccc-queue
import from there instead of index.mjs, which auto-executes main().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-07 21:12:05 +00:00
parent ca7ae930cc
commit 507eb7584d
3 changed files with 15 additions and 21 deletions

View File

@@ -9,7 +9,7 @@ import { load_client_config, get_remaining } from './config.mjs';
const BASE_URL = process.env.CONDUIT_URL || 'http://localhost:3015';
export async function call_action(payload, username, secret) {
async function call_action(payload, username, secret) {
const body_string = JSON.stringify(payload);
const res = await fetch(`${BASE_URL}/action`, {
method: 'POST',
@@ -20,21 +20,6 @@ export async function call_action(payload, username, secret) {
return { status: res.status, body };
}
export async function get_queue(username, secret) {
const res = await fetch(`${BASE_URL}/queue`, {
headers: sign_request(secret, username, ''),
});
return res.json();
}
export async function resolve_queue_item(id, decision, username, secret) {
const res = await fetch(`${BASE_URL}/queue/${id}/${decision}`, {
method: 'POST',
headers: sign_request(secret, username, ''),
});
return res.json();
}
async function main() {
const { username, secret } = load_client_config(process.argv);
const remaining = get_remaining(process.argv);