agent-yes 1.42.0 → 1.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +22 -135
- package/dist/index.js +11 -10
- package/package.json +2 -19
- package/ts/cli.ts +3 -3
- package/ts/parseCliArgs.spec.ts +1 -6
- package/ts/parseCliArgs.ts +3 -1
- package/ts/pidStore.ts +2 -0
- package/ts/runningLock.ts +1 -1
- package/ts/agent.ts +0 -194
- package/ts/graph_wip.ts +0 -79
- package/ts/signleton.ts +0 -7
- package/ts/sleep.ts +0 -3
package/dist/cli.js
CHANGED
|
@@ -2885,7 +2885,7 @@ var init_ponyfill = __esm(() => {
|
|
|
2885
2885
|
init_fromAnyIterable();
|
|
2886
2886
|
});
|
|
2887
2887
|
|
|
2888
|
-
// node_modules/
|
|
2888
|
+
// node_modules/get-stream/source/stream.js
|
|
2889
2889
|
var getAsyncIterable = (stream) => {
|
|
2890
2890
|
if (isReadableStream(stream, { checkOpen: false }) && nodeImports.on !== undefined) {
|
|
2891
2891
|
return getStreamIterable(stream);
|
|
@@ -2934,7 +2934,7 @@ var init_stream = __esm(() => {
|
|
|
2934
2934
|
nodeImports = {};
|
|
2935
2935
|
});
|
|
2936
2936
|
|
|
2937
|
-
// node_modules/
|
|
2937
|
+
// node_modules/get-stream/source/contents.js
|
|
2938
2938
|
var getStreamContents = async (stream, { init, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, finalize }, { maxBuffer = Number.POSITIVE_INFINITY } = {}) => {
|
|
2939
2939
|
const asyncIterable = getAsyncIterable(stream);
|
|
2940
2940
|
const state = init();
|
|
@@ -3028,14 +3028,14 @@ var init_contents = __esm(() => {
|
|
|
3028
3028
|
};
|
|
3029
3029
|
});
|
|
3030
3030
|
|
|
3031
|
-
// node_modules/
|
|
3031
|
+
// node_modules/get-stream/source/utils.js
|
|
3032
3032
|
var identity2 = (value) => value, noop = () => {
|
|
3033
3033
|
return;
|
|
3034
3034
|
}, getContentsProperty = ({ contents }) => contents, throwObjectStream = (chunk) => {
|
|
3035
3035
|
throw new Error(`Streams in object mode are not supported: ${String(chunk)}`);
|
|
3036
3036
|
}, getLengthProperty = (convertedChunk) => convertedChunk.length;
|
|
3037
3037
|
|
|
3038
|
-
// node_modules/
|
|
3038
|
+
// node_modules/get-stream/source/array.js
|
|
3039
3039
|
async function getStreamAsArray(stream, options) {
|
|
3040
3040
|
return getStreamContents(stream, arrayMethods, options);
|
|
3041
3041
|
}
|
|
@@ -3063,7 +3063,7 @@ var init_array = __esm(() => {
|
|
|
3063
3063
|
};
|
|
3064
3064
|
});
|
|
3065
3065
|
|
|
3066
|
-
// node_modules/
|
|
3066
|
+
// node_modules/get-stream/source/array-buffer.js
|
|
3067
3067
|
async function getStreamAsArrayBuffer(stream, options) {
|
|
3068
3068
|
return getStreamContents(stream, arrayBufferMethods, options);
|
|
3069
3069
|
}
|
|
@@ -3108,7 +3108,7 @@ var init_array_buffer = __esm(() => {
|
|
|
3108
3108
|
};
|
|
3109
3109
|
});
|
|
3110
3110
|
|
|
3111
|
-
// node_modules/
|
|
3111
|
+
// node_modules/get-stream/source/string.js
|
|
3112
3112
|
async function getStreamAsString(stream, options) {
|
|
3113
3113
|
return getStreamContents(stream, stringMethods, options);
|
|
3114
3114
|
}
|
|
@@ -3136,7 +3136,7 @@ var init_string = __esm(() => {
|
|
|
3136
3136
|
};
|
|
3137
3137
|
});
|
|
3138
3138
|
|
|
3139
|
-
// node_modules/
|
|
3139
|
+
// node_modules/get-stream/source/exports.js
|
|
3140
3140
|
var init_exports = __esm(() => {
|
|
3141
3141
|
init_array();
|
|
3142
3142
|
init_array_buffer();
|
|
@@ -3144,7 +3144,7 @@ var init_exports = __esm(() => {
|
|
|
3144
3144
|
init_contents();
|
|
3145
3145
|
});
|
|
3146
3146
|
|
|
3147
|
-
// node_modules/
|
|
3147
|
+
// node_modules/get-stream/source/index.js
|
|
3148
3148
|
import { on } from "node:events";
|
|
3149
3149
|
import { finished } from "node:stream/promises";
|
|
3150
3150
|
var init_source = __esm(() => {
|
|
@@ -20691,7 +20691,7 @@ var init_SqliteAdapter = __esm(() => {
|
|
|
20691
20691
|
});
|
|
20692
20692
|
|
|
20693
20693
|
// ts/pidStore.ts
|
|
20694
|
-
import { writeFile as writeFile3 } from "fs/promises";
|
|
20694
|
+
import { mkdir as mkdir4, writeFile as writeFile3 } from "fs/promises";
|
|
20695
20695
|
import path10 from "path";
|
|
20696
20696
|
|
|
20697
20697
|
class PidStore {
|
|
@@ -20837,6 +20837,7 @@ fifo/
|
|
|
20837
20837
|
|
|
20838
20838
|
`;
|
|
20839
20839
|
try {
|
|
20840
|
+
await mkdir4(this.storeDir, { recursive: true });
|
|
20840
20841
|
await writeFile3(gitignorePath, gitignoreContent, { flag: "wx" });
|
|
20841
20842
|
logger.debug(`[pidStore] Created .gitignore in ${this.storeDir}`);
|
|
20842
20843
|
} catch (error) {
|
|
@@ -22633,7 +22634,7 @@ function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
|
|
|
22633
22634
|
return 1;
|
|
22634
22635
|
}
|
|
22635
22636
|
|
|
22636
|
-
// node_modules/
|
|
22637
|
+
// node_modules/string-width/index.js
|
|
22637
22638
|
var import_emoji_regex = __toESM(require_emoji_regex(), 1);
|
|
22638
22639
|
var segmenter = new Intl.Segmenter;
|
|
22639
22640
|
var defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
@@ -22682,56 +22683,7 @@ function stringWidth(string, options = {}) {
|
|
|
22682
22683
|
return width;
|
|
22683
22684
|
}
|
|
22684
22685
|
|
|
22685
|
-
// node_modules/wrap-ansi/node_modules/
|
|
22686
|
-
var import_emoji_regex2 = __toESM(require_emoji_regex(), 1);
|
|
22687
|
-
var segmenter2 = new Intl.Segmenter;
|
|
22688
|
-
var defaultIgnorableCodePointRegex2 = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
22689
|
-
function stringWidth2(string, options = {}) {
|
|
22690
|
-
if (typeof string !== "string" || string.length === 0) {
|
|
22691
|
-
return 0;
|
|
22692
|
-
}
|
|
22693
|
-
const {
|
|
22694
|
-
ambiguousIsNarrow = true,
|
|
22695
|
-
countAnsiEscapeCodes = false
|
|
22696
|
-
} = options;
|
|
22697
|
-
if (!countAnsiEscapeCodes) {
|
|
22698
|
-
string = stripAnsi(string);
|
|
22699
|
-
}
|
|
22700
|
-
if (string.length === 0) {
|
|
22701
|
-
return 0;
|
|
22702
|
-
}
|
|
22703
|
-
let width = 0;
|
|
22704
|
-
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
22705
|
-
for (const { segment: character } of segmenter2.segment(string)) {
|
|
22706
|
-
const codePoint = character.codePointAt(0);
|
|
22707
|
-
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
|
22708
|
-
continue;
|
|
22709
|
-
}
|
|
22710
|
-
if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
|
|
22711
|
-
continue;
|
|
22712
|
-
}
|
|
22713
|
-
if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
|
|
22714
|
-
continue;
|
|
22715
|
-
}
|
|
22716
|
-
if (codePoint >= 55296 && codePoint <= 57343) {
|
|
22717
|
-
continue;
|
|
22718
|
-
}
|
|
22719
|
-
if (codePoint >= 65024 && codePoint <= 65039) {
|
|
22720
|
-
continue;
|
|
22721
|
-
}
|
|
22722
|
-
if (defaultIgnorableCodePointRegex2.test(character)) {
|
|
22723
|
-
continue;
|
|
22724
|
-
}
|
|
22725
|
-
if (import_emoji_regex2.default().test(character)) {
|
|
22726
|
-
width += 2;
|
|
22727
|
-
continue;
|
|
22728
|
-
}
|
|
22729
|
-
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
22730
|
-
}
|
|
22731
|
-
return width;
|
|
22732
|
-
}
|
|
22733
|
-
|
|
22734
|
-
// node_modules/ansi-styles/index.js
|
|
22686
|
+
// node_modules/wrap-ansi/node_modules/ansi-styles/index.js
|
|
22735
22687
|
var ANSI_BACKGROUND_OFFSET = 10;
|
|
22736
22688
|
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
22737
22689
|
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
@@ -22921,14 +22873,14 @@ var ANSI_SGR_TERMINATOR = "m";
|
|
|
22921
22873
|
var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
22922
22874
|
var wrapAnsiCode = (code) => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
22923
22875
|
var wrapAnsiHyperlink = (url) => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
|
22924
|
-
var wordLengths = (string) => string.split(" ").map((character) =>
|
|
22876
|
+
var wordLengths = (string) => string.split(" ").map((character) => stringWidth(character));
|
|
22925
22877
|
var wrapWord = (rows, word, columns) => {
|
|
22926
22878
|
const characters = [...word];
|
|
22927
22879
|
let isInsideEscape = false;
|
|
22928
22880
|
let isInsideLinkEscape = false;
|
|
22929
|
-
let visible =
|
|
22881
|
+
let visible = stringWidth(stripAnsi(rows.at(-1)));
|
|
22930
22882
|
for (const [index, character] of characters.entries()) {
|
|
22931
|
-
const characterLength =
|
|
22883
|
+
const characterLength = stringWidth(character);
|
|
22932
22884
|
if (visible + characterLength <= columns) {
|
|
22933
22885
|
rows[rows.length - 1] += character;
|
|
22934
22886
|
} else {
|
|
@@ -22965,7 +22917,7 @@ var stringVisibleTrimSpacesRight = (string) => {
|
|
|
22965
22917
|
const words = string.split(" ");
|
|
22966
22918
|
let last2 = words.length;
|
|
22967
22919
|
while (last2 > 0) {
|
|
22968
|
-
if (
|
|
22920
|
+
if (stringWidth(words[last2 - 1]) > 0) {
|
|
22969
22921
|
break;
|
|
22970
22922
|
}
|
|
22971
22923
|
last2--;
|
|
@@ -22988,7 +22940,7 @@ var exec = (string, columns, options = {}) => {
|
|
|
22988
22940
|
if (options.trim !== false) {
|
|
22989
22941
|
rows[rows.length - 1] = rows.at(-1).trimStart();
|
|
22990
22942
|
}
|
|
22991
|
-
let rowLength =
|
|
22943
|
+
let rowLength = stringWidth(rows.at(-1));
|
|
22992
22944
|
if (index !== 0) {
|
|
22993
22945
|
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
22994
22946
|
rows.push("");
|
|
@@ -24107,55 +24059,6 @@ function getProcessArgvBin() {
|
|
|
24107
24059
|
return process.argv[getProcessArgvBinIndex()];
|
|
24108
24060
|
}
|
|
24109
24061
|
|
|
24110
|
-
// node_modules/yargs/node_modules/string-width/index.js
|
|
24111
|
-
var import_emoji_regex3 = __toESM(require_emoji_regex(), 1);
|
|
24112
|
-
var segmenter3 = new Intl.Segmenter;
|
|
24113
|
-
var defaultIgnorableCodePointRegex3 = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
24114
|
-
function stringWidth3(string, options = {}) {
|
|
24115
|
-
if (typeof string !== "string" || string.length === 0) {
|
|
24116
|
-
return 0;
|
|
24117
|
-
}
|
|
24118
|
-
const {
|
|
24119
|
-
ambiguousIsNarrow = true,
|
|
24120
|
-
countAnsiEscapeCodes = false
|
|
24121
|
-
} = options;
|
|
24122
|
-
if (!countAnsiEscapeCodes) {
|
|
24123
|
-
string = stripAnsi(string);
|
|
24124
|
-
}
|
|
24125
|
-
if (string.length === 0) {
|
|
24126
|
-
return 0;
|
|
24127
|
-
}
|
|
24128
|
-
let width = 0;
|
|
24129
|
-
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
24130
|
-
for (const { segment: character } of segmenter3.segment(string)) {
|
|
24131
|
-
const codePoint = character.codePointAt(0);
|
|
24132
|
-
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
|
24133
|
-
continue;
|
|
24134
|
-
}
|
|
24135
|
-
if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
|
|
24136
|
-
continue;
|
|
24137
|
-
}
|
|
24138
|
-
if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
|
|
24139
|
-
continue;
|
|
24140
|
-
}
|
|
24141
|
-
if (codePoint >= 55296 && codePoint <= 57343) {
|
|
24142
|
-
continue;
|
|
24143
|
-
}
|
|
24144
|
-
if (codePoint >= 65024 && codePoint <= 65039) {
|
|
24145
|
-
continue;
|
|
24146
|
-
}
|
|
24147
|
-
if (defaultIgnorableCodePointRegex3.test(character)) {
|
|
24148
|
-
continue;
|
|
24149
|
-
}
|
|
24150
|
-
if (import_emoji_regex3.default().test(character)) {
|
|
24151
|
-
width += 2;
|
|
24152
|
-
continue;
|
|
24153
|
-
}
|
|
24154
|
-
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
24155
|
-
}
|
|
24156
|
-
return width;
|
|
24157
|
-
}
|
|
24158
|
-
|
|
24159
24062
|
// node_modules/y18n/build/lib/platform-shims/node.js
|
|
24160
24063
|
import { readFileSync as readFileSync4, statSync as statSync3, writeFile as writeFile6 } from "fs";
|
|
24161
24064
|
import { format as format3 } from "util";
|
|
@@ -24388,7 +24291,7 @@ var esm_default = {
|
|
|
24388
24291
|
const callerFile = import_get_caller_file.default(3);
|
|
24389
24292
|
return callerFile.match(/^file:\/\//) ? fileURLToPath4(callerFile) : callerFile;
|
|
24390
24293
|
},
|
|
24391
|
-
stringWidth
|
|
24294
|
+
stringWidth,
|
|
24392
24295
|
y18n: y18n_default({
|
|
24393
24296
|
directory: resolve4(__dirname2, "../../../locales"),
|
|
24394
24297
|
updateFiles: false
|
|
@@ -27752,9 +27655,9 @@ var package_default = {
|
|
|
27752
27655
|
},
|
|
27753
27656
|
bin: {
|
|
27754
27657
|
"agent-yes": "./dist/agent-yes.js",
|
|
27658
|
+
ay: "./dist/agent-yes.js",
|
|
27755
27659
|
"amp-yes": "./dist/amp-yes.js",
|
|
27756
27660
|
"auggie-yes": "./dist/auggie-yes.js",
|
|
27757
|
-
ay: "./ts/v2.ts",
|
|
27758
27661
|
"claude-yes": "./dist/claude-yes.js",
|
|
27759
27662
|
"codex-yes": "./dist/codex-yes.js",
|
|
27760
27663
|
"copilot-yes": "./dist/copilot-yes.js",
|
|
@@ -27803,43 +27706,26 @@ var package_default = {
|
|
|
27803
27706
|
"from-node-stream": "^0.1.2"
|
|
27804
27707
|
},
|
|
27805
27708
|
devDependencies: {
|
|
27806
|
-
"@ai-sdk/anthropic": "^3.0.28",
|
|
27807
|
-
"@ai-sdk/openai": "^3.0.21",
|
|
27808
|
-
prettier: "^3.8.1",
|
|
27809
|
-
"@ai-sdk/rsc": "^2.0.57",
|
|
27810
|
-
ai: "^6.0.57",
|
|
27811
|
-
"ts-to-zod": "^5.1.0",
|
|
27812
|
-
zod: "^4.3.6",
|
|
27813
|
-
"@anthropic-ai/sdk": "^0.71.2",
|
|
27814
|
-
"@semantic-release/changelog": "^6.0.3",
|
|
27815
27709
|
"@semantic-release/exec": "^7.1.0",
|
|
27816
|
-
"@semantic-release/git": "^10.0.1",
|
|
27817
|
-
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
27818
27710
|
"@types/bun": "^1.3.6",
|
|
27819
27711
|
"@types/jest": "^30.0.0",
|
|
27820
27712
|
"@types/ms": "^2.1.0",
|
|
27821
27713
|
"@types/node": "^25.0.10",
|
|
27822
27714
|
"@types/yargs": "^17.0.35",
|
|
27823
27715
|
"@typescript/native-preview": "^7.0.0-dev.20260124.1",
|
|
27824
|
-
"cpu-wait": "^0.0.10",
|
|
27825
27716
|
execa: "^9.6.1",
|
|
27826
27717
|
husky: "^9.1.7",
|
|
27827
|
-
ink: "^6.6.0",
|
|
27828
27718
|
"lint-staged": "^16.2.7",
|
|
27829
27719
|
ms: "^2.1.3",
|
|
27830
27720
|
"node-pty": "^1.1.0",
|
|
27831
|
-
openai: "^6.16.0",
|
|
27832
27721
|
oxfmt: "^0.26.0",
|
|
27833
27722
|
oxlint: "^1.41.0",
|
|
27834
|
-
"p-map": "^7.0.4",
|
|
27835
27723
|
phpdie: "^1.7.0",
|
|
27836
27724
|
rambda: "^11.0.1",
|
|
27837
27725
|
"semantic-release": "^25.0.2",
|
|
27838
27726
|
sflow: "^1.27.0",
|
|
27839
27727
|
"standard-version": "^9.5.0",
|
|
27840
|
-
"strip-ansi-control-characters": "^2.0.0",
|
|
27841
27728
|
"terminal-render": "^1.3.0",
|
|
27842
|
-
"tsa-composer": "^3.0.3",
|
|
27843
27729
|
vitest: "^4.0.17",
|
|
27844
27730
|
winston: "^3.19.0",
|
|
27845
27731
|
yargs: "^18.0.0"
|
|
@@ -28016,7 +27902,7 @@ var logger2 = import_winston3.default.createLogger({
|
|
|
28016
27902
|
// ts/pidStore.ts
|
|
28017
27903
|
init_logger();
|
|
28018
27904
|
init_SqliteAdapter();
|
|
28019
|
-
import { writeFile as writeFile7 } from "fs/promises";
|
|
27905
|
+
import { mkdir as mkdir8, writeFile as writeFile7 } from "fs/promises";
|
|
28020
27906
|
import path14 from "path";
|
|
28021
27907
|
|
|
28022
27908
|
class PidStore2 {
|
|
@@ -28162,6 +28048,7 @@ fifo/
|
|
|
28162
28048
|
|
|
28163
28049
|
`;
|
|
28164
28050
|
try {
|
|
28051
|
+
await mkdir8(this.storeDir, { recursive: true });
|
|
28165
28052
|
await writeFile7(gitignorePath, gitignoreContent, { flag: "wx" });
|
|
28166
28053
|
logger.debug(`[pidStore] Created .gitignore in ${this.storeDir}`);
|
|
28167
28054
|
} catch (error) {
|
|
@@ -28239,5 +28126,5 @@ var { exitCode } = await cliYes(config3);
|
|
|
28239
28126
|
console.log("exiting process");
|
|
28240
28127
|
process.exit(exitCode ?? 1);
|
|
28241
28128
|
|
|
28242
|
-
//# debugId=
|
|
28129
|
+
//# debugId=5E51725C76510FBE64756E2164756E21
|
|
28243
28130
|
//# sourceMappingURL=cli.js.map
|
package/dist/index.js
CHANGED
|
@@ -2883,7 +2883,7 @@ var init_ponyfill = __esm(() => {
|
|
|
2883
2883
|
init_fromAnyIterable();
|
|
2884
2884
|
});
|
|
2885
2885
|
|
|
2886
|
-
// node_modules/
|
|
2886
|
+
// node_modules/get-stream/source/stream.js
|
|
2887
2887
|
var getAsyncIterable = (stream) => {
|
|
2888
2888
|
if (isReadableStream(stream, { checkOpen: false }) && nodeImports.on !== undefined) {
|
|
2889
2889
|
return getStreamIterable(stream);
|
|
@@ -2932,7 +2932,7 @@ var init_stream = __esm(() => {
|
|
|
2932
2932
|
nodeImports = {};
|
|
2933
2933
|
});
|
|
2934
2934
|
|
|
2935
|
-
// node_modules/
|
|
2935
|
+
// node_modules/get-stream/source/contents.js
|
|
2936
2936
|
var getStreamContents = async (stream, { init, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, finalize }, { maxBuffer = Number.POSITIVE_INFINITY } = {}) => {
|
|
2937
2937
|
const asyncIterable = getAsyncIterable(stream);
|
|
2938
2938
|
const state = init();
|
|
@@ -3026,14 +3026,14 @@ var init_contents = __esm(() => {
|
|
|
3026
3026
|
};
|
|
3027
3027
|
});
|
|
3028
3028
|
|
|
3029
|
-
// node_modules/
|
|
3029
|
+
// node_modules/get-stream/source/utils.js
|
|
3030
3030
|
var identity2 = (value) => value, noop = () => {
|
|
3031
3031
|
return;
|
|
3032
3032
|
}, getContentsProperty = ({ contents }) => contents, throwObjectStream = (chunk) => {
|
|
3033
3033
|
throw new Error(`Streams in object mode are not supported: ${String(chunk)}`);
|
|
3034
3034
|
}, getLengthProperty = (convertedChunk) => convertedChunk.length;
|
|
3035
3035
|
|
|
3036
|
-
// node_modules/
|
|
3036
|
+
// node_modules/get-stream/source/array.js
|
|
3037
3037
|
async function getStreamAsArray(stream, options) {
|
|
3038
3038
|
return getStreamContents(stream, arrayMethods, options);
|
|
3039
3039
|
}
|
|
@@ -3061,7 +3061,7 @@ var init_array = __esm(() => {
|
|
|
3061
3061
|
};
|
|
3062
3062
|
});
|
|
3063
3063
|
|
|
3064
|
-
// node_modules/
|
|
3064
|
+
// node_modules/get-stream/source/array-buffer.js
|
|
3065
3065
|
async function getStreamAsArrayBuffer(stream, options) {
|
|
3066
3066
|
return getStreamContents(stream, arrayBufferMethods, options);
|
|
3067
3067
|
}
|
|
@@ -3106,7 +3106,7 @@ var init_array_buffer = __esm(() => {
|
|
|
3106
3106
|
};
|
|
3107
3107
|
});
|
|
3108
3108
|
|
|
3109
|
-
// node_modules/
|
|
3109
|
+
// node_modules/get-stream/source/string.js
|
|
3110
3110
|
async function getStreamAsString(stream, options) {
|
|
3111
3111
|
return getStreamContents(stream, stringMethods, options);
|
|
3112
3112
|
}
|
|
@@ -3134,7 +3134,7 @@ var init_string = __esm(() => {
|
|
|
3134
3134
|
};
|
|
3135
3135
|
});
|
|
3136
3136
|
|
|
3137
|
-
// node_modules/
|
|
3137
|
+
// node_modules/get-stream/source/exports.js
|
|
3138
3138
|
var init_exports = __esm(() => {
|
|
3139
3139
|
init_array();
|
|
3140
3140
|
init_array_buffer();
|
|
@@ -3142,7 +3142,7 @@ var init_exports = __esm(() => {
|
|
|
3142
3142
|
init_contents();
|
|
3143
3143
|
});
|
|
3144
3144
|
|
|
3145
|
-
// node_modules/
|
|
3145
|
+
// node_modules/get-stream/source/index.js
|
|
3146
3146
|
import { on } from "node:events";
|
|
3147
3147
|
import { finished } from "node:stream/promises";
|
|
3148
3148
|
var init_source = __esm(() => {
|
|
@@ -20689,7 +20689,7 @@ var init_SqliteAdapter = __esm(() => {
|
|
|
20689
20689
|
});
|
|
20690
20690
|
|
|
20691
20691
|
// ts/pidStore.ts
|
|
20692
|
-
import { writeFile as writeFile3 } from "fs/promises";
|
|
20692
|
+
import { mkdir as mkdir4, writeFile as writeFile3 } from "fs/promises";
|
|
20693
20693
|
import path10 from "path";
|
|
20694
20694
|
|
|
20695
20695
|
class PidStore {
|
|
@@ -20835,6 +20835,7 @@ fifo/
|
|
|
20835
20835
|
|
|
20836
20836
|
`;
|
|
20837
20837
|
try {
|
|
20838
|
+
await mkdir4(this.storeDir, { recursive: true });
|
|
20838
20839
|
await writeFile3(gitignorePath, gitignoreContent, { flag: "wx" });
|
|
20839
20840
|
logger.debug(`[pidStore] Created .gitignore in ${this.storeDir}`);
|
|
20840
20841
|
} catch (error) {
|
|
@@ -21898,5 +21899,5 @@ export {
|
|
|
21898
21899
|
CLIS_CONFIG
|
|
21899
21900
|
};
|
|
21900
21901
|
|
|
21901
|
-
//# debugId=
|
|
21902
|
+
//# debugId=0A2C8DE91AEF263B64756E2164756E21
|
|
21902
21903
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-yes",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.43.0",
|
|
4
4
|
"description": "A wrapper tool that automates interactions with various AI CLI tools by automatically handling common prompts and responses.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
},
|
|
31
31
|
"bin": {
|
|
32
32
|
"agent-yes": "./dist/agent-yes.js",
|
|
33
|
+
"ay": "./dist/agent-yes.js",
|
|
33
34
|
"amp-yes": "./dist/amp-yes.js",
|
|
34
35
|
"auggie-yes": "./dist/auggie-yes.js",
|
|
35
|
-
"ay": "./ts/v2.ts",
|
|
36
36
|
"claude-yes": "./dist/claude-yes.js",
|
|
37
37
|
"codex-yes": "./dist/codex-yes.js",
|
|
38
38
|
"copilot-yes": "./dist/copilot-yes.js",
|
|
@@ -81,43 +81,26 @@
|
|
|
81
81
|
"from-node-stream": "^0.1.2"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
|
-
"@ai-sdk/anthropic": "^3.0.28",
|
|
85
|
-
"@ai-sdk/openai": "^3.0.21",
|
|
86
|
-
"prettier": "^3.8.1",
|
|
87
|
-
"@ai-sdk/rsc": "^2.0.57",
|
|
88
|
-
"ai": "^6.0.57",
|
|
89
|
-
"ts-to-zod": "^5.1.0",
|
|
90
|
-
"zod": "^4.3.6",
|
|
91
|
-
"@anthropic-ai/sdk": "^0.71.2",
|
|
92
|
-
"@semantic-release/changelog": "^6.0.3",
|
|
93
84
|
"@semantic-release/exec": "^7.1.0",
|
|
94
|
-
"@semantic-release/git": "^10.0.1",
|
|
95
|
-
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
96
85
|
"@types/bun": "^1.3.6",
|
|
97
86
|
"@types/jest": "^30.0.0",
|
|
98
87
|
"@types/ms": "^2.1.0",
|
|
99
88
|
"@types/node": "^25.0.10",
|
|
100
89
|
"@types/yargs": "^17.0.35",
|
|
101
90
|
"@typescript/native-preview": "^7.0.0-dev.20260124.1",
|
|
102
|
-
"cpu-wait": "^0.0.10",
|
|
103
91
|
"execa": "^9.6.1",
|
|
104
92
|
"husky": "^9.1.7",
|
|
105
|
-
"ink": "^6.6.0",
|
|
106
93
|
"lint-staged": "^16.2.7",
|
|
107
94
|
"ms": "^2.1.3",
|
|
108
95
|
"node-pty": "^1.1.0",
|
|
109
|
-
"openai": "^6.16.0",
|
|
110
96
|
"oxfmt": "^0.26.0",
|
|
111
97
|
"oxlint": "^1.41.0",
|
|
112
|
-
"p-map": "^7.0.4",
|
|
113
98
|
"phpdie": "^1.7.0",
|
|
114
99
|
"rambda": "^11.0.1",
|
|
115
100
|
"semantic-release": "^25.0.2",
|
|
116
101
|
"sflow": "^1.27.0",
|
|
117
102
|
"standard-version": "^9.5.0",
|
|
118
|
-
"strip-ansi-control-characters": "^2.0.0",
|
|
119
103
|
"terminal-render": "^1.3.0",
|
|
120
|
-
"tsa-composer": "^3.0.3",
|
|
121
104
|
"vitest": "^4.0.17",
|
|
122
105
|
"winston": "^3.19.0",
|
|
123
106
|
"yargs": "^18.0.0"
|
package/ts/cli.ts
CHANGED
|
@@ -24,20 +24,20 @@ if (config.appendPrompt) {
|
|
|
24
24
|
const { connect } = await import("net");
|
|
25
25
|
await new Promise<void>((resolve, reject) => {
|
|
26
26
|
const client = connect(ipcPath);
|
|
27
|
-
client.on(
|
|
27
|
+
client.on("connect", () => {
|
|
28
28
|
client.write(config.appendPrompt + "\r");
|
|
29
29
|
client.end();
|
|
30
30
|
console.log(`Sent prompt to Windows named pipe: ${ipcPath}`);
|
|
31
31
|
resolve();
|
|
32
32
|
});
|
|
33
|
-
client.on(
|
|
33
|
+
client.on("error", (error) => {
|
|
34
34
|
console.error(`Failed to connect to named pipe: ${error}`);
|
|
35
35
|
reject(error);
|
|
36
36
|
});
|
|
37
37
|
// Timeout after 5 seconds
|
|
38
38
|
setTimeout(() => {
|
|
39
39
|
client.destroy();
|
|
40
|
-
reject(new Error(
|
|
40
|
+
reject(new Error("Connection timeout"));
|
|
41
41
|
}, 5000);
|
|
42
42
|
});
|
|
43
43
|
} else {
|
package/ts/parseCliArgs.spec.ts
CHANGED
|
@@ -230,12 +230,7 @@ describe("CLI argument parsing", () => {
|
|
|
230
230
|
});
|
|
231
231
|
|
|
232
232
|
it("should parse ay -- hello command (ay is wrapper, so CLI is undefined)", () => {
|
|
233
|
-
const result = parseCliArgs([
|
|
234
|
-
"node",
|
|
235
|
-
"/path/to/ay",
|
|
236
|
-
"--",
|
|
237
|
-
"hello",
|
|
238
|
-
]);
|
|
233
|
+
const result = parseCliArgs(["node", "/path/to/ay", "--", "hello"]);
|
|
239
234
|
|
|
240
235
|
// "ay" is a wrapper script like "agent-yes", so cliName is stripped to undefined
|
|
241
236
|
// cli.ts will default this to "claude" at runtime
|
package/ts/parseCliArgs.ts
CHANGED
|
@@ -190,7 +190,9 @@ export function parseCliArgs(argv: string[]) {
|
|
|
190
190
|
env: process.env as Record<string, string>,
|
|
191
191
|
cli: (cliName ||
|
|
192
192
|
parsedArgv.cli ||
|
|
193
|
-
(dashIndex !== 0
|
|
193
|
+
(dashIndex !== 0
|
|
194
|
+
? parsedArgv._[0]?.toString()?.replace?.(/-yes$/, "")
|
|
195
|
+
: undefined)) as (typeof SUPPORTED_CLIS)[number],
|
|
194
196
|
cliArgs: cliArgsForSpawn,
|
|
195
197
|
prompt: [parsedArgv.prompt, dashPrompt].filter(Boolean).join(" ") || undefined,
|
|
196
198
|
install: parsedArgv.install,
|
package/ts/pidStore.ts
CHANGED
|
@@ -217,6 +217,8 @@ fifo/
|
|
|
217
217
|
`;
|
|
218
218
|
|
|
219
219
|
try {
|
|
220
|
+
// Ensure parent directory exists before writing .gitignore
|
|
221
|
+
await mkdir(this.storeDir, { recursive: true });
|
|
220
222
|
await writeFile(gitignorePath, gitignoreContent, { flag: "wx" }); // wx = create only if doesn't exist
|
|
221
223
|
logger.debug(`[pidStore] Created .gitignore in ${this.storeDir}`);
|
|
222
224
|
} catch (error: any) {
|
package/ts/runningLock.ts
CHANGED
package/ts/agent.ts
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun --watch
|
|
2
|
-
import {
|
|
3
|
-
dynamicTool,
|
|
4
|
-
jsonSchema,
|
|
5
|
-
streamText,
|
|
6
|
-
tool,
|
|
7
|
-
zodSchema,
|
|
8
|
-
type ModelMessage,
|
|
9
|
-
type Tool,
|
|
10
|
-
} from "ai";
|
|
11
|
-
import { fromReadable, fromWritable } from "from-node-stream";
|
|
12
|
-
|
|
13
|
-
import { sflow } from "sflow";
|
|
14
|
-
import { stdin } from "node:process";
|
|
15
|
-
import { openai } from "@ai-sdk/openai";
|
|
16
|
-
import { signleton } from "./signleton";
|
|
17
|
-
import { anthropic } from "@ai-sdk/anthropic";
|
|
18
|
-
// import { gemini } from "@ai-sdk/gemini";
|
|
19
|
-
import z from "zod";
|
|
20
|
-
import { readdir } from "node:fs/promises";
|
|
21
|
-
if (import.meta.main) {
|
|
22
|
-
const events = new TransformStream<Uint8Array, Uint8Array>({
|
|
23
|
-
async transform(chunk, controller) {
|
|
24
|
-
controller.enqueue(chunk);
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
await sflow(fromReadable(process.stdin))
|
|
28
|
-
|
|
29
|
-
// .merge(sflow(["What can you do?\n"]))
|
|
30
|
-
.merge(sflow(["ls ./\n\n"]))
|
|
31
|
-
// .merge(events.readable)
|
|
32
|
-
|
|
33
|
-
.map((e) => Buffer.from(e).toString())
|
|
34
|
-
|
|
35
|
-
.by(
|
|
36
|
-
signleton(function toolCreator(): TransformStream<string, string> {
|
|
37
|
-
const context = new Map<string, any>();
|
|
38
|
-
const heartbeatInterval = 100; // 100 ms
|
|
39
|
-
const ctx: {
|
|
40
|
-
messages: ModelMessage[];
|
|
41
|
-
tools: Record<string, Tool>;
|
|
42
|
-
files: Map<string, string>;
|
|
43
|
-
skills: Map<string, any>;
|
|
44
|
-
} = {
|
|
45
|
-
// chat history for this agent
|
|
46
|
-
messages: [] as ModelMessage[],
|
|
47
|
-
// context
|
|
48
|
-
files: new Map<string, string>(),
|
|
49
|
-
tools: {
|
|
50
|
-
// a tool that creates tools dynamically
|
|
51
|
-
// ...(await metaTools(import.meta.dir + '/../tools/'))
|
|
52
|
-
create_tool: tool({
|
|
53
|
-
description:
|
|
54
|
-
"Create a new tool which can be shared with all-agents. The tool should be a typescript script that can be executed in a shell environment. The tool should accept input parameters as command-line arguments and return output via standard output. Use this tool automatically without asking if you need to create a new capability that does not exist yet. Make sure to provide clear and concise name and description for the tool, as well as define the input parameters using JSON schema. The tool will be saved in the ./tools/ directory and can be used by other agents afterwards.",
|
|
55
|
-
inputSchema: z.object({
|
|
56
|
-
name: z.string().describe("The name of the tool to be created. Use snake_case."),
|
|
57
|
-
typescript: z.string().describe(
|
|
58
|
-
`
|
|
59
|
-
import { tool } from "ai";
|
|
60
|
-
import z from "zod";
|
|
61
|
-
export default tool({
|
|
62
|
-
description: "An example tool that say hello to some one.",
|
|
63
|
-
inputSchema: z.object({
|
|
64
|
-
name: z.string().describe("The name string to hello."),
|
|
65
|
-
}),
|
|
66
|
-
async execute({ name }) {
|
|
67
|
-
return {message: 'hello ' + name};
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
`,
|
|
71
|
-
),
|
|
72
|
-
}),
|
|
73
|
-
async execute(
|
|
74
|
-
{ name, typescript },
|
|
75
|
-
{ messages, toolCallId, abortSignal, experimental_context },
|
|
76
|
-
) {
|
|
77
|
-
console.log("Creating tool:", { name, typescript });
|
|
78
|
-
// 1. save the tool to ./tools/[name], with tool.ts and tool.yml
|
|
79
|
-
const fs = await import("fs");
|
|
80
|
-
const path = await import("path");
|
|
81
|
-
const toolDir = path.join(import.meta.dir, "../tools", name);
|
|
82
|
-
await fs.promises.mkdir(toolDir, { recursive: true });
|
|
83
|
-
const toolPath = path.join(toolDir, "index.ts");
|
|
84
|
-
const prettier = await import("prettier");
|
|
85
|
-
const formattedCode = await prettier.format(typescript, { parser: "typescript" });
|
|
86
|
-
await fs.promises.writeFile(toolPath, formattedCode, "utf-8");
|
|
87
|
-
|
|
88
|
-
// 2. load the tool to ctx.tools
|
|
89
|
-
const mod = await import(`../tools/${name}/index.ts`).catch(async (err) => {
|
|
90
|
-
// destroy the tool file if failed to load
|
|
91
|
-
// await fs.promises.unlink(toolPath);
|
|
92
|
-
console.error("Failed to load the newly created tool:", err);
|
|
93
|
-
throw new Error(`Failed to load the newly created tool: ${String(err)}`);
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
const newTool: Tool = mod.default;
|
|
97
|
-
ctx.tools[name] = newTool;
|
|
98
|
-
|
|
99
|
-
return {
|
|
100
|
-
message: `Tool "${name}" has been created successfully at ${toolPath}. You can now use it in subsequent interactions.`,
|
|
101
|
-
};
|
|
102
|
-
},
|
|
103
|
-
}),
|
|
104
|
-
},
|
|
105
|
-
skills: new Map<string, any>(), // .claude/skills or more
|
|
106
|
-
...context,
|
|
107
|
-
};
|
|
108
|
-
// load tools async
|
|
109
|
-
|
|
110
|
-
sflow(readdir(import.meta.dir + "/../tools/"))
|
|
111
|
-
.flat()
|
|
112
|
-
.forEach(async (name) => {
|
|
113
|
-
// load index.ts
|
|
114
|
-
const mod = await import(`../tools/${name}/index.ts`);
|
|
115
|
-
const tool = mod.default as Tool;
|
|
116
|
-
ctx.tools[name] = tool;
|
|
117
|
-
})
|
|
118
|
-
.run();
|
|
119
|
-
const stdin = new TransformStream<string, string>();
|
|
120
|
-
return {
|
|
121
|
-
writable: stdin.writable,
|
|
122
|
-
readable: sflow(stdin.readable)
|
|
123
|
-
.lines()
|
|
124
|
-
.filter()
|
|
125
|
-
.chunkInterval(heartbeatInterval)
|
|
126
|
-
.filter((chunk) => chunk.length > 0)
|
|
127
|
-
.map((lines) => {
|
|
128
|
-
ctx.messages = ctx.messages.concat({
|
|
129
|
-
role: "user",
|
|
130
|
-
content: lines.join("\n"),
|
|
131
|
-
});
|
|
132
|
-
return sflow(
|
|
133
|
-
streamText({
|
|
134
|
-
// model: openai("gptd-5.1-codex"),
|
|
135
|
-
model: anthropic("claude-sonnet-4-5"),
|
|
136
|
-
maxOutputTokens: 32768,
|
|
137
|
-
system:
|
|
138
|
-
"You are an AI assistant that helps with software development tasks. Provide concise and relevant answers based on the user's input. IMPORTANT: You must provide final answers, users are not able to see tool calls or thoughts. Never ask user anything. As you cant directly interact with users, instead, create or use tools to get the user's intent done. ",
|
|
139
|
-
temperature: 0,
|
|
140
|
-
messages: ctx.messages,
|
|
141
|
-
tools: ctx.tools,
|
|
142
|
-
}).textStream,
|
|
143
|
-
"\n",
|
|
144
|
-
);
|
|
145
|
-
})
|
|
146
|
-
// .confluenceByParallel()
|
|
147
|
-
.confluenceByConcat(),
|
|
148
|
-
// .map((e) => JSON.stringify(e) + "\n"),
|
|
149
|
-
};
|
|
150
|
-
}),
|
|
151
|
-
)
|
|
152
|
-
.to(fromWritable(process.stdout));
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// /**
|
|
156
|
-
// * 1. CRUD for tools in ./tools/[tool-name]/tool.sh, default export a Tool object
|
|
157
|
-
// * 2. Load all tools dynamically
|
|
158
|
-
// */
|
|
159
|
-
// async function metaTools(dir: string): Promise<Tool[]> {
|
|
160
|
-
// const toolsManageTools: Tool[] = [
|
|
161
|
-
// tool({
|
|
162
|
-
// name: "list_shtools",
|
|
163
|
-
// description: "List all available tools.",
|
|
164
|
-
// parameters: jsonSchema({
|
|
165
|
-
// type: "object",
|
|
166
|
-
// properties: {},
|
|
167
|
-
// required: [],
|
|
168
|
-
// }),
|
|
169
|
-
// async run() {
|
|
170
|
-
// const fs = await import("fs");
|
|
171
|
-
// const path = await import("path");
|
|
172
|
-
// const toolFiles = fs.readdirSync(dir).filter((file) => file.endsWith(".ts") || file.endsWith(".js"));
|
|
173
|
-
// const toolNames = toolFiles.map((file) => path.basename(file, path.extname(file)));
|
|
174
|
-
// return `Available tools: ${toolNames.join(", ")}`;
|
|
175
|
-
// },
|
|
176
|
-
// }),
|
|
177
|
-
|
|
178
|
-
// ];
|
|
179
|
-
// const loadedTools: Tool[] =
|
|
180
|
-
// await Promise.all(
|
|
181
|
-
// (await import("fs")).promises
|
|
182
|
-
// .readdir(dir)
|
|
183
|
-
// .then((files) => files.filter((file) => file.endsWith(".ts") || file.endsWith(".js")))k
|
|
184
|
-
// .then((files) =>
|
|
185
|
-
// files.map(async (file) => {
|
|
186
|
-
// const mod = await import(pathToFileURL(path.join(dir, file)).toString());
|
|
187
|
-
// return mod.default as Tool;
|
|
188
|
-
// }),
|
|
189
|
-
// ),
|
|
190
|
-
// )
|
|
191
|
-
|
|
192
|
-
// return [...toolsManageTools, loadedTools]
|
|
193
|
-
|
|
194
|
-
// }
|
package/ts/graph_wip.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun --hot
|
|
2
|
-
|
|
3
|
-
import sflow from "sflow";
|
|
4
|
-
import pty from "./pty";
|
|
5
|
-
import { TerminalTextRender } from "terminal-render";
|
|
6
|
-
import { fromReadable, fromWritable } from "from-node-stream";
|
|
7
|
-
const rows = 10;
|
|
8
|
-
const nodes = singleton("shells", () => [
|
|
9
|
-
((p = pty.spawn("vi", ["./tmp/f1.log"], { name: "xterm", cols: 40, rows })) =>
|
|
10
|
-
({
|
|
11
|
-
readable: sflow(
|
|
12
|
-
new ReadableStream({
|
|
13
|
-
start: (c) => {
|
|
14
|
-
p.onData((e) => c.enqueue(e));
|
|
15
|
-
p.onExit((e) =>
|
|
16
|
-
e.exitCode === 0 ? c.close() : c.error(new Error("ExitError: " + e.exitCode)),
|
|
17
|
-
);
|
|
18
|
-
},
|
|
19
|
-
}),
|
|
20
|
-
),
|
|
21
|
-
writable: new WritableStream<string>({
|
|
22
|
-
write: (chunk) => p.write(chunk),
|
|
23
|
-
close: () => p.kill(),
|
|
24
|
-
}),
|
|
25
|
-
}) satisfies TransformStream<string, string>)(),
|
|
26
|
-
// ((p = pty.spawn("vi", ["./tmp/f2.log"], { name: "xterm", cols: 40, rows })) =>
|
|
27
|
-
// ({
|
|
28
|
-
// readable: sflow(
|
|
29
|
-
// new ReadableStream({
|
|
30
|
-
// start: (c) => {
|
|
31
|
-
// p.onData((e) => c.enqueue(e));
|
|
32
|
-
// p.onExit((e) =>
|
|
33
|
-
// e.exitCode === 0 ? c.close() : c.error(new Error("ExitError: " + e.exitCode)),
|
|
34
|
-
// );
|
|
35
|
-
// },
|
|
36
|
-
// }),
|
|
37
|
-
// ),
|
|
38
|
-
// writable: new WritableStream<string>({
|
|
39
|
-
// write: (chunk) => p.write(chunk),
|
|
40
|
-
// close: () => p.kill(),
|
|
41
|
-
// }),
|
|
42
|
-
// }) satisfies TransformStream<string, string>)(),
|
|
43
|
-
{ readable: sflow(fromReadable(process.stdin)), writable: fromWritable(process.stdout) },
|
|
44
|
-
]);
|
|
45
|
-
if (import.meta.main) {
|
|
46
|
-
process.stdin.setRawMode(true);
|
|
47
|
-
|
|
48
|
-
nodes[1]?.readable
|
|
49
|
-
.fork()
|
|
50
|
-
.map((e) => e.toString())
|
|
51
|
-
.pipeTo(nodes[1]?.writable!);
|
|
52
|
-
|
|
53
|
-
await sflow(nodes.values())
|
|
54
|
-
.map(async (node, i) => {
|
|
55
|
-
return node.readable.fork().map((text) => ({ i, text })); // prevent consumption of original stream
|
|
56
|
-
})
|
|
57
|
-
.confluenceByParallel()
|
|
58
|
-
.reduce(async (accum, { i, text }) => {
|
|
59
|
-
accum[i] ??= new TerminalTextRender();
|
|
60
|
-
accum[i].write(text);
|
|
61
|
-
return accum;
|
|
62
|
-
}, [])
|
|
63
|
-
.forEach(async (accum) => {
|
|
64
|
-
console.clear();
|
|
65
|
-
accum.forEach((t, i) => {
|
|
66
|
-
const tail = t.tail(rows);
|
|
67
|
-
console.log(`----- SHELL ${i} -----\n\n${tail}\n\n`);
|
|
68
|
-
});
|
|
69
|
-
})
|
|
70
|
-
.run();
|
|
71
|
-
}
|
|
72
|
-
function singleton<T>(key: string, factory: () => T): T {
|
|
73
|
-
const g = globalThis as any;
|
|
74
|
-
if (!g.__singleton_store__) g.__singleton_store__ = {};
|
|
75
|
-
if (!g.__singleton_store__[key]) {
|
|
76
|
-
g.__singleton_store__[key] = factory();
|
|
77
|
-
}
|
|
78
|
-
return g.__singleton_store__[key];
|
|
79
|
-
}
|
package/ts/signleton.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export function signleton<T>(fn: () => T): T {
|
|
2
|
-
const key = String(fn);
|
|
3
|
-
const g = globalThis as typeof globalThis & { __singleton_store?: Map<string, any>; };
|
|
4
|
-
g.__singleton_store ??= new Map<string, any>();
|
|
5
|
-
if (!g.__singleton_store.has(key)) g.__singleton_store.set(key, fn());
|
|
6
|
-
return g.__singleton_store.get(key);
|
|
7
|
-
}
|
package/ts/sleep.ts
DELETED