workermill 0.3.2 → 0.3.3
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
CHANGED
|
@@ -743,7 +743,8 @@ function useAgent(options) {
|
|
|
743
743
|
setTrustAll,
|
|
744
744
|
setPlanMode,
|
|
745
745
|
addSystemMessage,
|
|
746
|
-
addUserMessage
|
|
746
|
+
addUserMessage,
|
|
747
|
+
setCost
|
|
747
748
|
};
|
|
748
749
|
}
|
|
749
750
|
|
|
@@ -797,7 +798,7 @@ var PERSONA_EMOJIS = {
|
|
|
797
798
|
function getEmoji(persona) {
|
|
798
799
|
return PERSONA_EMOJIS[persona] || "\u{1F916}";
|
|
799
800
|
}
|
|
800
|
-
function useOrchestrator(addMessage2) {
|
|
801
|
+
function useOrchestrator(addMessage2, setCost) {
|
|
801
802
|
const [running, setRunning] = useState2(false);
|
|
802
803
|
const [statusMessage, setStatusMessage] = useState2("");
|
|
803
804
|
const [confirmRequest, setConfirmRequest] = useState2(null);
|
|
@@ -816,7 +817,7 @@ function useOrchestrator(addMessage2) {
|
|
|
816
817
|
setRunning(false);
|
|
817
818
|
return;
|
|
818
819
|
}
|
|
819
|
-
const { classifyComplexity, runOrchestration } = await import("./orchestrator-
|
|
820
|
+
const { classifyComplexity, runOrchestration } = await import("./orchestrator-VRGIOUHT.js");
|
|
820
821
|
const output = {
|
|
821
822
|
log(persona, message) {
|
|
822
823
|
const emoji = getEmoji(persona);
|
|
@@ -880,6 +881,9 @@ function useOrchestrator(addMessage2) {
|
|
|
880
881
|
addMessage2(
|
|
881
882
|
`[${emoji} ${persona}] \u2193 ${toolName}${detail ? " " + detail : ""}`
|
|
882
883
|
);
|
|
884
|
+
},
|
|
885
|
+
updateCost(cost) {
|
|
886
|
+
setCost?.(cost);
|
|
883
887
|
}
|
|
884
888
|
};
|
|
885
889
|
addMessage2("Analyzing task complexity\u2026");
|
|
@@ -1368,11 +1372,6 @@ function PermissionPrompt({ request }) {
|
|
|
1368
1372
|
init_esm_shims();
|
|
1369
1373
|
import { Box as Box4, Text as Text4, useStdout } from "ink";
|
|
1370
1374
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1371
|
-
function formatTokens(n) {
|
|
1372
|
-
if (n >= 1e6) return `${(n / 1e6).toFixed(1)}M`;
|
|
1373
|
-
if (n >= 1e3) return `${(n / 1e3).toFixed(1)}k`;
|
|
1374
|
-
return String(n);
|
|
1375
|
-
}
|
|
1376
1375
|
function formatCost(c) {
|
|
1377
1376
|
if (c < 0.01) return "$0.00";
|
|
1378
1377
|
return `$${c.toFixed(2)}`;
|
|
@@ -1399,7 +1398,8 @@ function StatusBar(props) {
|
|
|
1399
1398
|
}
|
|
1400
1399
|
const bgColor = theme.subtleDark;
|
|
1401
1400
|
const modelStr = ` ${props.provider}/${props.model} `;
|
|
1402
|
-
const
|
|
1401
|
+
const pct = props.maxContext > 0 ? Math.round(usage * 100) : 0;
|
|
1402
|
+
const tokenStr = ` ${pct}% `;
|
|
1403
1403
|
const costStr = formatCost(props.cost);
|
|
1404
1404
|
const branchStr = props.gitBranch ? ` git:(${props.gitBranch})` : "";
|
|
1405
1405
|
const cwdStr = props.cwd ? ` ${props.cwd}` : "";
|
|
@@ -1679,7 +1679,7 @@ function Root(props) {
|
|
|
1679
1679
|
},
|
|
1680
1680
|
[agent]
|
|
1681
1681
|
);
|
|
1682
|
-
const orchestrator = useOrchestrator(addOrchestratorMessage);
|
|
1682
|
+
const orchestrator = useOrchestrator(addOrchestratorMessage, agent.setCost);
|
|
1683
1683
|
const buildStarted = useRef3(false);
|
|
1684
1684
|
useEffect2(() => {
|
|
1685
1685
|
if (props.initialBuildTask && !buildStarted.current) {
|
|
@@ -1997,7 +1997,7 @@ function printWelcome(provider, model, workingDir) {
|
|
|
1997
1997
|
console.log(dim(" Type ") + white("/help") + dim(" for all commands."));
|
|
1998
1998
|
console.log();
|
|
1999
1999
|
}
|
|
2000
|
-
var VERSION = "0.3.
|
|
2000
|
+
var VERSION = "0.3.3";
|
|
2001
2001
|
function addSharedOptions(cmd) {
|
|
2002
2002
|
return cmd.option("--provider <provider>", "Override default provider").option("--model <model>", "Override model").option("--trust", "Skip all tool permission prompts").option("--full-disk", "Allow tools to access files outside working directory");
|
|
2003
2003
|
}
|
|
@@ -401,6 +401,7 @@ Available personas: backend_developer, frontend_developer, devops_engineer, qa_e
|
|
|
401
401
|
if (finalText && finalText.length > planText.length) {
|
|
402
402
|
planText = finalText;
|
|
403
403
|
}
|
|
404
|
+
const planUsage = await planStream.totalUsage;
|
|
404
405
|
let stories = parseStoriesFromText(planText, output);
|
|
405
406
|
if (stories.length === 0) {
|
|
406
407
|
output.log("system", "Planner didn't produce structured stories, falling back to single story");
|
|
@@ -411,7 +412,13 @@ Available personas: backend_developer, frontend_developer, devops_engineer, qa_e
|
|
|
411
412
|
description: userTask
|
|
412
413
|
}];
|
|
413
414
|
}
|
|
414
|
-
return
|
|
415
|
+
return {
|
|
416
|
+
stories,
|
|
417
|
+
provider: pProvider,
|
|
418
|
+
model: pModel,
|
|
419
|
+
inputTokens: planUsage?.inputTokens || 0,
|
|
420
|
+
outputTokens: planUsage?.outputTokens || 0
|
|
421
|
+
};
|
|
415
422
|
}
|
|
416
423
|
function parseStoriesFromText(text, output) {
|
|
417
424
|
const codeBlocks = [...text.matchAll(/```(?:json)?\s*\n?([\s\S]*?)```/g)];
|
|
@@ -542,7 +549,10 @@ async function runOrchestration(config, userTask, trustAll, sandboxed, output) {
|
|
|
542
549
|
};
|
|
543
550
|
const sessionAllow = /* @__PURE__ */ new Set();
|
|
544
551
|
const workingDir = process.cwd();
|
|
545
|
-
const
|
|
552
|
+
const planResult = await planStories(config, userTask, workingDir, sandboxed, output);
|
|
553
|
+
const plannerStories = planResult.stories;
|
|
554
|
+
costTracker.addUsage("Planner", planResult.provider, planResult.model, planResult.inputTokens, planResult.outputTokens);
|
|
555
|
+
output.updateCost?.(costTracker.getTotalCost());
|
|
546
556
|
output.log("planner", `Plan generated: ${plannerStories.length} stories`);
|
|
547
557
|
plannerStories.forEach((s, i) => {
|
|
548
558
|
output.log("planner", `Step ${i + 1}: [${s.persona}] ${s.title}${s.dependsOn?.length ? ` (after: ${s.dependsOn.join(", ")})` : ""}`);
|
|
@@ -753,6 +763,7 @@ ${revisionFeedback}` : ""}`;
|
|
|
753
763
|
const inTokens = usage?.inputTokens || 0;
|
|
754
764
|
const outTokens = usage?.outputTokens || 0;
|
|
755
765
|
costTracker.addUsage(persona.name, provider, modelName, inTokens, outTokens);
|
|
766
|
+
output.updateCost?.(costTracker.getTotalCost());
|
|
756
767
|
output.log(story.persona, `${story.title} \u2014 completed! (${i + 1}/${sorted.length})`);
|
|
757
768
|
output.log("system", "");
|
|
758
769
|
break;
|
|
@@ -804,7 +815,7 @@ ${revisionFeedback}` : ""}`;
|
|
|
804
815
|
for (let reviewRound = 0; reviewRound <= maxRevisions; reviewRound++) {
|
|
805
816
|
const isRevision = reviewRound > 0;
|
|
806
817
|
output.coordinatorLog(isRevision ? `Starting Tech Lead review (revision ${reviewRound}/${maxRevisions})...` : "Starting Tech Lead review...");
|
|
807
|
-
output.log("tech_lead",
|
|
818
|
+
output.log("tech_lead", `Starting agent execution (model: ${revModel})`);
|
|
808
819
|
output.status(isRevision ? "Reviewer -- Re-checking after revisions" : "Reviewer -- Checking code quality");
|
|
809
820
|
try {
|
|
810
821
|
const previousFeedbackSection = isRevision && previousReviewFeedback ? `## Previous Review Feedback (Review ${reviewRound}/${maxRevisions})
|
|
@@ -908,6 +919,7 @@ AFFECTED_REASONS: {"2": "Missing error handling in auth controller", "3": "Front
|
|
|
908
919
|
reviewUsage?.inputTokens || 0,
|
|
909
920
|
reviewUsage?.outputTokens || 0
|
|
910
921
|
);
|
|
922
|
+
output.updateCost?.(costTracker.getTotalCost());
|
|
911
923
|
if (approved) break;
|
|
912
924
|
if (reviewRound >= maxRevisions) {
|
|
913
925
|
output.log("system", `Max review revisions (${maxRevisions}) reached`);
|
|
@@ -965,7 +977,7 @@ AFFECTED_REASONS: {"2": "Missing error handling in auth controller", "3": "Front
|
|
|
965
977
|
}
|
|
966
978
|
}
|
|
967
979
|
output.coordinatorLog(`Revision pass for story ${i + 1}/${sorted.length}`);
|
|
968
|
-
output.log(story.persona, `Starting revision: ${story.title}`);
|
|
980
|
+
output.log(story.persona, `Starting revision: ${story.title} (model: ${sModel})`);
|
|
969
981
|
output.status("");
|
|
970
982
|
const storyModel = createModel(sProvider, sModel, sHost, sCtx);
|
|
971
983
|
const storyAllTools = createToolDefinitions(workingDir, storyModel, sandboxed);
|
|
@@ -1038,6 +1050,7 @@ ${story.description}`,
|
|
|
1038
1050
|
revUsage?.inputTokens || 0,
|
|
1039
1051
|
revUsage?.outputTokens || 0
|
|
1040
1052
|
);
|
|
1053
|
+
output.updateCost?.(costTracker.getTotalCost());
|
|
1041
1054
|
output.log(story.persona, `${story.title} \u2014 revision complete!`);
|
|
1042
1055
|
} catch (err) {
|
|
1043
1056
|
output.statusDone();
|