claude-yes 1.37.0 → 1.37.1
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.js +683 -756
- package/dist/index.js +603 -484
- package/package.json +4 -21
- package/ts/index.ts +77 -325
- package/ts/parseCliArgs.ts +1 -1
- package/ts/pidStore.ts +4 -0
package/dist/cli.js
CHANGED
|
@@ -10356,19 +10356,6 @@ class TerminalTextRender {
|
|
|
10356
10356
|
}
|
|
10357
10357
|
var init_dist5 = () => {};
|
|
10358
10358
|
|
|
10359
|
-
// ts/catcher.ts
|
|
10360
|
-
function catcher(catchFn, fn) {
|
|
10361
|
-
if (!fn)
|
|
10362
|
-
return (fn2) => catcher(catchFn, fn2);
|
|
10363
|
-
return (...args) => {
|
|
10364
|
-
try {
|
|
10365
|
-
return fn(...args);
|
|
10366
|
-
} catch (error) {
|
|
10367
|
-
return catchFn(error, fn, ...args);
|
|
10368
|
-
}
|
|
10369
|
-
};
|
|
10370
|
-
}
|
|
10371
|
-
|
|
10372
10359
|
// ts/resume/codexSessionManager.ts
|
|
10373
10360
|
import { mkdir, readdir, readFile, writeFile } from "fs/promises";
|
|
10374
10361
|
import { homedir } from "os";
|
|
@@ -10481,23 +10468,6 @@ function extractSessionId(output) {
|
|
|
10481
10468
|
var getSessionsFile = () => process.env.CLI_YES_TEST_HOME ? path7.join(process.env.CLI_YES_TEST_HOME, ".config", "agent-yes", "codex-sessions.json") : path7.join(homedir(), ".config", "agent-yes", "codex-sessions.json"), getCodexSessionsDir = () => process.env.CLI_YES_TEST_HOME ? path7.join(process.env.CLI_YES_TEST_HOME, ".codex", "sessions") : path7.join(homedir(), ".codex", "sessions");
|
|
10482
10469
|
var init_codexSessionManager = () => {};
|
|
10483
10470
|
|
|
10484
|
-
// ts/idleWaiter.ts
|
|
10485
|
-
class IdleWaiter {
|
|
10486
|
-
lastActivityTime = Date.now();
|
|
10487
|
-
checkInterval = 100;
|
|
10488
|
-
constructor() {
|
|
10489
|
-
this.ping();
|
|
10490
|
-
}
|
|
10491
|
-
ping() {
|
|
10492
|
-
this.lastActivityTime = Date.now();
|
|
10493
|
-
return this;
|
|
10494
|
-
}
|
|
10495
|
-
async wait(ms) {
|
|
10496
|
-
while (this.lastActivityTime >= Date.now() - ms)
|
|
10497
|
-
await new Promise((resolve) => setTimeout(resolve, this.checkInterval));
|
|
10498
|
-
}
|
|
10499
|
-
}
|
|
10500
|
-
|
|
10501
10471
|
// node_modules/logform/format.js
|
|
10502
10472
|
var require_format = __commonJS((exports, module) => {
|
|
10503
10473
|
class InvalidFormatError extends Error {
|
|
@@ -20393,26 +20363,6 @@ var init_pty = __esm(async () => {
|
|
|
20393
20363
|
pty_default = pty;
|
|
20394
20364
|
});
|
|
20395
20365
|
|
|
20396
|
-
// ts/ReadyManager.ts
|
|
20397
|
-
class ReadyManager {
|
|
20398
|
-
isReady = false;
|
|
20399
|
-
readyQueue = [];
|
|
20400
|
-
wait() {
|
|
20401
|
-
if (this.isReady)
|
|
20402
|
-
return;
|
|
20403
|
-
return new Promise((resolve) => this.readyQueue.push(resolve));
|
|
20404
|
-
}
|
|
20405
|
-
unready() {
|
|
20406
|
-
this.isReady = false;
|
|
20407
|
-
}
|
|
20408
|
-
ready() {
|
|
20409
|
-
this.isReady = true;
|
|
20410
|
-
if (!this.readyQueue.length)
|
|
20411
|
-
return;
|
|
20412
|
-
this.readyQueue.splice(0).map((resolve) => resolve());
|
|
20413
|
-
}
|
|
20414
|
-
}
|
|
20415
|
-
|
|
20416
20366
|
// ts/removeControlCharacters.ts
|
|
20417
20367
|
function removeControlCharacters(str) {
|
|
20418
20368
|
return str.replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, "");
|
|
@@ -20994,6 +20944,10 @@ fifo/
|
|
|
20994
20944
|
*.raw.log
|
|
20995
20945
|
*.lines.log
|
|
20996
20946
|
*.debug.log
|
|
20947
|
+
|
|
20948
|
+
# Ignore .gitignore itself
|
|
20949
|
+
.gitignore
|
|
20950
|
+
|
|
20997
20951
|
`;
|
|
20998
20952
|
try {
|
|
20999
20953
|
await writeFile3(gitignorePath, gitignoreContent, { flag: "wx" });
|
|
@@ -21016,166 +20970,108 @@ var init_pidStore = __esm(() => {
|
|
|
21016
20970
|
init_logger();
|
|
21017
20971
|
});
|
|
21018
20972
|
|
|
21019
|
-
// ts/
|
|
21020
|
-
async function
|
|
21021
|
-
|
|
21022
|
-
|
|
21023
|
-
|
|
20973
|
+
// ts/core/messaging.ts
|
|
20974
|
+
async function sendEnter(context, waitms = 1000) {
|
|
20975
|
+
const st = Date.now();
|
|
20976
|
+
await context.idleWaiter.wait(waitms);
|
|
20977
|
+
const et = Date.now();
|
|
20978
|
+
logger.debug(`sendEn| idleWaiter.wait(${String(waitms)}) took ${String(et - st)}ms`);
|
|
20979
|
+
context.nextStdout.unready();
|
|
20980
|
+
context.shell.write("\r");
|
|
20981
|
+
await Promise.race([
|
|
20982
|
+
context.nextStdout.wait(),
|
|
20983
|
+
new Promise((resolve) => setTimeout(() => {
|
|
20984
|
+
if (!context.nextStdout.ready) {
|
|
20985
|
+
context.shell.write("\r");
|
|
20986
|
+
}
|
|
20987
|
+
resolve();
|
|
20988
|
+
}, 1000))
|
|
20989
|
+
]);
|
|
20990
|
+
await Promise.race([
|
|
20991
|
+
context.nextStdout.wait(),
|
|
20992
|
+
new Promise((resolve) => setTimeout(() => {
|
|
20993
|
+
if (!context.nextStdout.ready) {
|
|
20994
|
+
context.shell.write("\r");
|
|
20995
|
+
}
|
|
20996
|
+
resolve();
|
|
20997
|
+
}, 3000))
|
|
20998
|
+
]);
|
|
21024
20999
|
}
|
|
21000
|
+
async function sendMessage3(context, message, { waitForReady = true } = {}) {
|
|
21001
|
+
if (waitForReady)
|
|
21002
|
+
await context.stdinReady.wait();
|
|
21003
|
+
logger.debug(`send |${message}`);
|
|
21004
|
+
context.nextStdout.unready();
|
|
21005
|
+
context.shell.write(message);
|
|
21006
|
+
context.idleWaiter.ping();
|
|
21007
|
+
logger.debug(`waiting next stdout|${message}`);
|
|
21008
|
+
await context.nextStdout.wait();
|
|
21009
|
+
logger.debug(`sending enter`);
|
|
21010
|
+
await sendEnter(context, 1000);
|
|
21011
|
+
logger.debug(`sent enter`);
|
|
21012
|
+
}
|
|
21013
|
+
var init_messaging = __esm(() => {
|
|
21014
|
+
init_logger();
|
|
21015
|
+
});
|
|
21025
21016
|
|
|
21026
|
-
// ts/
|
|
21027
|
-
|
|
21028
|
-
|
|
21029
|
-
|
|
21030
|
-
|
|
21031
|
-
|
|
21032
|
-
|
|
21033
|
-
|
|
21034
|
-
|
|
21035
|
-
|
|
21036
|
-
|
|
21037
|
-
|
|
21038
|
-
|
|
21039
|
-
|
|
21017
|
+
// ts/core/logging.ts
|
|
21018
|
+
import path10 from "path";
|
|
21019
|
+
import { mkdir as mkdir4, writeFile as writeFile4 } from "fs/promises";
|
|
21020
|
+
function initializeLogPaths(pidStore, pid) {
|
|
21021
|
+
const logPath = pidStore.getLogPath(pid);
|
|
21022
|
+
const rawLogPath = path10.resolve(path10.dirname(logPath), `${pid}.raw.log`);
|
|
21023
|
+
const rawLinesLogPath = path10.resolve(path10.dirname(logPath), `${pid}.lines.log`);
|
|
21024
|
+
const debuggingLogsPath = path10.resolve(path10.dirname(logPath), `${pid}.debug.log`);
|
|
21025
|
+
return {
|
|
21026
|
+
logPath,
|
|
21027
|
+
rawLogPath,
|
|
21028
|
+
rawLinesLogPath,
|
|
21029
|
+
debuggingLogsPath
|
|
21030
|
+
};
|
|
21031
|
+
}
|
|
21032
|
+
function setupDebugLogging(debuggingLogsPath) {
|
|
21033
|
+
if (debuggingLogsPath) {
|
|
21034
|
+
logger.add(new import_winston2.default.transports.File({
|
|
21035
|
+
filename: debuggingLogsPath,
|
|
21036
|
+
level: "debug"
|
|
21037
|
+
}));
|
|
21040
21038
|
}
|
|
21041
|
-
return target;
|
|
21042
21039
|
}
|
|
21043
|
-
|
|
21044
|
-
|
|
21045
|
-
|
|
21046
|
-
|
|
21047
|
-
|
|
21048
|
-
});
|
|
21049
|
-
import { mkdir as mkdir4 } from "node:fs/promises";
|
|
21050
|
-
import os from "node:os";
|
|
21051
|
-
import path10 from "node:path";
|
|
21052
|
-
function getDefaultConfig() {
|
|
21053
|
-
return defineCliYesConfig({
|
|
21054
|
-
configDir,
|
|
21055
|
-
logsDir: configDir && path10.resolve(configDir, "logs"),
|
|
21056
|
-
clis: {
|
|
21057
|
-
qwen: {
|
|
21058
|
-
install: "npm install -g @qwen-code/qwen-code@latest",
|
|
21059
|
-
version: "qwen --version"
|
|
21060
|
-
},
|
|
21061
|
-
grok: {
|
|
21062
|
-
install: "npm install -g @vibe-kit/grok-cli@latest",
|
|
21063
|
-
ready: [/^ │ ❯ +/],
|
|
21064
|
-
enter: [/^ 1. Yes/]
|
|
21065
|
-
},
|
|
21066
|
-
claude: {
|
|
21067
|
-
promptArg: "last-arg",
|
|
21068
|
-
install: {
|
|
21069
|
-
powershell: "irm https://claude.ai/install.ps1 | iex",
|
|
21070
|
-
bash: "curl -fsSL https://claude.ai/install.sh | bash",
|
|
21071
|
-
npm: "npm i -g @anthropic-ai/claude-code@latest"
|
|
21072
|
-
},
|
|
21073
|
-
ready: [/^\? for shortcuts/, /^> /],
|
|
21074
|
-
typingRespond: {
|
|
21075
|
-
"1\n": [/│ Do you want to use this API key\?/]
|
|
21076
|
-
},
|
|
21077
|
-
enter: [
|
|
21078
|
-
/^.{0,4} 1\. Yes/m,
|
|
21079
|
-
/^.{0,4} 1\. Yes, continue/m,
|
|
21080
|
-
/^.{0,4} 1\. Dark mode ?✔/m,
|
|
21081
|
-
/❯ 1\. Yes/m,
|
|
21082
|
-
/❯ 1\. Yes, continue/m,
|
|
21083
|
-
/❯ 1\. Dark mode ?✔/m,
|
|
21084
|
-
/Press Enter to continue…/m
|
|
21085
|
-
],
|
|
21086
|
-
fatal: [/⎿ Claude usage limit reached\./, /^error: unknown option/],
|
|
21087
|
-
restoreArgs: ["--continue"],
|
|
21088
|
-
restartWithoutContinueArg: [/No conversation found to continue/],
|
|
21089
|
-
exitCommand: ["/exit"],
|
|
21090
|
-
bunx: true,
|
|
21091
|
-
defaultArgs: ["--model=sonnet"]
|
|
21092
|
-
},
|
|
21093
|
-
gemini: {
|
|
21094
|
-
install: "npm install -g @google/gemini-cli@latest",
|
|
21095
|
-
ready: [/Type your message/],
|
|
21096
|
-
enter: [/│ ● 1. Yes, allow once/, /│ ● 1. Allow once/],
|
|
21097
|
-
fatal: [/Error resuming session/, /No previous sessions found for this project./],
|
|
21098
|
-
restoreArgs: ["--resume"],
|
|
21099
|
-
restartWithoutContinueArg: [
|
|
21100
|
-
/No previous sessions found for this project\./,
|
|
21101
|
-
/Error resuming session/
|
|
21102
|
-
],
|
|
21103
|
-
exitCommand: ["/chat save ${PWD}", "/quit"]
|
|
21104
|
-
},
|
|
21105
|
-
codex: {
|
|
21106
|
-
promptArg: "first-arg",
|
|
21107
|
-
install: "npm install -g @openai/codex@latest",
|
|
21108
|
-
updateAvailable: [/^✨⬆️ Update available!/],
|
|
21109
|
-
ready: [
|
|
21110
|
-
/⏎ send/,
|
|
21111
|
-
/\? for shortcuts/
|
|
21112
|
-
],
|
|
21113
|
-
enter: [
|
|
21114
|
-
/> 1. Yes,/,
|
|
21115
|
-
/> 1. Yes, allow Codex to work in this folder/,
|
|
21116
|
-
/> 1. Approve and run now/
|
|
21117
|
-
],
|
|
21118
|
-
fatal: [/Error: The cursor position could not be read within/],
|
|
21119
|
-
defaultArgs: ["--search"],
|
|
21120
|
-
noEOL: true
|
|
21121
|
-
},
|
|
21122
|
-
copilot: {
|
|
21123
|
-
install: "npm install -g @github/copilot",
|
|
21124
|
-
ready: [/^ +> /, /Ctrl\+c Exit/],
|
|
21125
|
-
enter: [/ │ ❯ +1. Yes, proceed/, /❯ +1. Yes/],
|
|
21126
|
-
fatal: []
|
|
21127
|
-
},
|
|
21128
|
-
cursor: {
|
|
21129
|
-
install: "open https://cursor.com/ja/docs/cli/installation",
|
|
21130
|
-
binary: "cursor-agent",
|
|
21131
|
-
bunx: true,
|
|
21132
|
-
ready: [/\/ commands/],
|
|
21133
|
-
enter: [/→ Run \(once\) \(y\) \(enter\)/, /▶ \[a\] Trust this workspace/],
|
|
21134
|
-
fatal: [/^ Error: You've hit your usage limit/]
|
|
21135
|
-
},
|
|
21136
|
-
auggie: {
|
|
21137
|
-
help: "https://docs.augmentcode.com/cli/overview",
|
|
21138
|
-
install: "npm install -g @augmentcode/auggie",
|
|
21139
|
-
promptArg: "first-arg",
|
|
21140
|
-
ready: [/ > /, /\? to show shortcuts/],
|
|
21141
|
-
enter: [],
|
|
21142
|
-
fatal: []
|
|
21143
|
-
},
|
|
21144
|
-
amp: {
|
|
21145
|
-
help: "https://ampcode.com/",
|
|
21146
|
-
install: {
|
|
21147
|
-
bash: "curl -fsSL https://ampcode.com/install.sh | bash",
|
|
21148
|
-
npm: "npm i -g @sourcegraph/amp"
|
|
21149
|
-
},
|
|
21150
|
-
enter: [
|
|
21151
|
-
/^.{0,4} Approve /
|
|
21152
|
-
]
|
|
21153
|
-
}
|
|
21154
|
-
}
|
|
21155
|
-
});
|
|
21040
|
+
async function saveLogFile(logPath, content) {
|
|
21041
|
+
if (!logPath)
|
|
21042
|
+
return;
|
|
21043
|
+
await mkdir4(path10.dirname(logPath), { recursive: true }).catch(() => null);
|
|
21044
|
+
await writeFile4(logPath, content).catch(() => null);
|
|
21045
|
+
logger.info(`Full logs saved to ${logPath}`);
|
|
21156
21046
|
}
|
|
21157
|
-
|
|
21158
|
-
|
|
21159
|
-
init_logger();
|
|
21160
|
-
logger.debug("loading cli-yes.config.ts from " + import.meta.url);
|
|
21161
|
-
configDir = await (async () => {
|
|
21162
|
-
const homeConfigDir = path10.resolve(os.homedir(), ".agent-yes");
|
|
21163
|
-
const isHomeWritable = await mkdir4(homeConfigDir, { recursive: true }).then(() => true).catch(() => false);
|
|
21164
|
-
if (isHomeWritable) {
|
|
21165
|
-
logger.debug("[config] Using home directory:", homeConfigDir);
|
|
21166
|
-
return homeConfigDir;
|
|
21167
|
-
}
|
|
21168
|
-
const tmpConfigDir = path10.resolve("/tmp/.agent-yes");
|
|
21169
|
-
const isWritable = await mkdir4(tmpConfigDir, { recursive: true });
|
|
21170
|
-
if (isWritable) {
|
|
21171
|
-
logger.debug("[config] Using workspace directory:", tmpConfigDir);
|
|
21172
|
-
return tmpConfigDir;
|
|
21173
|
-
}
|
|
21047
|
+
async function saveDeprecatedLogFile(logFile, content, verbose) {
|
|
21048
|
+
if (!logFile)
|
|
21174
21049
|
return;
|
|
21175
|
-
|
|
21176
|
-
|
|
21050
|
+
if (verbose)
|
|
21051
|
+
logger.info(`Writing rendered logs to ${logFile}`);
|
|
21052
|
+
const logFilePath = path10.resolve(logFile);
|
|
21053
|
+
await mkdir4(path10.dirname(logFilePath), { recursive: true }).catch(() => null);
|
|
21054
|
+
await writeFile4(logFilePath, content);
|
|
21055
|
+
}
|
|
21056
|
+
var import_winston2;
|
|
21057
|
+
var init_logging = __esm(() => {
|
|
21058
|
+
init_logger();
|
|
21059
|
+
import_winston2 = __toESM(require_winston(), 1);
|
|
21177
21060
|
});
|
|
21178
21061
|
|
|
21062
|
+
// ts/catcher.ts
|
|
21063
|
+
function catcher(catchFn, fn) {
|
|
21064
|
+
if (!fn)
|
|
21065
|
+
return (fn2) => catcher(catchFn, fn2);
|
|
21066
|
+
return (...args) => {
|
|
21067
|
+
try {
|
|
21068
|
+
return fn(...args);
|
|
21069
|
+
} catch (error) {
|
|
21070
|
+
return catchFn(error, fn, ...args);
|
|
21071
|
+
}
|
|
21072
|
+
};
|
|
21073
|
+
}
|
|
21074
|
+
|
|
21179
21075
|
// ts/pty-fix.ts
|
|
21180
21076
|
var exports_pty_fix = {};
|
|
21181
21077
|
import { execSync as execSync2 } from "child_process";
|
|
@@ -21303,23 +21199,425 @@ var init_pty_fix = __esm(() => {
|
|
|
21303
21199
|
}
|
|
21304
21200
|
});
|
|
21305
21201
|
|
|
21306
|
-
//
|
|
21307
|
-
|
|
21308
|
-
|
|
21309
|
-
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
21202
|
+
// ts/core/spawner.ts
|
|
21203
|
+
function getInstallCommand(installConfig) {
|
|
21204
|
+
if (typeof installConfig === "string") {
|
|
21205
|
+
return installConfig;
|
|
21206
|
+
}
|
|
21207
|
+
const isWindows = process.platform === "win32";
|
|
21208
|
+
const platform3 = isWindows ? "windows" : "unix";
|
|
21209
|
+
if (installConfig[platform3]) {
|
|
21210
|
+
return installConfig[platform3];
|
|
21211
|
+
}
|
|
21212
|
+
if (isWindows && installConfig.powershell) {
|
|
21213
|
+
return installConfig.powershell;
|
|
21214
|
+
}
|
|
21215
|
+
if (!isWindows && installConfig.bash) {
|
|
21216
|
+
return installConfig.bash;
|
|
21217
|
+
}
|
|
21218
|
+
if (installConfig.npm) {
|
|
21219
|
+
return installConfig.npm;
|
|
21220
|
+
}
|
|
21221
|
+
return null;
|
|
21222
|
+
}
|
|
21223
|
+
function isCommandNotFoundError(e) {
|
|
21224
|
+
if (e instanceof Error) {
|
|
21225
|
+
return e.message.includes("command not found") || e.message.includes("ENOENT") || e.message.includes("spawn");
|
|
21226
|
+
}
|
|
21227
|
+
return false;
|
|
21228
|
+
}
|
|
21229
|
+
function spawnAgent(options) {
|
|
21230
|
+
const { cli, cliConf, cliArgs, verbose, install, ptyOptions } = options;
|
|
21231
|
+
const spawn2 = () => {
|
|
21232
|
+
const cliCommand = cliConf?.binary || cli;
|
|
21233
|
+
let [bin, ...args] = [...parseCommandString(cliCommand), ...cliArgs];
|
|
21234
|
+
if (verbose)
|
|
21235
|
+
logger.info(`Spawning ${bin} with args: ${JSON.stringify(args)}`);
|
|
21236
|
+
logger.info(`Spawning ${bin} with args: ${JSON.stringify(args)}`);
|
|
21237
|
+
const spawned = pty_default.spawn(bin, args, ptyOptions);
|
|
21238
|
+
logger.info(`[${cli}-yes] Spawned ${bin} with PID ${spawned.pid}`);
|
|
21239
|
+
return spawned;
|
|
21310
21240
|
};
|
|
21311
|
-
|
|
21312
|
-
|
|
21313
|
-
|
|
21314
|
-
|
|
21315
|
-
|
|
21316
|
-
|
|
21317
|
-
|
|
21318
|
-
|
|
21319
|
-
|
|
21320
|
-
|
|
21321
|
-
|
|
21322
|
-
|
|
21241
|
+
return catcher((error, _fn, ..._args) => {
|
|
21242
|
+
logger.error(`Fatal: Failed to start ${cli}.`);
|
|
21243
|
+
const isNotFound = isCommandNotFoundError(error);
|
|
21244
|
+
if (cliConf?.install && isNotFound) {
|
|
21245
|
+
const installCmd = getInstallCommand(cliConf.install);
|
|
21246
|
+
if (!installCmd) {
|
|
21247
|
+
logger.error(`No suitable install command found for ${cli} on this platform`);
|
|
21248
|
+
throw error;
|
|
21249
|
+
}
|
|
21250
|
+
logger.info(`Please install the cli by run ${installCmd}`);
|
|
21251
|
+
if (install) {
|
|
21252
|
+
logger.info(`Attempting to install ${cli}...`);
|
|
21253
|
+
execaCommandSync(installCmd, { stdio: "inherit" });
|
|
21254
|
+
logger.info(`${cli} installed successfully. Please rerun the command.`);
|
|
21255
|
+
return spawn2();
|
|
21256
|
+
} else {
|
|
21257
|
+
logger.error(`If you did not installed it yet, Please install it first: ${installCmd}`);
|
|
21258
|
+
throw error;
|
|
21259
|
+
}
|
|
21260
|
+
}
|
|
21261
|
+
if (globalThis.Bun && error instanceof Error && error.stack?.includes("bun-pty")) {
|
|
21262
|
+
logger.error(`Detected bun-pty issue, attempted to fix it. Please try again.`);
|
|
21263
|
+
init_pty_fix();
|
|
21264
|
+
}
|
|
21265
|
+
throw error;
|
|
21266
|
+
}, spawn2)();
|
|
21267
|
+
}
|
|
21268
|
+
function getTerminalDimensions() {
|
|
21269
|
+
if (!process.stdout.isTTY)
|
|
21270
|
+
return { cols: 80, rows: 30 };
|
|
21271
|
+
return {
|
|
21272
|
+
cols: Math.min(Math.max(20, process.stdout.columns), 80),
|
|
21273
|
+
rows: process.stdout.rows
|
|
21274
|
+
};
|
|
21275
|
+
}
|
|
21276
|
+
var init_spawner = __esm(async () => {
|
|
21277
|
+
init_execa();
|
|
21278
|
+
init_logger();
|
|
21279
|
+
await init_pty();
|
|
21280
|
+
});
|
|
21281
|
+
|
|
21282
|
+
// ts/ReadyManager.ts
|
|
21283
|
+
class ReadyManager {
|
|
21284
|
+
isReady = false;
|
|
21285
|
+
readyQueue = [];
|
|
21286
|
+
wait() {
|
|
21287
|
+
if (this.isReady)
|
|
21288
|
+
return;
|
|
21289
|
+
return new Promise((resolve) => this.readyQueue.push(resolve));
|
|
21290
|
+
}
|
|
21291
|
+
unready() {
|
|
21292
|
+
this.isReady = false;
|
|
21293
|
+
}
|
|
21294
|
+
ready() {
|
|
21295
|
+
this.isReady = true;
|
|
21296
|
+
if (!this.readyQueue.length)
|
|
21297
|
+
return;
|
|
21298
|
+
this.readyQueue.splice(0).map((resolve) => resolve());
|
|
21299
|
+
}
|
|
21300
|
+
}
|
|
21301
|
+
|
|
21302
|
+
// ts/idleWaiter.ts
|
|
21303
|
+
class IdleWaiter {
|
|
21304
|
+
lastActivityTime = Date.now();
|
|
21305
|
+
checkInterval = 100;
|
|
21306
|
+
constructor() {
|
|
21307
|
+
this.ping();
|
|
21308
|
+
}
|
|
21309
|
+
ping() {
|
|
21310
|
+
this.lastActivityTime = Date.now();
|
|
21311
|
+
return this;
|
|
21312
|
+
}
|
|
21313
|
+
async wait(ms) {
|
|
21314
|
+
while (this.lastActivityTime >= Date.now() - ms)
|
|
21315
|
+
await new Promise((resolve) => setTimeout(resolve, this.checkInterval));
|
|
21316
|
+
}
|
|
21317
|
+
}
|
|
21318
|
+
|
|
21319
|
+
// ts/core/context.ts
|
|
21320
|
+
class AgentContext {
|
|
21321
|
+
shell;
|
|
21322
|
+
pidStore;
|
|
21323
|
+
logPaths;
|
|
21324
|
+
cli;
|
|
21325
|
+
cliConf;
|
|
21326
|
+
verbose;
|
|
21327
|
+
robust;
|
|
21328
|
+
stdinReady = new ReadyManager;
|
|
21329
|
+
stdinFirstReady = new ReadyManager;
|
|
21330
|
+
nextStdout = new ReadyManager;
|
|
21331
|
+
idleWaiter = new IdleWaiter;
|
|
21332
|
+
isFatal = false;
|
|
21333
|
+
shouldRestartWithoutContinue = false;
|
|
21334
|
+
constructor(params) {
|
|
21335
|
+
this.shell = params.shell;
|
|
21336
|
+
this.pidStore = params.pidStore;
|
|
21337
|
+
this.logPaths = params.logPaths;
|
|
21338
|
+
this.cli = params.cli;
|
|
21339
|
+
this.cliConf = params.cliConf;
|
|
21340
|
+
this.verbose = params.verbose;
|
|
21341
|
+
this.robust = params.robust;
|
|
21342
|
+
}
|
|
21343
|
+
get messageContext() {
|
|
21344
|
+
return {
|
|
21345
|
+
shell: this.shell,
|
|
21346
|
+
idleWaiter: this.idleWaiter,
|
|
21347
|
+
stdinReady: this.stdinReady,
|
|
21348
|
+
nextStdout: this.nextStdout
|
|
21349
|
+
};
|
|
21350
|
+
}
|
|
21351
|
+
}
|
|
21352
|
+
var init_context = () => {};
|
|
21353
|
+
|
|
21354
|
+
// ts/core/responders.ts
|
|
21355
|
+
async function createAutoResponseHandler(line, lineIndex, options) {
|
|
21356
|
+
const { ctx, conf, cli, workingDir, exitAgent } = options;
|
|
21357
|
+
logger.debug(`stdout|${line}`);
|
|
21358
|
+
if (conf.ready?.some((rx) => line.match(rx))) {
|
|
21359
|
+
logger.debug(`ready |${line}`);
|
|
21360
|
+
if (cli === "gemini" && lineIndex <= 80)
|
|
21361
|
+
return;
|
|
21362
|
+
ctx.stdinReady.ready();
|
|
21363
|
+
ctx.stdinFirstReady.ready();
|
|
21364
|
+
}
|
|
21365
|
+
if (conf.enter?.some((rx) => line.match(rx))) {
|
|
21366
|
+
logger.debug(`enter |${line}`);
|
|
21367
|
+
return await sendEnter(ctx.messageContext, 400);
|
|
21368
|
+
}
|
|
21369
|
+
const typingResponded = await src_default(Object.entries(conf.typingRespond ?? {})).filter(([_sendString, onThePatterns]) => onThePatterns.some((rx) => line.match(rx))).map(async ([sendString]) => await sendMessage3(ctx.messageContext, sendString, { waitForReady: false })).toCount();
|
|
21370
|
+
if (typingResponded)
|
|
21371
|
+
return;
|
|
21372
|
+
if (conf.fatal?.some((rx) => line.match(rx))) {
|
|
21373
|
+
logger.debug(`fatal |${line}`);
|
|
21374
|
+
ctx.isFatal = true;
|
|
21375
|
+
await exitAgent();
|
|
21376
|
+
}
|
|
21377
|
+
if (conf.restartWithoutContinueArg?.some((rx) => line.match(rx))) {
|
|
21378
|
+
logger.debug(`restart-without-continue|${line}`);
|
|
21379
|
+
ctx.shouldRestartWithoutContinue = true;
|
|
21380
|
+
ctx.isFatal = true;
|
|
21381
|
+
await exitAgent();
|
|
21382
|
+
}
|
|
21383
|
+
if (cli === "codex") {
|
|
21384
|
+
const sessionId = extractSessionId(line);
|
|
21385
|
+
if (sessionId) {
|
|
21386
|
+
logger.debug(`session|captured session ID: ${sessionId}`);
|
|
21387
|
+
await storeSessionForCwd(workingDir, sessionId);
|
|
21388
|
+
}
|
|
21389
|
+
}
|
|
21390
|
+
}
|
|
21391
|
+
var init_responders = __esm(() => {
|
|
21392
|
+
init_dist4();
|
|
21393
|
+
init_logger();
|
|
21394
|
+
init_messaging();
|
|
21395
|
+
init_codexSessionManager();
|
|
21396
|
+
});
|
|
21397
|
+
|
|
21398
|
+
// ts/core/streamHelpers.ts
|
|
21399
|
+
function handleConsoleControlCodes(text, shell, terminalRender, cli, verbose) {
|
|
21400
|
+
terminalRender.write(text);
|
|
21401
|
+
if (text.includes("\x1B[c") || text.includes("\x1B[0c")) {
|
|
21402
|
+
shell.write("\x1B[?1;2c");
|
|
21403
|
+
if (verbose) {
|
|
21404
|
+
logger.debug("device|respond DA: VT100 with Advanced Video Option");
|
|
21405
|
+
}
|
|
21406
|
+
return;
|
|
21407
|
+
}
|
|
21408
|
+
if (process.stdin.isTTY)
|
|
21409
|
+
return;
|
|
21410
|
+
if (!text.includes("\x1B[6n"))
|
|
21411
|
+
return;
|
|
21412
|
+
const { col, row } = terminalRender.getCursorPosition();
|
|
21413
|
+
shell.write(`\x1B[${row};${col}R`);
|
|
21414
|
+
logger.debug(`cursor|respond position: row=${String(row)}, col=${String(col)}`);
|
|
21415
|
+
}
|
|
21416
|
+
function createTerminateSignalHandler(stdinReady, onAbort) {
|
|
21417
|
+
let aborted2 = false;
|
|
21418
|
+
return (chunk) => {
|
|
21419
|
+
if (!aborted2 && chunk === "\x1A") {
|
|
21420
|
+
return "";
|
|
21421
|
+
}
|
|
21422
|
+
if (!aborted2 && !stdinReady.isReady && chunk === "\x03") {
|
|
21423
|
+
logger.error("User aborted: SIGINT");
|
|
21424
|
+
onAbort(130);
|
|
21425
|
+
aborted2 = true;
|
|
21426
|
+
return chunk;
|
|
21427
|
+
}
|
|
21428
|
+
return chunk;
|
|
21429
|
+
};
|
|
21430
|
+
}
|
|
21431
|
+
function createTerminatorStream(exitPromise) {
|
|
21432
|
+
return new TransformStream({
|
|
21433
|
+
start: function terminator(ctrl) {
|
|
21434
|
+
exitPromise.then(() => ctrl.terminate());
|
|
21435
|
+
},
|
|
21436
|
+
transform: (e, ctrl) => ctrl.enqueue(e),
|
|
21437
|
+
flush: (ctrl) => ctrl.terminate()
|
|
21438
|
+
});
|
|
21439
|
+
}
|
|
21440
|
+
var init_streamHelpers = __esm(() => {
|
|
21441
|
+
init_logger();
|
|
21442
|
+
});
|
|
21443
|
+
|
|
21444
|
+
// ts/defineConfig.ts
|
|
21445
|
+
async function defineCliYesConfig(cfg) {
|
|
21446
|
+
if (typeof cfg === "function")
|
|
21447
|
+
cfg = await cfg({ clis: {} });
|
|
21448
|
+
return cfg;
|
|
21449
|
+
}
|
|
21450
|
+
|
|
21451
|
+
// ts/utils.ts
|
|
21452
|
+
function deepMixin(target, source, ...more) {
|
|
21453
|
+
for (const key in source) {
|
|
21454
|
+
if (source[key] && typeof source[key] === "object" && !Array.isArray(source[key])) {
|
|
21455
|
+
if (!target[key] || typeof target[key] !== "object") {
|
|
21456
|
+
target[key] = {};
|
|
21457
|
+
}
|
|
21458
|
+
deepMixin(target[key], source[key]);
|
|
21459
|
+
} else if (source[key] !== undefined) {
|
|
21460
|
+
target[key] = source[key];
|
|
21461
|
+
}
|
|
21462
|
+
}
|
|
21463
|
+
for (const moreSource of more) {
|
|
21464
|
+
deepMixin(target, moreSource);
|
|
21465
|
+
}
|
|
21466
|
+
return target;
|
|
21467
|
+
}
|
|
21468
|
+
|
|
21469
|
+
// agent-yes.config.ts
|
|
21470
|
+
var exports_agent_yes_config = {};
|
|
21471
|
+
__export(exports_agent_yes_config, {
|
|
21472
|
+
default: () => agent_yes_config_default
|
|
21473
|
+
});
|
|
21474
|
+
import { mkdir as mkdir5 } from "node:fs/promises";
|
|
21475
|
+
import os from "node:os";
|
|
21476
|
+
import path11 from "node:path";
|
|
21477
|
+
function getDefaultConfig() {
|
|
21478
|
+
return defineCliYesConfig({
|
|
21479
|
+
configDir,
|
|
21480
|
+
logsDir: configDir && path11.resolve(configDir, "logs"),
|
|
21481
|
+
clis: {
|
|
21482
|
+
qwen: {
|
|
21483
|
+
install: "npm install -g @qwen-code/qwen-code@latest",
|
|
21484
|
+
version: "qwen --version"
|
|
21485
|
+
},
|
|
21486
|
+
grok: {
|
|
21487
|
+
install: "npm install -g @vibe-kit/grok-cli@latest",
|
|
21488
|
+
ready: [/^ │ ❯ +/],
|
|
21489
|
+
enter: [/^ 1. Yes/]
|
|
21490
|
+
},
|
|
21491
|
+
claude: {
|
|
21492
|
+
promptArg: "last-arg",
|
|
21493
|
+
install: {
|
|
21494
|
+
powershell: "irm https://claude.ai/install.ps1 | iex",
|
|
21495
|
+
bash: "curl -fsSL https://claude.ai/install.sh | bash",
|
|
21496
|
+
npm: "npm i -g @anthropic-ai/claude-code@latest"
|
|
21497
|
+
},
|
|
21498
|
+
ready: [/^\? for shortcuts/, /^> /],
|
|
21499
|
+
typingRespond: {
|
|
21500
|
+
"1\n": [/│ Do you want to use this API key\?/]
|
|
21501
|
+
},
|
|
21502
|
+
enter: [
|
|
21503
|
+
/^.{0,4} 1\. Yes/m,
|
|
21504
|
+
/^.{0,4} 1\. Yes, continue/m,
|
|
21505
|
+
/^.{0,4} 1\. Dark mode ?✔/m,
|
|
21506
|
+
/❯ 1\. Yes/m,
|
|
21507
|
+
/❯ 1\. Yes, continue/m,
|
|
21508
|
+
/❯ 1\. Dark mode ?✔/m,
|
|
21509
|
+
/Press Enter to continue…/m
|
|
21510
|
+
],
|
|
21511
|
+
fatal: [/⎿ Claude usage limit reached\./, /^error: unknown option/],
|
|
21512
|
+
restoreArgs: ["--continue"],
|
|
21513
|
+
restartWithoutContinueArg: [/No conversation found to continue/],
|
|
21514
|
+
exitCommand: ["/exit"],
|
|
21515
|
+
bunx: true,
|
|
21516
|
+
defaultArgs: ["--model=sonnet"]
|
|
21517
|
+
},
|
|
21518
|
+
gemini: {
|
|
21519
|
+
install: "npm install -g @google/gemini-cli@latest",
|
|
21520
|
+
ready: [/Type your message/],
|
|
21521
|
+
enter: [/│ ● 1. Yes, allow once/, /│ ● 1. Allow once/],
|
|
21522
|
+
fatal: [/Error resuming session/, /No previous sessions found for this project./],
|
|
21523
|
+
restoreArgs: ["--resume"],
|
|
21524
|
+
restartWithoutContinueArg: [
|
|
21525
|
+
/No previous sessions found for this project\./,
|
|
21526
|
+
/Error resuming session/
|
|
21527
|
+
],
|
|
21528
|
+
exitCommand: ["/chat save ${PWD}", "/quit"]
|
|
21529
|
+
},
|
|
21530
|
+
codex: {
|
|
21531
|
+
promptArg: "first-arg",
|
|
21532
|
+
install: "npm install -g @openai/codex@latest",
|
|
21533
|
+
updateAvailable: [/^✨⬆️ Update available!/],
|
|
21534
|
+
ready: [
|
|
21535
|
+
/⏎ send/,
|
|
21536
|
+
/\? for shortcuts/
|
|
21537
|
+
],
|
|
21538
|
+
enter: [
|
|
21539
|
+
/> 1. Yes,/,
|
|
21540
|
+
/> 1. Yes, allow Codex to work in this folder/,
|
|
21541
|
+
/> 1. Approve and run now/
|
|
21542
|
+
],
|
|
21543
|
+
fatal: [/Error: The cursor position could not be read within/],
|
|
21544
|
+
defaultArgs: ["--search"],
|
|
21545
|
+
noEOL: true
|
|
21546
|
+
},
|
|
21547
|
+
copilot: {
|
|
21548
|
+
install: "npm install -g @github/copilot",
|
|
21549
|
+
ready: [/^ +> /, /Ctrl\+c Exit/],
|
|
21550
|
+
enter: [/ │ ❯ +1. Yes, proceed/, /❯ +1. Yes/],
|
|
21551
|
+
fatal: []
|
|
21552
|
+
},
|
|
21553
|
+
cursor: {
|
|
21554
|
+
install: "open https://cursor.com/ja/docs/cli/installation",
|
|
21555
|
+
binary: "cursor-agent",
|
|
21556
|
+
bunx: true,
|
|
21557
|
+
ready: [/\/ commands/],
|
|
21558
|
+
enter: [/→ Run \(once\) \(y\) \(enter\)/, /▶ \[a\] Trust this workspace/],
|
|
21559
|
+
fatal: [/^ Error: You've hit your usage limit/]
|
|
21560
|
+
},
|
|
21561
|
+
auggie: {
|
|
21562
|
+
help: "https://docs.augmentcode.com/cli/overview",
|
|
21563
|
+
install: "npm install -g @augmentcode/auggie",
|
|
21564
|
+
promptArg: "first-arg",
|
|
21565
|
+
ready: [/ > /, /\? to show shortcuts/],
|
|
21566
|
+
enter: [],
|
|
21567
|
+
fatal: []
|
|
21568
|
+
},
|
|
21569
|
+
amp: {
|
|
21570
|
+
help: "https://ampcode.com/",
|
|
21571
|
+
install: {
|
|
21572
|
+
bash: "curl -fsSL https://ampcode.com/install.sh | bash",
|
|
21573
|
+
npm: "npm i -g @sourcegraph/amp"
|
|
21574
|
+
},
|
|
21575
|
+
enter: [
|
|
21576
|
+
/^.{0,4} Approve /
|
|
21577
|
+
]
|
|
21578
|
+
}
|
|
21579
|
+
}
|
|
21580
|
+
});
|
|
21581
|
+
}
|
|
21582
|
+
var configDir, agent_yes_config_default;
|
|
21583
|
+
var init_agent_yes_config = __esm(async () => {
|
|
21584
|
+
init_logger();
|
|
21585
|
+
logger.debug("loading cli-yes.config.ts from " + import.meta.url);
|
|
21586
|
+
configDir = await (async () => {
|
|
21587
|
+
const homeConfigDir = path11.resolve(os.homedir(), ".agent-yes");
|
|
21588
|
+
const isHomeWritable = await mkdir5(homeConfigDir, { recursive: true }).then(() => true).catch(() => false);
|
|
21589
|
+
if (isHomeWritable) {
|
|
21590
|
+
logger.debug("[config] Using home directory:", homeConfigDir);
|
|
21591
|
+
return homeConfigDir;
|
|
21592
|
+
}
|
|
21593
|
+
const tmpConfigDir = path11.resolve("/tmp/.agent-yes");
|
|
21594
|
+
const isWritable = await mkdir5(tmpConfigDir, { recursive: true });
|
|
21595
|
+
if (isWritable) {
|
|
21596
|
+
logger.debug("[config] Using workspace directory:", tmpConfigDir);
|
|
21597
|
+
return tmpConfigDir;
|
|
21598
|
+
}
|
|
21599
|
+
return;
|
|
21600
|
+
})();
|
|
21601
|
+
agent_yes_config_default = deepMixin(await getDefaultConfig(), await import(path11.resolve(os.homedir(), ".agent-yes/config.ts")).catch(() => ({ default: {} })).then((mod) => mod.default), await import(path11.resolve(process.cwd(), "node_modules/.agent-yes/config.ts")).catch(() => ({ default: {} })).then((mod) => mod.default), await import(path11.resolve(process.cwd(), ".agent-yes/config.ts")).catch(() => ({ default: {} })).then((mod) => mod.default));
|
|
21602
|
+
});
|
|
21603
|
+
|
|
21604
|
+
// node_modules/emoji-regex/index.js
|
|
21605
|
+
var require_emoji_regex = __commonJS((exports, module) => {
|
|
21606
|
+
module.exports = () => {
|
|
21607
|
+
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
21608
|
+
};
|
|
21609
|
+
});
|
|
21610
|
+
|
|
21611
|
+
// node_modules/get-caller-file/index.js
|
|
21612
|
+
var require_get_caller_file = __commonJS((exports, module) => {
|
|
21613
|
+
module.exports = function getCallerFile(position) {
|
|
21614
|
+
if (position === undefined) {
|
|
21615
|
+
position = 2;
|
|
21616
|
+
}
|
|
21617
|
+
if (position >= Error.stackTraceLimit) {
|
|
21618
|
+
throw new TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `" + position + "` and Error.stackTraceLimit was: `" + Error.stackTraceLimit + "`");
|
|
21619
|
+
}
|
|
21620
|
+
var oldPrepareStackTrace = Error.prepareStackTrace;
|
|
21323
21621
|
Error.prepareStackTrace = function(_, stack2) {
|
|
21324
21622
|
return stack2;
|
|
21325
21623
|
};
|
|
@@ -21340,8 +21638,8 @@ __export(exports_ts, {
|
|
|
21340
21638
|
CLIS_CONFIG: () => CLIS_CONFIG2
|
|
21341
21639
|
});
|
|
21342
21640
|
import { fromReadable as fromReadable3, fromWritable as fromWritable2 } from "from-node-stream";
|
|
21343
|
-
import { mkdir as
|
|
21344
|
-
import
|
|
21641
|
+
import { mkdir as mkdir8, readFile as readFile4, writeFile as writeFile8 } from "fs/promises";
|
|
21642
|
+
import path14 from "path";
|
|
21345
21643
|
async function agentYes2({
|
|
21346
21644
|
cli,
|
|
21347
21645
|
cliArgs = [],
|
|
@@ -21388,36 +21686,12 @@ async function agentYes2({
|
|
|
21388
21686
|
const pidStore = new PidStore(workingDir);
|
|
21389
21687
|
await pidStore.init();
|
|
21390
21688
|
process.stdin.setRawMode?.(true);
|
|
21391
|
-
let isFatal = false;
|
|
21392
|
-
let shouldRestartWithoutContinue = false;
|
|
21393
|
-
const stdinReady = new ReadyManager;
|
|
21394
|
-
const stdinFirstReady = new ReadyManager;
|
|
21395
|
-
sleep3(1e4).then(() => {
|
|
21396
|
-
if (!stdinReady.isReady)
|
|
21397
|
-
stdinReady.ready();
|
|
21398
|
-
if (!stdinFirstReady.isReady)
|
|
21399
|
-
stdinFirstReady.ready();
|
|
21400
|
-
});
|
|
21401
|
-
const nextStdout = new ReadyManager;
|
|
21402
21689
|
const shellOutputStream = new TransformStream;
|
|
21403
21690
|
const outputWriter = shellOutputStream.writable.getWriter();
|
|
21404
21691
|
logger.debug(`Using ${ptyPackage} for pseudo terminal management.`);
|
|
21405
|
-
let logPath = false;
|
|
21406
|
-
let rawLogPath = false;
|
|
21407
|
-
let rawLinesLogPath = false;
|
|
21408
|
-
let debuggingLogsPath = false;
|
|
21409
21692
|
const isSubAgent = !!process.env.CLAUDE_PPID;
|
|
21410
21693
|
if (isSubAgent)
|
|
21411
21694
|
logger.info(`[${cli}-yes] Running as sub-agent (CLAUDE_PPID=${process.env.CLAUDE_PPID})`);
|
|
21412
|
-
const getPtyOptions = () => {
|
|
21413
|
-
const ptyEnv = { ...env2 ?? process.env };
|
|
21414
|
-
return {
|
|
21415
|
-
name: "xterm-color",
|
|
21416
|
-
...getTerminalDimensions(),
|
|
21417
|
-
cwd: cwd ?? process.cwd(),
|
|
21418
|
-
env: ptyEnv
|
|
21419
|
-
};
|
|
21420
|
-
};
|
|
21421
21695
|
const cliConf = CLIS_CONFIG2[cli] || {};
|
|
21422
21696
|
cliArgs = cliConf.defaultArgs ? [...cliConf.defaultArgs, ...cliArgs] : cliArgs;
|
|
21423
21697
|
try {
|
|
@@ -21435,9 +21709,9 @@ async function agentYes2({
|
|
|
21435
21709
|
} catch {}
|
|
21436
21710
|
const skillHeaders = [];
|
|
21437
21711
|
let currentDir = workingDir2;
|
|
21438
|
-
const searchLimit = gitRoot ||
|
|
21712
|
+
const searchLimit = gitRoot || path14.parse(currentDir).root;
|
|
21439
21713
|
while (true) {
|
|
21440
|
-
const skillPath =
|
|
21714
|
+
const skillPath = path14.resolve(currentDir, "SKILL.md");
|
|
21441
21715
|
const md = await readFile4(skillPath, "utf8").catch(() => null);
|
|
21442
21716
|
if (md) {
|
|
21443
21717
|
const headerMatch = md.match(/^[\s\S]*?(?=\n##\s)/);
|
|
@@ -21450,7 +21724,7 @@ async function agentYes2({
|
|
|
21450
21724
|
}
|
|
21451
21725
|
if (currentDir === searchLimit)
|
|
21452
21726
|
break;
|
|
21453
|
-
const parentDir =
|
|
21727
|
+
const parentDir = path14.dirname(currentDir);
|
|
21454
21728
|
if (parentDir === currentDir)
|
|
21455
21729
|
break;
|
|
21456
21730
|
currentDir = parentDir;
|
|
@@ -21513,93 +21787,54 @@ ${prompt}` : prefix;
|
|
|
21513
21787
|
logger.warn(`Unknown promptArg format: ${cliConf.promptArg}`);
|
|
21514
21788
|
}
|
|
21515
21789
|
}
|
|
21516
|
-
const
|
|
21517
|
-
|
|
21518
|
-
|
|
21519
|
-
|
|
21520
|
-
|
|
21521
|
-
|
|
21522
|
-
if (installConfig[platform3]) {
|
|
21523
|
-
return installConfig[platform3];
|
|
21524
|
-
}
|
|
21525
|
-
if (isWindows && installConfig.powershell) {
|
|
21526
|
-
return installConfig.powershell;
|
|
21527
|
-
}
|
|
21528
|
-
if (!isWindows && installConfig.bash) {
|
|
21529
|
-
return installConfig.bash;
|
|
21530
|
-
}
|
|
21531
|
-
if (installConfig.npm) {
|
|
21532
|
-
return installConfig.npm;
|
|
21533
|
-
}
|
|
21534
|
-
return null;
|
|
21790
|
+
const ptyEnv = { ...env2 ?? process.env };
|
|
21791
|
+
const ptyOptions = {
|
|
21792
|
+
name: "xterm-color",
|
|
21793
|
+
...getTerminalDimensions(),
|
|
21794
|
+
cwd: cwd ?? process.cwd(),
|
|
21795
|
+
env: ptyEnv
|
|
21535
21796
|
};
|
|
21536
|
-
|
|
21537
|
-
|
|
21538
|
-
|
|
21539
|
-
|
|
21540
|
-
|
|
21541
|
-
|
|
21542
|
-
|
|
21543
|
-
|
|
21544
|
-
return spawned;
|
|
21545
|
-
};
|
|
21546
|
-
let shell = catcher((error, _fn, ..._args) => {
|
|
21547
|
-
logger.error(`Fatal: Failed to start ${cli}.`);
|
|
21548
|
-
const isNotFound = isCommandNotFoundError(error);
|
|
21549
|
-
if (cliConf?.install && isNotFound) {
|
|
21550
|
-
const installCmd = getInstallCommand(cliConf.install);
|
|
21551
|
-
if (!installCmd) {
|
|
21552
|
-
logger.error(`No suitable install command found for ${cli} on this platform`);
|
|
21553
|
-
throw error;
|
|
21554
|
-
}
|
|
21555
|
-
logger.info(`Please install the cli by run ${installCmd}`);
|
|
21556
|
-
if (install) {
|
|
21557
|
-
logger.info(`Attempting to install ${cli}...`);
|
|
21558
|
-
execaCommandSync(installCmd, { stdio: "inherit" });
|
|
21559
|
-
logger.info(`${cli} installed successfully. Please rerun the command.`);
|
|
21560
|
-
return spawn2();
|
|
21561
|
-
} else {
|
|
21562
|
-
logger.error(`If you did not installed it yet, Please install it first: ${installCmd}`);
|
|
21563
|
-
throw error;
|
|
21564
|
-
}
|
|
21565
|
-
}
|
|
21566
|
-
if (globalThis.Bun && error instanceof Error && error.stack?.includes("bun-pty")) {
|
|
21567
|
-
logger.error(`Detected bun-pty issue, attempted to fix it. Please try again.`);
|
|
21568
|
-
init_pty_fix();
|
|
21569
|
-
}
|
|
21570
|
-
throw error;
|
|
21571
|
-
function isCommandNotFoundError(e) {
|
|
21572
|
-
if (e instanceof Error) {
|
|
21573
|
-
return e.message.includes("command not found") || e.message.includes("ENOENT") || e.message.includes("spawn");
|
|
21574
|
-
}
|
|
21575
|
-
return false;
|
|
21576
|
-
}
|
|
21577
|
-
}, spawn2)();
|
|
21797
|
+
let shell = spawnAgent({
|
|
21798
|
+
cli,
|
|
21799
|
+
cliConf,
|
|
21800
|
+
cliArgs,
|
|
21801
|
+
verbose,
|
|
21802
|
+
install,
|
|
21803
|
+
ptyOptions
|
|
21804
|
+
});
|
|
21578
21805
|
await pidStore.registerProcess({ pid: shell.pid, cli, args: cliArgs, prompt });
|
|
21579
|
-
|
|
21580
|
-
|
|
21581
|
-
|
|
21582
|
-
|
|
21583
|
-
|
|
21584
|
-
|
|
21585
|
-
|
|
21586
|
-
|
|
21587
|
-
|
|
21806
|
+
const logPaths = initializeLogPaths(pidStore, shell.pid);
|
|
21807
|
+
setupDebugLogging(logPaths.debuggingLogsPath);
|
|
21808
|
+
const ctx = new AgentContext({
|
|
21809
|
+
shell,
|
|
21810
|
+
pidStore,
|
|
21811
|
+
logPaths,
|
|
21812
|
+
cli,
|
|
21813
|
+
cliConf,
|
|
21814
|
+
verbose,
|
|
21815
|
+
robust
|
|
21816
|
+
});
|
|
21817
|
+
sleep3(1e4).then(() => {
|
|
21818
|
+
if (!ctx.stdinReady.isReady)
|
|
21819
|
+
ctx.stdinReady.ready();
|
|
21820
|
+
if (!ctx.stdinFirstReady.isReady)
|
|
21821
|
+
ctx.stdinFirstReady.ready();
|
|
21822
|
+
});
|
|
21588
21823
|
const pendingExitCode = Promise.withResolvers();
|
|
21589
21824
|
async function onData(data) {
|
|
21590
21825
|
await outputWriter.write(data);
|
|
21591
21826
|
}
|
|
21592
21827
|
shell.onData(onData);
|
|
21593
21828
|
shell.onExit(async function onExit({ exitCode: exitCode2 }) {
|
|
21594
|
-
stdinReady.unready();
|
|
21829
|
+
ctx.stdinReady.unready();
|
|
21595
21830
|
const agentCrashed = exitCode2 !== 0;
|
|
21596
|
-
if (shouldRestartWithoutContinue) {
|
|
21831
|
+
if (ctx.shouldRestartWithoutContinue) {
|
|
21597
21832
|
await pidStore.updateStatus(shell.pid, "exited", {
|
|
21598
21833
|
exitReason: "restarted",
|
|
21599
21834
|
exitCode: exitCode2 ?? undefined
|
|
21600
21835
|
});
|
|
21601
|
-
shouldRestartWithoutContinue = false;
|
|
21602
|
-
isFatal = false;
|
|
21836
|
+
ctx.shouldRestartWithoutContinue = false;
|
|
21837
|
+
ctx.isFatal = false;
|
|
21603
21838
|
const cliCommand = cliConf?.binary || cli;
|
|
21604
21839
|
let [bin, ...args] = [
|
|
21605
21840
|
...parseCommandString(cliCommand),
|
|
@@ -21617,7 +21852,7 @@ ${prompt}` : prefix;
|
|
|
21617
21852
|
logger.warn(`robust is only supported for ${Object.entries(CLIS_CONFIG2).filter(([_, v]) => v.restoreArgs).map(([k]) => k).join(", ")} currently, not ${cli}`);
|
|
21618
21853
|
return;
|
|
21619
21854
|
}
|
|
21620
|
-
if (isFatal) {
|
|
21855
|
+
if (ctx.isFatal) {
|
|
21621
21856
|
await pidStore.updateStatus(shell.pid, "exited", {
|
|
21622
21857
|
exitReason: "fatal",
|
|
21623
21858
|
exitCode: exitCode2 ?? undefined
|
|
@@ -21658,9 +21893,8 @@ ${prompt}` : prefix;
|
|
|
21658
21893
|
});
|
|
21659
21894
|
const terminalRender = new TerminalTextRender;
|
|
21660
21895
|
const isStillWorkingQ = () => terminalRender.render().replace(/\s+/g, " ").match(/esc to interrupt|to run in background/);
|
|
21661
|
-
const idleWaiter = new IdleWaiter;
|
|
21662
21896
|
if (exitOnIdle)
|
|
21663
|
-
idleWaiter.wait(exitOnIdle).then(async () => {
|
|
21897
|
+
ctx.idleWaiter.wait(exitOnIdle).then(async () => {
|
|
21664
21898
|
await pidStore.updateStatus(shell.pid, "idle").catch(() => null);
|
|
21665
21899
|
if (isStillWorkingQ()) {
|
|
21666
21900
|
logger.warn("[${cli}-yes] ${cli} is idle, but seems still working, not exiting yet");
|
|
@@ -21670,20 +21904,11 @@ ${prompt}` : prefix;
|
|
|
21670
21904
|
await exitAgent();
|
|
21671
21905
|
});
|
|
21672
21906
|
await src_default(fromReadable3(process.stdin)).map((buffer2) => buffer2.toString()).by(function handleTerminateSignals(s) {
|
|
21673
|
-
|
|
21674
|
-
|
|
21675
|
-
|
|
21676
|
-
return "";
|
|
21677
|
-
}
|
|
21678
|
-
if (!aborted2 && !stdinReady.isReady && chunk === "\x03") {
|
|
21679
|
-
logger.error("User aborted: SIGINT");
|
|
21680
|
-
shell.kill("SIGINT");
|
|
21681
|
-
pendingExitCode.resolve(130);
|
|
21682
|
-
aborted2 = true;
|
|
21683
|
-
return chunk;
|
|
21684
|
-
}
|
|
21685
|
-
return chunk;
|
|
21907
|
+
const handler = createTerminateSignalHandler(ctx.stdinReady, (exitCode2) => {
|
|
21908
|
+
shell.kill("SIGINT");
|
|
21909
|
+
pendingExitCode.resolve(exitCode2);
|
|
21686
21910
|
});
|
|
21911
|
+
return s.map(handler);
|
|
21687
21912
|
}).by((s) => {
|
|
21688
21913
|
if (!useFifo)
|
|
21689
21914
|
return s;
|
|
@@ -21699,154 +21924,49 @@ ${prompt}` : prefix;
|
|
|
21699
21924
|
}).onStart(async function promptOnStart() {
|
|
21700
21925
|
logger.debug("Sending prompt message: " + JSON.stringify(prompt));
|
|
21701
21926
|
if (prompt)
|
|
21702
|
-
await sendMessage3(prompt);
|
|
21927
|
+
await sendMessage3(ctx.messageContext, prompt);
|
|
21703
21928
|
}).by({
|
|
21704
21929
|
writable: new WritableStream({
|
|
21705
21930
|
write: async (data) => {
|
|
21706
|
-
await stdinReady.wait();
|
|
21931
|
+
await ctx.stdinReady.wait();
|
|
21707
21932
|
shell.write(data);
|
|
21708
21933
|
}
|
|
21709
21934
|
}),
|
|
21710
21935
|
readable: shellOutputStream.readable
|
|
21711
21936
|
}).forEach(() => {
|
|
21712
|
-
idleWaiter.ping();
|
|
21937
|
+
ctx.idleWaiter.ping();
|
|
21713
21938
|
pidStore.updateStatus(shell.pid, "active").catch(() => null);
|
|
21714
|
-
}).forEach(() => nextStdout.ready()).forkTo(async function rawLogger(f) {
|
|
21715
|
-
if (!rawLogPath)
|
|
21939
|
+
}).forEach(() => ctx.nextStdout.ready()).forkTo(async function rawLogger(f) {
|
|
21940
|
+
if (!ctx.logPaths.rawLogPath)
|
|
21716
21941
|
return f.run();
|
|
21717
|
-
return await
|
|
21718
|
-
logger.debug(`[${cli}-yes] raw logs streaming to ${rawLogPath}`);
|
|
21942
|
+
return await mkdir8(path14.dirname(ctx.logPaths.rawLogPath), { recursive: true }).then(() => {
|
|
21943
|
+
logger.debug(`[${cli}-yes] raw logs streaming to ${ctx.logPaths.rawLogPath}`);
|
|
21719
21944
|
return f.forEach(async (chars) => {
|
|
21720
|
-
await
|
|
21945
|
+
await writeFile8(ctx.logPaths.rawLogPath, chars, { flag: "a" }).catch(() => null);
|
|
21721
21946
|
}).run();
|
|
21722
21947
|
}).catch(() => f.run());
|
|
21723
21948
|
}).by(function consoleResponder(e) {
|
|
21724
21949
|
if (cli === "codex")
|
|
21725
21950
|
shell.write(`\x1B[1;1R`);
|
|
21726
|
-
return e.forEach((text) =>
|
|
21727
|
-
terminalRender.write(text);
|
|
21728
|
-
if (text.includes("\x1B[c") || text.includes("\x1B[0c")) {
|
|
21729
|
-
shell.write("\x1B[?1;2c");
|
|
21730
|
-
if (verbose) {
|
|
21731
|
-
logger.debug("device|respond DA: VT100 with Advanced Video Option");
|
|
21732
|
-
}
|
|
21733
|
-
return;
|
|
21734
|
-
}
|
|
21735
|
-
if (process.stdin.isTTY)
|
|
21736
|
-
return;
|
|
21737
|
-
if (!text.includes("\x1B[6n"))
|
|
21738
|
-
return;
|
|
21739
|
-
const { col, row } = terminalRender.getCursorPosition();
|
|
21740
|
-
shell.write(`\x1B[${row};${col}R`);
|
|
21741
|
-
logger.debug(`cursor|respond position: row=${String(row)}, col=${String(col)}`);
|
|
21742
|
-
});
|
|
21951
|
+
return e.forEach((text) => handleConsoleControlCodes(text, shell, terminalRender, cli, verbose));
|
|
21743
21952
|
}).forkTo(function autoResponse(e) {
|
|
21744
21953
|
return e.map((e2) => removeControlCharacters(e2)).by((s) => {
|
|
21745
21954
|
if (conf.noEOL)
|
|
21746
21955
|
return s;
|
|
21747
21956
|
return s.lines({ EOL: "NONE" });
|
|
21748
|
-
}).forEach(async
|
|
21749
|
-
|
|
21750
|
-
|
|
21751
|
-
logger.debug(`ready |${e2}`);
|
|
21752
|
-
if (cli === "gemini" && i2 <= 80)
|
|
21753
|
-
return;
|
|
21754
|
-
stdinReady.ready();
|
|
21755
|
-
stdinFirstReady.ready();
|
|
21756
|
-
}
|
|
21757
|
-
if (conf.enter?.some((rx) => e2.match(rx))) {
|
|
21758
|
-
logger.debug(`enter |${e2}`);
|
|
21759
|
-
return await sendEnter(400);
|
|
21760
|
-
}
|
|
21761
|
-
const typingResponded = await src_default(Object.entries(conf.typingRespond ?? {})).filter(([_sendString, onThePatterns]) => onThePatterns.some((rx) => e2.match(rx))).map(async ([sendString]) => await sendMessage3(sendString, { waitForReady: false })).toCount();
|
|
21762
|
-
if (typingResponded)
|
|
21763
|
-
return;
|
|
21764
|
-
if (conf.fatal?.some((rx) => e2.match(rx))) {
|
|
21765
|
-
logger.debug(`fatal |${e2}`);
|
|
21766
|
-
isFatal = true;
|
|
21767
|
-
await exitAgent();
|
|
21768
|
-
}
|
|
21769
|
-
if (conf.restartWithoutContinueArg?.some((rx) => e2.match(rx))) {
|
|
21770
|
-
await logger.debug(`restart-without-continue|${e2}`);
|
|
21771
|
-
shouldRestartWithoutContinue = true;
|
|
21772
|
-
isFatal = true;
|
|
21773
|
-
await exitAgent();
|
|
21774
|
-
}
|
|
21775
|
-
if (cli === "codex") {
|
|
21776
|
-
const sessionId = extractSessionId(e2);
|
|
21777
|
-
if (sessionId) {
|
|
21778
|
-
await logger.debug(`session|captured session ID: ${sessionId}`);
|
|
21779
|
-
await storeSessionForCwd(workingDir, sessionId);
|
|
21780
|
-
}
|
|
21781
|
-
}
|
|
21782
|
-
}).run();
|
|
21783
|
-
}).by((s) => removeControlCharactersFromStdout ? s.map((e) => removeControlCharacters(e)) : s).by(new TransformStream({
|
|
21784
|
-
start: function terminator(ctrl) {
|
|
21785
|
-
pendingExitCode.promise.then(() => ctrl.terminate());
|
|
21786
|
-
},
|
|
21787
|
-
transform: (e, ctrl) => ctrl.enqueue(e),
|
|
21788
|
-
flush: (ctrl) => ctrl.terminate()
|
|
21789
|
-
})).to(fromWritable2(process.stdout));
|
|
21790
|
-
if (logPath) {
|
|
21791
|
-
await mkdir7(path13.dirname(logPath), { recursive: true }).catch(() => null);
|
|
21792
|
-
await writeFile7(logPath, terminalRender.render()).catch(() => null);
|
|
21793
|
-
logger.info(`[${cli}-yes] Full logs saved to ${logPath}`);
|
|
21794
|
-
}
|
|
21957
|
+
}).forEach(async (line, lineIndex) => createAutoResponseHandler(line, lineIndex, { ctx, conf, cli, workingDir, exitAgent })).run();
|
|
21958
|
+
}).by((s) => removeControlCharactersFromStdout ? s.map((e) => removeControlCharacters(e)) : s).by(createTerminatorStream(pendingExitCode.promise)).to(fromWritable2(process.stdout));
|
|
21959
|
+
await saveLogFile(ctx.logPaths.logPath, terminalRender.render());
|
|
21795
21960
|
const exitCode = await pendingExitCode.promise;
|
|
21796
21961
|
logger.info(`[${cli}-yes] ${cli} exited with code ${exitCode}`);
|
|
21797
21962
|
await pidStore.close();
|
|
21798
21963
|
await outputWriter.close();
|
|
21799
|
-
|
|
21800
|
-
if (verbose)
|
|
21801
|
-
logger.info(`[${cli}-yes] Writing rendered logs to ${logFile}`);
|
|
21802
|
-
const logFilePath = path13.resolve(logFile);
|
|
21803
|
-
await mkdir7(path13.dirname(logFilePath), { recursive: true }).catch(() => null);
|
|
21804
|
-
await writeFile7(logFilePath, terminalRender.render());
|
|
21805
|
-
}
|
|
21964
|
+
await saveDeprecatedLogFile(logFile, terminalRender.render(), verbose);
|
|
21806
21965
|
return { exitCode, logs: terminalRender.render() };
|
|
21807
|
-
async function sendEnter(waitms = 1000) {
|
|
21808
|
-
const st = Date.now();
|
|
21809
|
-
await idleWaiter.wait(waitms);
|
|
21810
|
-
const et = Date.now();
|
|
21811
|
-
logger.debug(`sendEn| idleWaiter.wait(${String(waitms)}) took ${String(et - st)}ms`);
|
|
21812
|
-
nextStdout.unready();
|
|
21813
|
-
shell.write("\r");
|
|
21814
|
-
await Promise.race([
|
|
21815
|
-
nextStdout.wait(),
|
|
21816
|
-
new Promise((resolve5) => setTimeout(() => {
|
|
21817
|
-
if (!nextStdout.ready) {
|
|
21818
|
-
shell.write("\r");
|
|
21819
|
-
}
|
|
21820
|
-
resolve5();
|
|
21821
|
-
}, 1000))
|
|
21822
|
-
]);
|
|
21823
|
-
await Promise.race([
|
|
21824
|
-
nextStdout.wait(),
|
|
21825
|
-
new Promise((resolve5) => setTimeout(() => {
|
|
21826
|
-
if (!nextStdout.ready) {
|
|
21827
|
-
shell.write("\r");
|
|
21828
|
-
}
|
|
21829
|
-
resolve5();
|
|
21830
|
-
}, 3000))
|
|
21831
|
-
]);
|
|
21832
|
-
}
|
|
21833
|
-
async function sendMessage3(message, { waitForReady = true } = {}) {
|
|
21834
|
-
if (waitForReady)
|
|
21835
|
-
await stdinReady.wait();
|
|
21836
|
-
logger.debug(`send |${message}`);
|
|
21837
|
-
nextStdout.unready();
|
|
21838
|
-
shell.write(message);
|
|
21839
|
-
idleWaiter.ping();
|
|
21840
|
-
logger.debug(`waiting next stdout|${message}`);
|
|
21841
|
-
await nextStdout.wait();
|
|
21842
|
-
logger.debug(`sending enter`);
|
|
21843
|
-
await sendEnter(1000);
|
|
21844
|
-
logger.debug(`sent enter`);
|
|
21845
|
-
}
|
|
21846
21966
|
async function exitAgent() {
|
|
21847
|
-
robust = false;
|
|
21967
|
+
ctx.robust = false;
|
|
21848
21968
|
for (const cmd of cliConf.exitCommands ?? ["/exit"])
|
|
21849
|
-
await sendMessage3(cmd);
|
|
21969
|
+
await sendMessage3(ctx.messageContext, cmd);
|
|
21850
21970
|
let exited = false;
|
|
21851
21971
|
await Promise.race([
|
|
21852
21972
|
pendingExitCode.promise.then(() => exited = true),
|
|
@@ -21858,19 +21978,11 @@ ${prompt}` : prefix;
|
|
|
21858
21978
|
}, 5000))
|
|
21859
21979
|
]);
|
|
21860
21980
|
}
|
|
21861
|
-
function getTerminalDimensions() {
|
|
21862
|
-
if (!process.stdout.isTTY)
|
|
21863
|
-
return { cols: 80, rows: 30 };
|
|
21864
|
-
return {
|
|
21865
|
-
cols: Math.min(Math.max(20, process.stdout.columns), 80),
|
|
21866
|
-
rows: process.stdout.rows
|
|
21867
|
-
};
|
|
21868
|
-
}
|
|
21869
21981
|
}
|
|
21870
21982
|
function sleep3(ms2) {
|
|
21871
21983
|
return new Promise((resolve5) => setTimeout(resolve5, ms2));
|
|
21872
21984
|
}
|
|
21873
|
-
var
|
|
21985
|
+
var config2, CLIS_CONFIG2;
|
|
21874
21986
|
var init_ts = __esm(async () => {
|
|
21875
21987
|
init_execa();
|
|
21876
21988
|
init_dist();
|
|
@@ -21881,8 +21993,15 @@ var init_ts = __esm(async () => {
|
|
|
21881
21993
|
init_logger();
|
|
21882
21994
|
init_fifo();
|
|
21883
21995
|
init_pidStore();
|
|
21884
|
-
|
|
21885
|
-
|
|
21996
|
+
init_messaging();
|
|
21997
|
+
init_logging();
|
|
21998
|
+
init_context();
|
|
21999
|
+
init_responders();
|
|
22000
|
+
init_streamHelpers();
|
|
22001
|
+
await __promiseAll([
|
|
22002
|
+
init_pty(),
|
|
22003
|
+
init_spawner()
|
|
22004
|
+
]);
|
|
21886
22005
|
config2 = await init_agent_yes_config().then(() => exports_agent_yes_config).then((mod) => mod.default || mod);
|
|
21887
22006
|
CLIS_CONFIG2 = config2.clis;
|
|
21888
22007
|
});
|
|
@@ -21897,11 +22016,18 @@ init_runningLock();
|
|
|
21897
22016
|
init_logger();
|
|
21898
22017
|
init_fifo();
|
|
21899
22018
|
init_pidStore();
|
|
21900
|
-
|
|
21901
|
-
|
|
22019
|
+
init_messaging();
|
|
22020
|
+
init_logging();
|
|
22021
|
+
init_context();
|
|
22022
|
+
init_responders();
|
|
22023
|
+
init_streamHelpers();
|
|
22024
|
+
await __promiseAll([
|
|
22025
|
+
init_pty(),
|
|
22026
|
+
init_spawner()
|
|
22027
|
+
]);
|
|
21902
22028
|
import { fromReadable as fromReadable2, fromWritable } from "from-node-stream";
|
|
21903
|
-
import { mkdir as
|
|
21904
|
-
import
|
|
22029
|
+
import { mkdir as mkdir6, readFile as readFile3, writeFile as writeFile5 } from "fs/promises";
|
|
22030
|
+
import path12 from "path";
|
|
21905
22031
|
var config = await init_agent_yes_config().then(() => exports_agent_yes_config).then((mod) => mod.default || mod);
|
|
21906
22032
|
var CLIS_CONFIG = config.clis;
|
|
21907
22033
|
async function agentYes({
|
|
@@ -21950,36 +22076,12 @@ async function agentYes({
|
|
|
21950
22076
|
const pidStore = new PidStore(workingDir);
|
|
21951
22077
|
await pidStore.init();
|
|
21952
22078
|
process.stdin.setRawMode?.(true);
|
|
21953
|
-
let isFatal = false;
|
|
21954
|
-
let shouldRestartWithoutContinue = false;
|
|
21955
|
-
const stdinReady = new ReadyManager;
|
|
21956
|
-
const stdinFirstReady = new ReadyManager;
|
|
21957
|
-
sleep2(1e4).then(() => {
|
|
21958
|
-
if (!stdinReady.isReady)
|
|
21959
|
-
stdinReady.ready();
|
|
21960
|
-
if (!stdinFirstReady.isReady)
|
|
21961
|
-
stdinFirstReady.ready();
|
|
21962
|
-
});
|
|
21963
|
-
const nextStdout = new ReadyManager;
|
|
21964
22079
|
const shellOutputStream = new TransformStream;
|
|
21965
22080
|
const outputWriter = shellOutputStream.writable.getWriter();
|
|
21966
22081
|
logger.debug(`Using ${ptyPackage} for pseudo terminal management.`);
|
|
21967
|
-
let logPath = false;
|
|
21968
|
-
let rawLogPath = false;
|
|
21969
|
-
let rawLinesLogPath = false;
|
|
21970
|
-
let debuggingLogsPath = false;
|
|
21971
22082
|
const isSubAgent = !!process.env.CLAUDE_PPID;
|
|
21972
22083
|
if (isSubAgent)
|
|
21973
22084
|
logger.info(`[${cli}-yes] Running as sub-agent (CLAUDE_PPID=${process.env.CLAUDE_PPID})`);
|
|
21974
|
-
const getPtyOptions = () => {
|
|
21975
|
-
const ptyEnv = { ...env ?? process.env };
|
|
21976
|
-
return {
|
|
21977
|
-
name: "xterm-color",
|
|
21978
|
-
...getTerminalDimensions(),
|
|
21979
|
-
cwd: cwd ?? process.cwd(),
|
|
21980
|
-
env: ptyEnv
|
|
21981
|
-
};
|
|
21982
|
-
};
|
|
21983
22085
|
const cliConf = CLIS_CONFIG[cli] || {};
|
|
21984
22086
|
cliArgs = cliConf.defaultArgs ? [...cliConf.defaultArgs, ...cliArgs] : cliArgs;
|
|
21985
22087
|
try {
|
|
@@ -21997,9 +22099,9 @@ async function agentYes({
|
|
|
21997
22099
|
} catch {}
|
|
21998
22100
|
const skillHeaders = [];
|
|
21999
22101
|
let currentDir = workingDir2;
|
|
22000
|
-
const searchLimit = gitRoot ||
|
|
22102
|
+
const searchLimit = gitRoot || path12.parse(currentDir).root;
|
|
22001
22103
|
while (true) {
|
|
22002
|
-
const skillPath =
|
|
22104
|
+
const skillPath = path12.resolve(currentDir, "SKILL.md");
|
|
22003
22105
|
const md = await readFile3(skillPath, "utf8").catch(() => null);
|
|
22004
22106
|
if (md) {
|
|
22005
22107
|
const headerMatch = md.match(/^[\s\S]*?(?=\n##\s)/);
|
|
@@ -22012,7 +22114,7 @@ async function agentYes({
|
|
|
22012
22114
|
}
|
|
22013
22115
|
if (currentDir === searchLimit)
|
|
22014
22116
|
break;
|
|
22015
|
-
const parentDir =
|
|
22117
|
+
const parentDir = path12.dirname(currentDir);
|
|
22016
22118
|
if (parentDir === currentDir)
|
|
22017
22119
|
break;
|
|
22018
22120
|
currentDir = parentDir;
|
|
@@ -22075,93 +22177,54 @@ ${prompt}` : prefix;
|
|
|
22075
22177
|
logger.warn(`Unknown promptArg format: ${cliConf.promptArg}`);
|
|
22076
22178
|
}
|
|
22077
22179
|
}
|
|
22078
|
-
const
|
|
22079
|
-
|
|
22080
|
-
|
|
22081
|
-
|
|
22082
|
-
|
|
22083
|
-
|
|
22084
|
-
if (installConfig[platform3]) {
|
|
22085
|
-
return installConfig[platform3];
|
|
22086
|
-
}
|
|
22087
|
-
if (isWindows && installConfig.powershell) {
|
|
22088
|
-
return installConfig.powershell;
|
|
22089
|
-
}
|
|
22090
|
-
if (!isWindows && installConfig.bash) {
|
|
22091
|
-
return installConfig.bash;
|
|
22092
|
-
}
|
|
22093
|
-
if (installConfig.npm) {
|
|
22094
|
-
return installConfig.npm;
|
|
22095
|
-
}
|
|
22096
|
-
return null;
|
|
22097
|
-
};
|
|
22098
|
-
const spawn2 = () => {
|
|
22099
|
-
const cliCommand = cliConf?.binary || cli;
|
|
22100
|
-
let [bin, ...args] = [...parseCommandString(cliCommand), ...cliArgs];
|
|
22101
|
-
if (verbose)
|
|
22102
|
-
logger.info(`Spawning ${bin} with args: ${JSON.stringify(args)}`);
|
|
22103
|
-
logger.info(`Spawning ${bin} with args: ${JSON.stringify(args)}`);
|
|
22104
|
-
const spawned = pty_default.spawn(bin, args, getPtyOptions());
|
|
22105
|
-
logger.info(`[${cli}-yes] Spawned ${bin} with PID ${spawned.pid}`);
|
|
22106
|
-
return spawned;
|
|
22180
|
+
const ptyEnv = { ...env ?? process.env };
|
|
22181
|
+
const ptyOptions = {
|
|
22182
|
+
name: "xterm-color",
|
|
22183
|
+
...getTerminalDimensions(),
|
|
22184
|
+
cwd: cwd ?? process.cwd(),
|
|
22185
|
+
env: ptyEnv
|
|
22107
22186
|
};
|
|
22108
|
-
let shell =
|
|
22109
|
-
|
|
22110
|
-
|
|
22111
|
-
|
|
22112
|
-
|
|
22113
|
-
|
|
22114
|
-
|
|
22115
|
-
|
|
22116
|
-
}
|
|
22117
|
-
logger.info(`Please install the cli by run ${installCmd}`);
|
|
22118
|
-
if (install) {
|
|
22119
|
-
logger.info(`Attempting to install ${cli}...`);
|
|
22120
|
-
execaCommandSync(installCmd, { stdio: "inherit" });
|
|
22121
|
-
logger.info(`${cli} installed successfully. Please rerun the command.`);
|
|
22122
|
-
return spawn2();
|
|
22123
|
-
} else {
|
|
22124
|
-
logger.error(`If you did not installed it yet, Please install it first: ${installCmd}`);
|
|
22125
|
-
throw error;
|
|
22126
|
-
}
|
|
22127
|
-
}
|
|
22128
|
-
if (globalThis.Bun && error instanceof Error && error.stack?.includes("bun-pty")) {
|
|
22129
|
-
logger.error(`Detected bun-pty issue, attempted to fix it. Please try again.`);
|
|
22130
|
-
init_pty_fix();
|
|
22131
|
-
}
|
|
22132
|
-
throw error;
|
|
22133
|
-
function isCommandNotFoundError(e) {
|
|
22134
|
-
if (e instanceof Error) {
|
|
22135
|
-
return e.message.includes("command not found") || e.message.includes("ENOENT") || e.message.includes("spawn");
|
|
22136
|
-
}
|
|
22137
|
-
return false;
|
|
22138
|
-
}
|
|
22139
|
-
}, spawn2)();
|
|
22187
|
+
let shell = spawnAgent({
|
|
22188
|
+
cli,
|
|
22189
|
+
cliConf,
|
|
22190
|
+
cliArgs,
|
|
22191
|
+
verbose,
|
|
22192
|
+
install,
|
|
22193
|
+
ptyOptions
|
|
22194
|
+
});
|
|
22140
22195
|
await pidStore.registerProcess({ pid: shell.pid, cli, args: cliArgs, prompt });
|
|
22141
|
-
|
|
22142
|
-
|
|
22143
|
-
|
|
22144
|
-
|
|
22145
|
-
|
|
22146
|
-
|
|
22147
|
-
|
|
22148
|
-
|
|
22149
|
-
|
|
22196
|
+
const logPaths = initializeLogPaths(pidStore, shell.pid);
|
|
22197
|
+
setupDebugLogging(logPaths.debuggingLogsPath);
|
|
22198
|
+
const ctx = new AgentContext({
|
|
22199
|
+
shell,
|
|
22200
|
+
pidStore,
|
|
22201
|
+
logPaths,
|
|
22202
|
+
cli,
|
|
22203
|
+
cliConf,
|
|
22204
|
+
verbose,
|
|
22205
|
+
robust
|
|
22206
|
+
});
|
|
22207
|
+
sleep2(1e4).then(() => {
|
|
22208
|
+
if (!ctx.stdinReady.isReady)
|
|
22209
|
+
ctx.stdinReady.ready();
|
|
22210
|
+
if (!ctx.stdinFirstReady.isReady)
|
|
22211
|
+
ctx.stdinFirstReady.ready();
|
|
22212
|
+
});
|
|
22150
22213
|
const pendingExitCode = Promise.withResolvers();
|
|
22151
22214
|
async function onData(data) {
|
|
22152
22215
|
await outputWriter.write(data);
|
|
22153
22216
|
}
|
|
22154
22217
|
shell.onData(onData);
|
|
22155
22218
|
shell.onExit(async function onExit({ exitCode: exitCode2 }) {
|
|
22156
|
-
stdinReady.unready();
|
|
22219
|
+
ctx.stdinReady.unready();
|
|
22157
22220
|
const agentCrashed = exitCode2 !== 0;
|
|
22158
|
-
if (shouldRestartWithoutContinue) {
|
|
22221
|
+
if (ctx.shouldRestartWithoutContinue) {
|
|
22159
22222
|
await pidStore.updateStatus(shell.pid, "exited", {
|
|
22160
22223
|
exitReason: "restarted",
|
|
22161
22224
|
exitCode: exitCode2 ?? undefined
|
|
22162
22225
|
});
|
|
22163
|
-
shouldRestartWithoutContinue = false;
|
|
22164
|
-
isFatal = false;
|
|
22226
|
+
ctx.shouldRestartWithoutContinue = false;
|
|
22227
|
+
ctx.isFatal = false;
|
|
22165
22228
|
const cliCommand = cliConf?.binary || cli;
|
|
22166
22229
|
let [bin, ...args] = [
|
|
22167
22230
|
...parseCommandString(cliCommand),
|
|
@@ -22179,7 +22242,7 @@ ${prompt}` : prefix;
|
|
|
22179
22242
|
logger.warn(`robust is only supported for ${Object.entries(CLIS_CONFIG).filter(([_, v]) => v.restoreArgs).map(([k]) => k).join(", ")} currently, not ${cli}`);
|
|
22180
22243
|
return;
|
|
22181
22244
|
}
|
|
22182
|
-
if (isFatal) {
|
|
22245
|
+
if (ctx.isFatal) {
|
|
22183
22246
|
await pidStore.updateStatus(shell.pid, "exited", {
|
|
22184
22247
|
exitReason: "fatal",
|
|
22185
22248
|
exitCode: exitCode2 ?? undefined
|
|
@@ -22220,9 +22283,8 @@ ${prompt}` : prefix;
|
|
|
22220
22283
|
});
|
|
22221
22284
|
const terminalRender = new TerminalTextRender;
|
|
22222
22285
|
const isStillWorkingQ = () => terminalRender.render().replace(/\s+/g, " ").match(/esc to interrupt|to run in background/);
|
|
22223
|
-
const idleWaiter = new IdleWaiter;
|
|
22224
22286
|
if (exitOnIdle)
|
|
22225
|
-
idleWaiter.wait(exitOnIdle).then(async () => {
|
|
22287
|
+
ctx.idleWaiter.wait(exitOnIdle).then(async () => {
|
|
22226
22288
|
await pidStore.updateStatus(shell.pid, "idle").catch(() => null);
|
|
22227
22289
|
if (isStillWorkingQ()) {
|
|
22228
22290
|
logger.warn("[${cli}-yes] ${cli} is idle, but seems still working, not exiting yet");
|
|
@@ -22232,20 +22294,11 @@ ${prompt}` : prefix;
|
|
|
22232
22294
|
await exitAgent();
|
|
22233
22295
|
});
|
|
22234
22296
|
await src_default(fromReadable2(process.stdin)).map((buffer2) => buffer2.toString()).by(function handleTerminateSignals(s) {
|
|
22235
|
-
|
|
22236
|
-
|
|
22237
|
-
|
|
22238
|
-
return "";
|
|
22239
|
-
}
|
|
22240
|
-
if (!aborted2 && !stdinReady.isReady && chunk === "\x03") {
|
|
22241
|
-
logger.error("User aborted: SIGINT");
|
|
22242
|
-
shell.kill("SIGINT");
|
|
22243
|
-
pendingExitCode.resolve(130);
|
|
22244
|
-
aborted2 = true;
|
|
22245
|
-
return chunk;
|
|
22246
|
-
}
|
|
22247
|
-
return chunk;
|
|
22297
|
+
const handler = createTerminateSignalHandler(ctx.stdinReady, (exitCode2) => {
|
|
22298
|
+
shell.kill("SIGINT");
|
|
22299
|
+
pendingExitCode.resolve(exitCode2);
|
|
22248
22300
|
});
|
|
22301
|
+
return s.map(handler);
|
|
22249
22302
|
}).by((s) => {
|
|
22250
22303
|
if (!useFifo)
|
|
22251
22304
|
return s;
|
|
@@ -22261,154 +22314,49 @@ ${prompt}` : prefix;
|
|
|
22261
22314
|
}).onStart(async function promptOnStart() {
|
|
22262
22315
|
logger.debug("Sending prompt message: " + JSON.stringify(prompt));
|
|
22263
22316
|
if (prompt)
|
|
22264
|
-
await sendMessage3(prompt);
|
|
22317
|
+
await sendMessage3(ctx.messageContext, prompt);
|
|
22265
22318
|
}).by({
|
|
22266
22319
|
writable: new WritableStream({
|
|
22267
22320
|
write: async (data) => {
|
|
22268
|
-
await stdinReady.wait();
|
|
22321
|
+
await ctx.stdinReady.wait();
|
|
22269
22322
|
shell.write(data);
|
|
22270
22323
|
}
|
|
22271
22324
|
}),
|
|
22272
22325
|
readable: shellOutputStream.readable
|
|
22273
22326
|
}).forEach(() => {
|
|
22274
|
-
idleWaiter.ping();
|
|
22327
|
+
ctx.idleWaiter.ping();
|
|
22275
22328
|
pidStore.updateStatus(shell.pid, "active").catch(() => null);
|
|
22276
|
-
}).forEach(() => nextStdout.ready()).forkTo(async function rawLogger(f) {
|
|
22277
|
-
if (!rawLogPath)
|
|
22329
|
+
}).forEach(() => ctx.nextStdout.ready()).forkTo(async function rawLogger(f) {
|
|
22330
|
+
if (!ctx.logPaths.rawLogPath)
|
|
22278
22331
|
return f.run();
|
|
22279
|
-
return await
|
|
22280
|
-
logger.debug(`[${cli}-yes] raw logs streaming to ${rawLogPath}`);
|
|
22332
|
+
return await mkdir6(path12.dirname(ctx.logPaths.rawLogPath), { recursive: true }).then(() => {
|
|
22333
|
+
logger.debug(`[${cli}-yes] raw logs streaming to ${ctx.logPaths.rawLogPath}`);
|
|
22281
22334
|
return f.forEach(async (chars) => {
|
|
22282
|
-
await
|
|
22335
|
+
await writeFile5(ctx.logPaths.rawLogPath, chars, { flag: "a" }).catch(() => null);
|
|
22283
22336
|
}).run();
|
|
22284
22337
|
}).catch(() => f.run());
|
|
22285
22338
|
}).by(function consoleResponder(e) {
|
|
22286
22339
|
if (cli === "codex")
|
|
22287
22340
|
shell.write(`\x1B[1;1R`);
|
|
22288
|
-
return e.forEach((text) =>
|
|
22289
|
-
terminalRender.write(text);
|
|
22290
|
-
if (text.includes("\x1B[c") || text.includes("\x1B[0c")) {
|
|
22291
|
-
shell.write("\x1B[?1;2c");
|
|
22292
|
-
if (verbose) {
|
|
22293
|
-
logger.debug("device|respond DA: VT100 with Advanced Video Option");
|
|
22294
|
-
}
|
|
22295
|
-
return;
|
|
22296
|
-
}
|
|
22297
|
-
if (process.stdin.isTTY)
|
|
22298
|
-
return;
|
|
22299
|
-
if (!text.includes("\x1B[6n"))
|
|
22300
|
-
return;
|
|
22301
|
-
const { col, row } = terminalRender.getCursorPosition();
|
|
22302
|
-
shell.write(`\x1B[${row};${col}R`);
|
|
22303
|
-
logger.debug(`cursor|respond position: row=${String(row)}, col=${String(col)}`);
|
|
22304
|
-
});
|
|
22341
|
+
return e.forEach((text) => handleConsoleControlCodes(text, shell, terminalRender, cli, verbose));
|
|
22305
22342
|
}).forkTo(function autoResponse(e) {
|
|
22306
22343
|
return e.map((e2) => removeControlCharacters(e2)).by((s) => {
|
|
22307
22344
|
if (conf.noEOL)
|
|
22308
22345
|
return s;
|
|
22309
22346
|
return s.lines({ EOL: "NONE" });
|
|
22310
|
-
}).forEach(async
|
|
22311
|
-
|
|
22312
|
-
|
|
22313
|
-
logger.debug(`ready |${e2}`);
|
|
22314
|
-
if (cli === "gemini" && i2 <= 80)
|
|
22315
|
-
return;
|
|
22316
|
-
stdinReady.ready();
|
|
22317
|
-
stdinFirstReady.ready();
|
|
22318
|
-
}
|
|
22319
|
-
if (conf.enter?.some((rx) => e2.match(rx))) {
|
|
22320
|
-
logger.debug(`enter |${e2}`);
|
|
22321
|
-
return await sendEnter(400);
|
|
22322
|
-
}
|
|
22323
|
-
const typingResponded = await src_default(Object.entries(conf.typingRespond ?? {})).filter(([_sendString, onThePatterns]) => onThePatterns.some((rx) => e2.match(rx))).map(async ([sendString]) => await sendMessage3(sendString, { waitForReady: false })).toCount();
|
|
22324
|
-
if (typingResponded)
|
|
22325
|
-
return;
|
|
22326
|
-
if (conf.fatal?.some((rx) => e2.match(rx))) {
|
|
22327
|
-
logger.debug(`fatal |${e2}`);
|
|
22328
|
-
isFatal = true;
|
|
22329
|
-
await exitAgent();
|
|
22330
|
-
}
|
|
22331
|
-
if (conf.restartWithoutContinueArg?.some((rx) => e2.match(rx))) {
|
|
22332
|
-
await logger.debug(`restart-without-continue|${e2}`);
|
|
22333
|
-
shouldRestartWithoutContinue = true;
|
|
22334
|
-
isFatal = true;
|
|
22335
|
-
await exitAgent();
|
|
22336
|
-
}
|
|
22337
|
-
if (cli === "codex") {
|
|
22338
|
-
const sessionId = extractSessionId(e2);
|
|
22339
|
-
if (sessionId) {
|
|
22340
|
-
await logger.debug(`session|captured session ID: ${sessionId}`);
|
|
22341
|
-
await storeSessionForCwd(workingDir, sessionId);
|
|
22342
|
-
}
|
|
22343
|
-
}
|
|
22344
|
-
}).run();
|
|
22345
|
-
}).by((s) => removeControlCharactersFromStdout ? s.map((e) => removeControlCharacters(e)) : s).by(new TransformStream({
|
|
22346
|
-
start: function terminator(ctrl) {
|
|
22347
|
-
pendingExitCode.promise.then(() => ctrl.terminate());
|
|
22348
|
-
},
|
|
22349
|
-
transform: (e, ctrl) => ctrl.enqueue(e),
|
|
22350
|
-
flush: (ctrl) => ctrl.terminate()
|
|
22351
|
-
})).to(fromWritable(process.stdout));
|
|
22352
|
-
if (logPath) {
|
|
22353
|
-
await mkdir5(path11.dirname(logPath), { recursive: true }).catch(() => null);
|
|
22354
|
-
await writeFile4(logPath, terminalRender.render()).catch(() => null);
|
|
22355
|
-
logger.info(`[${cli}-yes] Full logs saved to ${logPath}`);
|
|
22356
|
-
}
|
|
22347
|
+
}).forEach(async (line, lineIndex) => createAutoResponseHandler(line, lineIndex, { ctx, conf, cli, workingDir, exitAgent })).run();
|
|
22348
|
+
}).by((s) => removeControlCharactersFromStdout ? s.map((e) => removeControlCharacters(e)) : s).by(createTerminatorStream(pendingExitCode.promise)).to(fromWritable(process.stdout));
|
|
22349
|
+
await saveLogFile(ctx.logPaths.logPath, terminalRender.render());
|
|
22357
22350
|
const exitCode = await pendingExitCode.promise;
|
|
22358
22351
|
logger.info(`[${cli}-yes] ${cli} exited with code ${exitCode}`);
|
|
22359
22352
|
await pidStore.close();
|
|
22360
22353
|
await outputWriter.close();
|
|
22361
|
-
|
|
22362
|
-
if (verbose)
|
|
22363
|
-
logger.info(`[${cli}-yes] Writing rendered logs to ${logFile}`);
|
|
22364
|
-
const logFilePath = path11.resolve(logFile);
|
|
22365
|
-
await mkdir5(path11.dirname(logFilePath), { recursive: true }).catch(() => null);
|
|
22366
|
-
await writeFile4(logFilePath, terminalRender.render());
|
|
22367
|
-
}
|
|
22354
|
+
await saveDeprecatedLogFile(logFile, terminalRender.render(), verbose);
|
|
22368
22355
|
return { exitCode, logs: terminalRender.render() };
|
|
22369
|
-
async function sendEnter(waitms = 1000) {
|
|
22370
|
-
const st = Date.now();
|
|
22371
|
-
await idleWaiter.wait(waitms);
|
|
22372
|
-
const et = Date.now();
|
|
22373
|
-
logger.debug(`sendEn| idleWaiter.wait(${String(waitms)}) took ${String(et - st)}ms`);
|
|
22374
|
-
nextStdout.unready();
|
|
22375
|
-
shell.write("\r");
|
|
22376
|
-
await Promise.race([
|
|
22377
|
-
nextStdout.wait(),
|
|
22378
|
-
new Promise((resolve) => setTimeout(() => {
|
|
22379
|
-
if (!nextStdout.ready) {
|
|
22380
|
-
shell.write("\r");
|
|
22381
|
-
}
|
|
22382
|
-
resolve();
|
|
22383
|
-
}, 1000))
|
|
22384
|
-
]);
|
|
22385
|
-
await Promise.race([
|
|
22386
|
-
nextStdout.wait(),
|
|
22387
|
-
new Promise((resolve) => setTimeout(() => {
|
|
22388
|
-
if (!nextStdout.ready) {
|
|
22389
|
-
shell.write("\r");
|
|
22390
|
-
}
|
|
22391
|
-
resolve();
|
|
22392
|
-
}, 3000))
|
|
22393
|
-
]);
|
|
22394
|
-
}
|
|
22395
|
-
async function sendMessage3(message, { waitForReady = true } = {}) {
|
|
22396
|
-
if (waitForReady)
|
|
22397
|
-
await stdinReady.wait();
|
|
22398
|
-
logger.debug(`send |${message}`);
|
|
22399
|
-
nextStdout.unready();
|
|
22400
|
-
shell.write(message);
|
|
22401
|
-
idleWaiter.ping();
|
|
22402
|
-
logger.debug(`waiting next stdout|${message}`);
|
|
22403
|
-
await nextStdout.wait();
|
|
22404
|
-
logger.debug(`sending enter`);
|
|
22405
|
-
await sendEnter(1000);
|
|
22406
|
-
logger.debug(`sent enter`);
|
|
22407
|
-
}
|
|
22408
22356
|
async function exitAgent() {
|
|
22409
|
-
robust = false;
|
|
22357
|
+
ctx.robust = false;
|
|
22410
22358
|
for (const cmd of cliConf.exitCommands ?? ["/exit"])
|
|
22411
|
-
await sendMessage3(cmd);
|
|
22359
|
+
await sendMessage3(ctx.messageContext, cmd);
|
|
22412
22360
|
let exited = false;
|
|
22413
22361
|
await Promise.race([
|
|
22414
22362
|
pendingExitCode.promise.then(() => exited = true),
|
|
@@ -22420,14 +22368,6 @@ ${prompt}` : prefix;
|
|
|
22420
22368
|
}, 5000))
|
|
22421
22369
|
]);
|
|
22422
22370
|
}
|
|
22423
|
-
function getTerminalDimensions() {
|
|
22424
|
-
if (!process.stdout.isTTY)
|
|
22425
|
-
return { cols: 80, rows: 30 };
|
|
22426
|
-
return {
|
|
22427
|
-
cols: Math.min(Math.max(20, process.stdout.columns), 80),
|
|
22428
|
-
rows: process.stdout.rows
|
|
22429
|
-
};
|
|
22430
|
-
}
|
|
22431
22371
|
}
|
|
22432
22372
|
function sleep2(ms) {
|
|
22433
22373
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -24175,11 +24115,11 @@ var parser = new YargsParser({
|
|
|
24175
24115
|
format: format2,
|
|
24176
24116
|
normalize,
|
|
24177
24117
|
resolve: resolve2,
|
|
24178
|
-
require: (
|
|
24118
|
+
require: (path13) => {
|
|
24179
24119
|
if (typeof require2 !== "undefined") {
|
|
24180
|
-
return require2(
|
|
24181
|
-
} else if (
|
|
24182
|
-
return JSON.parse(readFileSync3(
|
|
24120
|
+
return require2(path13);
|
|
24121
|
+
} else if (path13.match(/\.json$/)) {
|
|
24122
|
+
return JSON.parse(readFileSync3(path13, "utf8"));
|
|
24183
24123
|
} else {
|
|
24184
24124
|
throw Error("only .json config files are supported in ESM");
|
|
24185
24125
|
}
|
|
@@ -24269,13 +24209,13 @@ function stringWidth3(string, options = {}) {
|
|
|
24269
24209
|
}
|
|
24270
24210
|
|
|
24271
24211
|
// node_modules/y18n/build/lib/platform-shims/node.js
|
|
24272
|
-
import { readFileSync as readFileSync4, statSync as statSync3, writeFile as
|
|
24212
|
+
import { readFileSync as readFileSync4, statSync as statSync3, writeFile as writeFile6 } from "fs";
|
|
24273
24213
|
import { format as format3 } from "util";
|
|
24274
24214
|
import { resolve as resolve3 } from "path";
|
|
24275
24215
|
var node_default = {
|
|
24276
24216
|
fs: {
|
|
24277
24217
|
readFileSync: readFileSync4,
|
|
24278
|
-
writeFile:
|
|
24218
|
+
writeFile: writeFile6
|
|
24279
24219
|
},
|
|
24280
24220
|
format: format3,
|
|
24281
24221
|
resolve: resolve3,
|
|
@@ -27900,6 +27840,8 @@ var package_default = {
|
|
|
27900
27840
|
postbuild: "bun ./ts/postbuild.ts",
|
|
27901
27841
|
demo: "bun run build && bun link && claude-yes -- demo",
|
|
27902
27842
|
dev: "bun ts/index.ts",
|
|
27843
|
+
"dev:tsgo": "tsgo ts/cli.ts",
|
|
27844
|
+
"test:tsgo": "tsgo --test",
|
|
27903
27845
|
fmt: "oxlint --fix --fix-suggestions && oxfmt",
|
|
27904
27846
|
_prepack: "bun run build",
|
|
27905
27847
|
prepare: "husky",
|
|
@@ -27919,12 +27861,13 @@ var package_default = {
|
|
|
27919
27861
|
"@semantic-release/exec": "^7.1.0",
|
|
27920
27862
|
"@semantic-release/git": "^10.0.1",
|
|
27921
27863
|
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
27864
|
+
"@types/better-sqlite3": "^7.6.12",
|
|
27922
27865
|
"@types/bun": "^1.3.6",
|
|
27923
27866
|
"@types/jest": "^30.0.0",
|
|
27924
27867
|
"@types/ms": "^2.1.0",
|
|
27925
|
-
"@types/better-sqlite3": "^7.6.12",
|
|
27926
27868
|
"@types/node": "^25.0.10",
|
|
27927
27869
|
"@types/yargs": "^17.0.35",
|
|
27870
|
+
"@typescript/native-preview": "^7.0.0-dev.20260124.1",
|
|
27928
27871
|
"cpu-wait": "^0.0.10",
|
|
27929
27872
|
execa: "^9.6.1",
|
|
27930
27873
|
husky: "^9.1.7",
|
|
@@ -27959,26 +27902,6 @@ var package_default = {
|
|
|
27959
27902
|
},
|
|
27960
27903
|
engines: {
|
|
27961
27904
|
node: ">=22.0.0"
|
|
27962
|
-
},
|
|
27963
|
-
_release: {
|
|
27964
|
-
branches: [
|
|
27965
|
-
"main"
|
|
27966
|
-
],
|
|
27967
|
-
plugins: [
|
|
27968
|
-
"@semantic-release/commit-analyzer",
|
|
27969
|
-
"@semantic-release/release-notes-generator",
|
|
27970
|
-
"@semantic-release/changelog",
|
|
27971
|
-
"@semantic-release/npm",
|
|
27972
|
-
[
|
|
27973
|
-
"@semantic-release/exec",
|
|
27974
|
-
{
|
|
27975
|
-
publishCmd: "npm pkg set name=claude-yes"
|
|
27976
|
-
}
|
|
27977
|
-
],
|
|
27978
|
-
"@semantic-release/npm",
|
|
27979
|
-
"@semantic-release/git",
|
|
27980
|
-
"@semantic-release/github"
|
|
27981
|
-
]
|
|
27982
27905
|
}
|
|
27983
27906
|
};
|
|
27984
27907
|
|
|
@@ -28111,7 +28034,7 @@ function parseCliArgs(argv) {
|
|
|
28111
28034
|
resume: parsedArgv.continue,
|
|
28112
28035
|
useSkills: parsedArgv.useSkills,
|
|
28113
28036
|
appendPrompt: parsedArgv.appendPrompt,
|
|
28114
|
-
useFifo: parsedArgv.stdpush || parsedArgv.ipc || parsedArgv.fifo
|
|
28037
|
+
useFifo: Boolean(parsedArgv.stdpush || parsedArgv.ipc || parsedArgv.fifo)
|
|
28115
28038
|
};
|
|
28116
28039
|
}
|
|
28117
28040
|
|
|
@@ -28134,8 +28057,8 @@ var logger2 = import_winston3.default.createLogger({
|
|
|
28134
28057
|
|
|
28135
28058
|
// ts/pidStore.ts
|
|
28136
28059
|
init_logger();
|
|
28137
|
-
import { mkdir as
|
|
28138
|
-
import
|
|
28060
|
+
import { mkdir as mkdir7, writeFile as writeFile7 } from "fs/promises";
|
|
28061
|
+
import path13 from "path";
|
|
28139
28062
|
|
|
28140
28063
|
class SqliteAdapter2 {
|
|
28141
28064
|
db;
|
|
@@ -28181,12 +28104,12 @@ class PidStore2 {
|
|
|
28181
28104
|
storeDir;
|
|
28182
28105
|
dbPath;
|
|
28183
28106
|
constructor(workingDir) {
|
|
28184
|
-
this.storeDir =
|
|
28185
|
-
this.dbPath =
|
|
28107
|
+
this.storeDir = path13.resolve(workingDir, ".agent-yes");
|
|
28108
|
+
this.dbPath = path13.join(this.storeDir, "pid.sqlite");
|
|
28186
28109
|
}
|
|
28187
28110
|
async init() {
|
|
28188
|
-
await
|
|
28189
|
-
await
|
|
28111
|
+
await mkdir7(path13.join(this.storeDir, "logs"), { recursive: true });
|
|
28112
|
+
await mkdir7(path13.join(this.storeDir, "fifo"), { recursive: true });
|
|
28190
28113
|
await this.ensureGitignore();
|
|
28191
28114
|
this.db = new SqliteAdapter2;
|
|
28192
28115
|
await this.db.init(this.dbPath);
|
|
@@ -28259,13 +28182,13 @@ class PidStore2 {
|
|
|
28259
28182
|
logger.debug(`[pidStore] Updated process ${pid} status=${status}`);
|
|
28260
28183
|
}
|
|
28261
28184
|
getLogPath(pid) {
|
|
28262
|
-
return
|
|
28185
|
+
return path13.resolve(this.storeDir, "logs", `${pid}.log`);
|
|
28263
28186
|
}
|
|
28264
28187
|
getFifoPath(pid) {
|
|
28265
28188
|
if (process.platform === "win32") {
|
|
28266
28189
|
return `\\\\.\\pipe\\agent-yes-${pid}`;
|
|
28267
28190
|
} else {
|
|
28268
|
-
return
|
|
28191
|
+
return path13.resolve(this.storeDir, "fifo", `${pid}.stdin`);
|
|
28269
28192
|
}
|
|
28270
28193
|
}
|
|
28271
28194
|
async cleanStaleRecords() {
|
|
@@ -28296,7 +28219,7 @@ class PidStore2 {
|
|
|
28296
28219
|
}
|
|
28297
28220
|
}
|
|
28298
28221
|
async ensureGitignore() {
|
|
28299
|
-
const gitignorePath =
|
|
28222
|
+
const gitignorePath = path13.join(this.storeDir, ".gitignore");
|
|
28300
28223
|
const gitignoreContent = `# Auto-generated .gitignore for agent-yes
|
|
28301
28224
|
# Ignore all log files and runtime data
|
|
28302
28225
|
logs/
|
|
@@ -28307,9 +28230,13 @@ fifo/
|
|
|
28307
28230
|
*.raw.log
|
|
28308
28231
|
*.lines.log
|
|
28309
28232
|
*.debug.log
|
|
28233
|
+
|
|
28234
|
+
# Ignore .gitignore itself
|
|
28235
|
+
.gitignore
|
|
28236
|
+
|
|
28310
28237
|
`;
|
|
28311
28238
|
try {
|
|
28312
|
-
await
|
|
28239
|
+
await writeFile7(gitignorePath, gitignoreContent, { flag: "wx" });
|
|
28313
28240
|
logger.debug(`[pidStore] Created .gitignore in ${this.storeDir}`);
|
|
28314
28241
|
} catch (error) {
|
|
28315
28242
|
if (error.code !== "EEXIST") {
|
|
@@ -28381,5 +28308,5 @@ var { exitCode } = await cliYes(config3);
|
|
|
28381
28308
|
console.log("exiting process");
|
|
28382
28309
|
process.exit(exitCode ?? 1);
|
|
28383
28310
|
|
|
28384
|
-
//# debugId=
|
|
28311
|
+
//# debugId=EF385FA0B765507364756E2164756E21
|
|
28385
28312
|
//# sourceMappingURL=cli.js.map
|