engine7 7.1.62 → 7.1.64
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/cli.mjs +32 -14
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -19731,7 +19731,10 @@ function parseCcRunArgs(argv) {
|
|
|
19731
19731
|
return v;
|
|
19732
19732
|
};
|
|
19733
19733
|
if (a === "-p" || a === "--print") {
|
|
19734
|
-
|
|
19734
|
+
const next = argv[i + 1];
|
|
19735
|
+
if (next !== void 0 && !next.startsWith("-")) {
|
|
19736
|
+
args.prompt = takeValue();
|
|
19737
|
+
}
|
|
19735
19738
|
hasPrompt = true;
|
|
19736
19739
|
} else if (a === "--output-format") {
|
|
19737
19740
|
const v = takeValue();
|
|
@@ -19802,12 +19805,12 @@ function startStdinHandler() {
|
|
|
19802
19805
|
`);
|
|
19803
19806
|
return;
|
|
19804
19807
|
}
|
|
19805
|
-
if (msg2.type === "user") {
|
|
19808
|
+
if (msg2.type === "user" || msg2.type === void 0 && msg2.message?.content !== void 0) {
|
|
19806
19809
|
const content = msg2.message?.content;
|
|
19807
19810
|
let text = "";
|
|
19808
19811
|
if (typeof content === "string") text = content;
|
|
19809
19812
|
else if (Array.isArray(content)) {
|
|
19810
|
-
text = content.filter((b) => b?.type === "text").map((b) => b.text).join("\n");
|
|
19813
|
+
text = content.filter((b) => b?.type === "text" || typeof b?.text === "string").map((b) => b.text).join("\n");
|
|
19811
19814
|
}
|
|
19812
19815
|
if (text) {
|
|
19813
19816
|
userTexts.push(text);
|
|
@@ -20059,17 +20062,6 @@ async function doCcRun(argv) {
|
|
|
20059
20062
|
}
|
|
20060
20063
|
}
|
|
20061
20064
|
installStdoutGuard();
|
|
20062
|
-
if (args.inputFormat === "stream-json" && !process.stdin.isTTY) {
|
|
20063
|
-
const stdinPromise = startStdinHandler();
|
|
20064
|
-
if (!args.prompt) {
|
|
20065
|
-
const stdinPrompt = await stdinPromise;
|
|
20066
|
-
if (stdinPrompt) args.prompt = stdinPrompt;
|
|
20067
|
-
}
|
|
20068
|
-
}
|
|
20069
|
-
if (!args.prompt) {
|
|
20070
|
-
process.stderr.write("cc-run: \u6CA1\u6536\u5230 prompt\uFF08-p \u6216 stdin user message \u5747\u4E3A\u7A7A\uFF09\n");
|
|
20071
|
-
return 1;
|
|
20072
|
-
}
|
|
20073
20065
|
const sessionId = args.sessionId || randomUUID9();
|
|
20074
20066
|
args.sessionId = sessionId;
|
|
20075
20067
|
let model = "";
|
|
@@ -20096,6 +20088,17 @@ async function doCcRun(argv) {
|
|
|
20096
20088
|
}
|
|
20097
20089
|
emitInit(sessionId, model);
|
|
20098
20090
|
}
|
|
20091
|
+
if (args.inputFormat === "stream-json" && !process.stdin.isTTY) {
|
|
20092
|
+
const stdinPromise = startStdinHandler();
|
|
20093
|
+
if (!args.prompt) {
|
|
20094
|
+
const stdinPrompt = await stdinPromise;
|
|
20095
|
+
if (stdinPrompt) args.prompt = stdinPrompt;
|
|
20096
|
+
}
|
|
20097
|
+
}
|
|
20098
|
+
if (!args.prompt) {
|
|
20099
|
+
process.stderr.write("cc-run: \u6CA1\u6536\u5230 prompt\uFF08-p \u6216 stdin user message \u5747\u4E3A\u7A7A\uFF09\n");
|
|
20100
|
+
return 1;
|
|
20101
|
+
}
|
|
20099
20102
|
let result;
|
|
20100
20103
|
try {
|
|
20101
20104
|
result = await runQuery(args);
|
|
@@ -21484,6 +21487,21 @@ function execute(entries2) {
|
|
|
21484
21487
|
async function main() {
|
|
21485
21488
|
const args = process.argv.slice(2);
|
|
21486
21489
|
const subcommand = args[0];
|
|
21490
|
+
const CC_FLAGS = /* @__PURE__ */ new Set([
|
|
21491
|
+
"-p",
|
|
21492
|
+
"--print",
|
|
21493
|
+
"--output-format",
|
|
21494
|
+
"--input-format",
|
|
21495
|
+
"--permission-mode",
|
|
21496
|
+
"--disallowedTools",
|
|
21497
|
+
"--list-models",
|
|
21498
|
+
"--resume"
|
|
21499
|
+
]);
|
|
21500
|
+
if (subcommand !== void 0 && CC_FLAGS.has(subcommand)) {
|
|
21501
|
+
const { doCcRun: doCcRun2 } = await Promise.resolve().then(() => (init_cli_ccrun(), cli_ccrun_exports));
|
|
21502
|
+
const code = await doCcRun2(args);
|
|
21503
|
+
process.exit(code);
|
|
21504
|
+
}
|
|
21487
21505
|
if (!subcommand) {
|
|
21488
21506
|
printHelp();
|
|
21489
21507
|
process.exit(0);
|