forgecraft 1.3.0 → 1.3.2
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.
|
@@ -432,6 +432,10 @@ var Orchestrator = class {
|
|
|
432
432
|
${frameworkHint}
|
|
433
433
|
Design support: ${adapter.designSupport ? "yes (Storybook)" : "no"}
|
|
434
434
|
|
|
435
|
+
IMPORTANT: If the user references any files (like .md, .txt, .pdf, or any document),
|
|
436
|
+
READ those files first to understand the full requirements before planning.
|
|
437
|
+
Also read any existing project files (package.json, requirements.txt, etc.) to understand the current state.
|
|
438
|
+
|
|
435
439
|
Break this down into epics and stories. Each story should be:
|
|
436
440
|
- Small enough to build in one agent session
|
|
437
441
|
- Independently testable
|
|
@@ -467,7 +471,7 @@ var Orchestrator = class {
|
|
|
467
471
|
|
|
468
472
|
No explanation, just the JSON.
|
|
469
473
|
`;
|
|
470
|
-
const resultText = await this.runQuery(prompt, { maxTurns:
|
|
474
|
+
const resultText = await this.runQuery(prompt, { maxTurns: 10 });
|
|
471
475
|
let rawPlan;
|
|
472
476
|
try {
|
|
473
477
|
rawPlan = JSON.parse(this.cleanJson(resultText));
|
|
@@ -695,31 +699,58 @@ ${context.existingFiles.map((f) => ` - ${f}`).join("\n")}` : "";
|
|
|
695
699
|
}
|
|
696
700
|
async executeQuery(prompt, opts = {}) {
|
|
697
701
|
let resultText = "";
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
})) {
|
|
707
|
-
if (msg.type === "result") {
|
|
708
|
-
if ("result" in msg && typeof msg.result === "string") {
|
|
709
|
-
resultText = msg.result;
|
|
710
|
-
} else if ("errors" in msg && Array.isArray(msg.errors)) {
|
|
711
|
-
throw new Error(`Agent error: ${msg.errors.join(", ")}`);
|
|
702
|
+
try {
|
|
703
|
+
for await (const msg of query({
|
|
704
|
+
prompt,
|
|
705
|
+
options: {
|
|
706
|
+
model: this.config.model,
|
|
707
|
+
systemPrompt: ORCHESTRATOR_SYSTEM_PROMPT,
|
|
708
|
+
maxTurns: opts.maxTurns,
|
|
709
|
+
allowedTools: ["Read", "Glob", "Grep"]
|
|
712
710
|
}
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
711
|
+
})) {
|
|
712
|
+
if (msg.type === "result") {
|
|
713
|
+
const hasError = "is_error" in msg && msg.is_error;
|
|
714
|
+
const errors = "errors" in msg && Array.isArray(msg.errors) ? msg.errors : [];
|
|
715
|
+
const subtype = "subtype" in msg ? String(msg.subtype) : "";
|
|
716
|
+
if (hasError || errors.length > 0) {
|
|
717
|
+
const errorParts = [];
|
|
718
|
+
if (subtype) errorParts.push(subtype);
|
|
719
|
+
for (const e of errors) {
|
|
720
|
+
const eStr = typeof e === "string" ? e : JSON.stringify(e);
|
|
721
|
+
if (eStr && eStr.length > 0) errorParts.push(eStr);
|
|
722
|
+
}
|
|
723
|
+
const errorMsg = errorParts.length > 0 ? errorParts.join(" \u2014 ") : "Unknown error from Claude. Check your auth with: claude login";
|
|
724
|
+
throw new Error(errorMsg);
|
|
725
|
+
}
|
|
726
|
+
if ("result" in msg && typeof msg.result === "string") {
|
|
727
|
+
resultText = msg.result;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
if (msg.type === "assistant" && msg.message?.content) {
|
|
731
|
+
const textBlocks = msg.message.content.filter((b) => b.type === "text").map((b) => b.text);
|
|
732
|
+
if (textBlocks.length > 0) {
|
|
733
|
+
resultText = textBlocks.join("\n");
|
|
734
|
+
}
|
|
718
735
|
}
|
|
719
736
|
}
|
|
737
|
+
} catch (error) {
|
|
738
|
+
if (error instanceof Error && !error.message.includes("EPIPE") && !error.message.includes("ENOENT")) {
|
|
739
|
+
throw error;
|
|
740
|
+
}
|
|
741
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
742
|
+
throw new Error(
|
|
743
|
+
`Failed to communicate with Claude. ${msg}
|
|
744
|
+
Possible fixes:
|
|
745
|
+
1. Run: claude login
|
|
746
|
+
2. Check your internet connection
|
|
747
|
+
3. Run: forge doctor`
|
|
748
|
+
);
|
|
720
749
|
}
|
|
721
750
|
if (!resultText) {
|
|
722
|
-
throw new Error(
|
|
751
|
+
throw new Error(
|
|
752
|
+
"No response from Claude.\n Possible fixes:\n 1. Run: claude login\n 2. Check your internet connection\n 3. Run: forge doctor"
|
|
753
|
+
);
|
|
723
754
|
}
|
|
724
755
|
return resultText;
|
|
725
756
|
}
|
|
@@ -1072,11 +1103,19 @@ var Worker = class {
|
|
|
1072
1103
|
if ("result" in msg && typeof msg.result === "string") {
|
|
1073
1104
|
result.summary = msg.result;
|
|
1074
1105
|
}
|
|
1075
|
-
|
|
1076
|
-
|
|
1106
|
+
const hasError = "is_error" in msg && msg.is_error;
|
|
1107
|
+
const errors = "errors" in msg && Array.isArray(msg.errors) ? msg.errors : [];
|
|
1108
|
+
const subtype = "subtype" in msg ? String(msg.subtype || "") : "";
|
|
1109
|
+
if (errors.length > 0) {
|
|
1110
|
+
for (const e of errors) {
|
|
1111
|
+
const eStr = typeof e === "string" ? e : JSON.stringify(e);
|
|
1112
|
+
if (eStr && eStr.length > 0) result.errors.push(eStr);
|
|
1113
|
+
}
|
|
1077
1114
|
}
|
|
1078
|
-
if (
|
|
1079
|
-
result.errors.push(
|
|
1115
|
+
if (hasError && result.errors.length === 0) {
|
|
1116
|
+
result.errors.push(
|
|
1117
|
+
subtype || "Claude encountered an error. Run: claude login"
|
|
1118
|
+
);
|
|
1080
1119
|
}
|
|
1081
1120
|
if (msg.usage) {
|
|
1082
1121
|
result.usage.inputTokens = msg.usage.input_tokens || 0;
|
|
@@ -2276,9 +2315,13 @@ var AutoPipeline = class {
|
|
|
2276
2315
|
this.activeSpinner = null;
|
|
2277
2316
|
const msg = err instanceof Error ? err.message : String(err);
|
|
2278
2317
|
console.log(chalk4.red(`
|
|
2279
|
-
${msg}
|
|
2280
|
-
|
|
2281
|
-
|
|
2318
|
+
${msg}
|
|
2319
|
+
`));
|
|
2320
|
+
if (!msg.includes("Possible fixes")) {
|
|
2321
|
+
console.log(chalk4.dim(" Possible fixes:"));
|
|
2322
|
+
console.log(chalk4.dim(" 1. Run: claude login"));
|
|
2323
|
+
console.log(chalk4.dim(" 2. Check your internet connection"));
|
|
2324
|
+
console.log(chalk4.dim(" 3. Run: forge doctor\n"));
|
|
2282
2325
|
}
|
|
2283
2326
|
this.stopChatListener();
|
|
2284
2327
|
return { success: false, plan: null, errors: [`Plan: ${msg}`] };
|
|
@@ -3037,4 +3080,4 @@ export {
|
|
|
3037
3080
|
validateConfig,
|
|
3038
3081
|
loadAndValidateConfig
|
|
3039
3082
|
};
|
|
3040
|
-
//# sourceMappingURL=chunk-
|
|
3083
|
+
//# sourceMappingURL=chunk-ZZ3EDO3G.js.map
|