@shipers-dev/multi 0.43.0 → 0.44.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/index.js +84 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36934,6 +36934,63 @@ var init_chat_supervisor = __esm(() => {
|
|
|
36934
36934
|
init_lib();
|
|
36935
36935
|
});
|
|
36936
36936
|
|
|
36937
|
+
// src/_impl/supervisor-tick.ts
|
|
36938
|
+
var exports_supervisor_tick = {};
|
|
36939
|
+
__export(exports_supervisor_tick, {
|
|
36940
|
+
runSupervisorTick: () => runSupervisorTick
|
|
36941
|
+
});
|
|
36942
|
+
async function runSupervisorTick(opts) {
|
|
36943
|
+
const { apiUrl, tickId, system, user, callbackUrl, callbackToken, log: log4 } = opts;
|
|
36944
|
+
let collected = "";
|
|
36945
|
+
await new Promise((resolve2) => {
|
|
36946
|
+
handleChatTurn({
|
|
36947
|
+
chatId: `sup-${tickId}`,
|
|
36948
|
+
prompt: user + `
|
|
36949
|
+
|
|
36950
|
+
Respond with ONLY a JSON object matching the schema. No prose, no fences.`,
|
|
36951
|
+
systemPreamble: system,
|
|
36952
|
+
preferredRuntime: "claude-code",
|
|
36953
|
+
log: log4,
|
|
36954
|
+
onChunk: (text) => {
|
|
36955
|
+
collected += text;
|
|
36956
|
+
},
|
|
36957
|
+
onDone: () => resolve2()
|
|
36958
|
+
});
|
|
36959
|
+
});
|
|
36960
|
+
let reflection = undefined;
|
|
36961
|
+
let error48;
|
|
36962
|
+
try {
|
|
36963
|
+
const start3 = collected.indexOf("{");
|
|
36964
|
+
const end3 = collected.lastIndexOf("}");
|
|
36965
|
+
if (start3 < 0 || end3 <= start3)
|
|
36966
|
+
throw new Error("no JSON object in agent reply");
|
|
36967
|
+
reflection = JSON.parse(collected.slice(start3, end3 + 1));
|
|
36968
|
+
} catch (e) {
|
|
36969
|
+
error48 = String(e?.message || e);
|
|
36970
|
+
log4(`[sup ${tickId}] parse failed: ${error48}`);
|
|
36971
|
+
}
|
|
36972
|
+
try {
|
|
36973
|
+
const r = await fetch(callbackUrl, {
|
|
36974
|
+
method: "POST",
|
|
36975
|
+
headers: { "content-type": "application/json" },
|
|
36976
|
+
body: JSON.stringify({
|
|
36977
|
+
tick_id: tickId,
|
|
36978
|
+
callback_token: callbackToken,
|
|
36979
|
+
reflection,
|
|
36980
|
+
error: error48
|
|
36981
|
+
})
|
|
36982
|
+
});
|
|
36983
|
+
if (!r.ok) {
|
|
36984
|
+
log4(`[sup ${tickId}] callback failed: HTTP ${r.status}`);
|
|
36985
|
+
}
|
|
36986
|
+
} catch (e) {
|
|
36987
|
+
log4(`[sup ${tickId}] callback error: ${e.message}`);
|
|
36988
|
+
}
|
|
36989
|
+
}
|
|
36990
|
+
var init_supervisor_tick = __esm(() => {
|
|
36991
|
+
init_chat_turn();
|
|
36992
|
+
});
|
|
36993
|
+
|
|
36937
36994
|
// ../../node_modules/effect/dist/esm/index.js
|
|
36938
36995
|
init_Cause();
|
|
36939
36996
|
init_Effect();
|
|
@@ -37496,7 +37553,7 @@ import { parseArgs } from "util";
|
|
|
37496
37553
|
// package.json
|
|
37497
37554
|
var package_default = {
|
|
37498
37555
|
name: "@shipers-dev/multi",
|
|
37499
|
-
version: "0.
|
|
37556
|
+
version: "0.44.0",
|
|
37500
37557
|
type: "module",
|
|
37501
37558
|
bin: {
|
|
37502
37559
|
"multi-agent": "./dist/index.js"
|
|
@@ -38955,6 +39012,32 @@ var daemonProgram = ({ cfg, apiUrl }) => exports_Effect.gen(function* () {
|
|
|
38955
39012
|
}
|
|
38956
39013
|
})();
|
|
38957
39014
|
}
|
|
39015
|
+
if (url2.pathname === "/run-supervisor-tick" && req.method === "POST") {
|
|
39016
|
+
if (req.headers.get("authorization") !== expectedAuth)
|
|
39017
|
+
return new Response("unauthorized", { status: 401 });
|
|
39018
|
+
return (async () => {
|
|
39019
|
+
try {
|
|
39020
|
+
const body = await req.json();
|
|
39021
|
+
if (!body?.tick_id || !body?.callback_url || !body?.callback_token) {
|
|
39022
|
+
return Response.json({ error: "tick_id, callback_url, callback_token required" }, { status: 400 });
|
|
39023
|
+
}
|
|
39024
|
+
const { runSupervisorTick: runSupervisorTick2 } = await Promise.resolve().then(() => (init_supervisor_tick(), exports_supervisor_tick));
|
|
39025
|
+
runSupervisorTick2({
|
|
39026
|
+
apiUrl,
|
|
39027
|
+
tickId: body.tick_id,
|
|
39028
|
+
projectId: body.project_id,
|
|
39029
|
+
system: body.system,
|
|
39030
|
+
user: body.user,
|
|
39031
|
+
callbackUrl: body.callback_url,
|
|
39032
|
+
callbackToken: body.callback_token,
|
|
39033
|
+
log: log3
|
|
39034
|
+
}).catch((e) => log3(`[sup ${body.tick_id}] runSupervisorTick error: ${e.message}`));
|
|
39035
|
+
return Response.json({ accepted: true }, { status: 202 });
|
|
39036
|
+
} catch (e) {
|
|
39037
|
+
return Response.json({ error: String(e) }, { status: 400 });
|
|
39038
|
+
}
|
|
39039
|
+
})();
|
|
39040
|
+
}
|
|
38958
39041
|
if (url2.pathname === "/stop" && req.method === "POST") {
|
|
38959
39042
|
if (req.headers.get("authorization") !== expectedAuth)
|
|
38960
39043
|
return new Response("unauthorized", { status: 401 });
|