@ycodium-ai/agent-codex 0.2.2976 → 0.2.2980
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +10 -73
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2999,83 +2999,20 @@ function mapServerRequestToEvents(input) {
|
|
|
2999
2999
|
}
|
|
3000
3000
|
|
|
3001
3001
|
// src/openCommands.ts
|
|
3002
|
+
import {
|
|
3003
|
+
isPosixShellCommandFlag,
|
|
3004
|
+
isPowerShellExecutableName,
|
|
3005
|
+
posixShellCommandMatches,
|
|
3006
|
+
sameArgv,
|
|
3007
|
+
splitPosixCommand
|
|
3008
|
+
} from "@ycodium-ai/plugin-api/executor";
|
|
3002
3009
|
var WINDOWS_POWERSHELL_PREFIX = "try { [Console]::OutputEncoding=[System.Text.Encoding]::UTF8 } catch {}\n";
|
|
3003
|
-
var POWERSHELL_EXECUTABLES = /* @__PURE__ */ new Set(["powershell.exe", "pwsh.exe", "powershell", "pwsh"]);
|
|
3004
|
-
function splitPosixCommand(display) {
|
|
3005
|
-
const argv = [];
|
|
3006
|
-
let current = "";
|
|
3007
|
-
let inWord = false;
|
|
3008
|
-
let index = 0;
|
|
3009
|
-
while (index < display.length) {
|
|
3010
|
-
const char = display[index] ?? "";
|
|
3011
|
-
if (char === "'") {
|
|
3012
|
-
const end = display.indexOf("'", index + 1);
|
|
3013
|
-
if (end === -1) return null;
|
|
3014
|
-
current += display.slice(index + 1, end);
|
|
3015
|
-
inWord = true;
|
|
3016
|
-
index = end + 1;
|
|
3017
|
-
continue;
|
|
3018
|
-
}
|
|
3019
|
-
if (char === '"') {
|
|
3020
|
-
index += 1;
|
|
3021
|
-
let closed = false;
|
|
3022
|
-
while (index < display.length) {
|
|
3023
|
-
const inner = display[index] ?? "";
|
|
3024
|
-
if (inner === '"') {
|
|
3025
|
-
closed = true;
|
|
3026
|
-
index += 1;
|
|
3027
|
-
break;
|
|
3028
|
-
}
|
|
3029
|
-
const next = display[index + 1];
|
|
3030
|
-
if (inner === "\\" && next !== void 0 && '$`"\\\n'.includes(next)) {
|
|
3031
|
-
current += next;
|
|
3032
|
-
index += 2;
|
|
3033
|
-
continue;
|
|
3034
|
-
}
|
|
3035
|
-
current += inner;
|
|
3036
|
-
index += 1;
|
|
3037
|
-
}
|
|
3038
|
-
if (!closed) return null;
|
|
3039
|
-
inWord = true;
|
|
3040
|
-
continue;
|
|
3041
|
-
}
|
|
3042
|
-
if (char === "\\") {
|
|
3043
|
-
const next = display[index + 1];
|
|
3044
|
-
if (next === void 0) return null;
|
|
3045
|
-
current += next;
|
|
3046
|
-
inWord = true;
|
|
3047
|
-
index += 2;
|
|
3048
|
-
continue;
|
|
3049
|
-
}
|
|
3050
|
-
if (char === " " || char === " " || char === "\n") {
|
|
3051
|
-
if (inWord) argv.push(current);
|
|
3052
|
-
current = "";
|
|
3053
|
-
inWord = false;
|
|
3054
|
-
index += 1;
|
|
3055
|
-
continue;
|
|
3056
|
-
}
|
|
3057
|
-
current += char;
|
|
3058
|
-
inWord = true;
|
|
3059
|
-
index += 1;
|
|
3060
|
-
}
|
|
3061
|
-
if (inWord) argv.push(current);
|
|
3062
|
-
return argv;
|
|
3063
|
-
}
|
|
3064
|
-
var sameArgv = (left, right) => left.length === right.length && left.every((arg, index) => arg === right[index]);
|
|
3065
|
-
var SHELL_COMMAND_FLAGS = /* @__PURE__ */ new Set(["-lc", "-c"]);
|
|
3066
|
-
var posixBasename = (path) => path.slice(path.lastIndexOf("/") + 1);
|
|
3067
3010
|
function posixCommandMatches(expected, argv) {
|
|
3068
3011
|
if (sameArgv(argv, expected)) return true;
|
|
3069
3012
|
const [shell, flag, script] = expected;
|
|
3070
3013
|
if (expected.length !== 3 || shell === void 0 || script === void 0) return false;
|
|
3071
|
-
if (flag === void 0 || !
|
|
3072
|
-
|
|
3073
|
-
return true;
|
|
3074
|
-
}
|
|
3075
|
-
const words = splitPosixCommand(script);
|
|
3076
|
-
if (words === null || words.length === 0) return false;
|
|
3077
|
-
if (sameArgv(argv, words)) return true;
|
|
3078
|
-
return argv.length === words.length + 1 && posixBasename(argv[1] ?? "") === posixBasename(words[0] ?? "") && sameArgv(argv.slice(2), words.slice(1));
|
|
3014
|
+
if (flag === void 0 || !isPosixShellCommandFlag(flag)) return false;
|
|
3015
|
+
return posixShellCommandMatches({ shell, script }, argv);
|
|
3079
3016
|
}
|
|
3080
3017
|
var windowsPath = (path) => path.replaceAll("/", "\\").toLowerCase();
|
|
3081
3018
|
function basename(path) {
|
|
@@ -3096,7 +3033,7 @@ function codexCommandMatcher(display) {
|
|
|
3096
3033
|
return expectedRest.every((arg, index) => {
|
|
3097
3034
|
const actual = actualRest[index];
|
|
3098
3035
|
if (actual === arg) return true;
|
|
3099
|
-
return index === lastIndex && index >= 1 && expectedRest[index - 1]?.toLowerCase() === "-command" &&
|
|
3036
|
+
return index === lastIndex && index >= 1 && expectedRest[index - 1]?.toLowerCase() === "-command" && isPowerShellExecutableName(basename(expectedExe)) && actual === WINDOWS_POWERSHELL_PREFIX + arg;
|
|
3100
3037
|
});
|
|
3101
3038
|
};
|
|
3102
3039
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/agent-codex",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2980",
|
|
4
4
|
"description": "Codex executor: Codex CLI over the app-server JSON-RPC protocol.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ycodium",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"tailwindcss": "^4.0.0",
|
|
30
30
|
"typescript": "~6.0.3",
|
|
31
31
|
"vite-plus": "0.2.2",
|
|
32
|
-
"@ycodium-ai/plugin-api": "0.2.
|
|
32
|
+
"@ycodium-ai/plugin-api": "0.2.2980",
|
|
33
33
|
"ycodium-executor-testing": "0.0.0"
|
|
34
34
|
},
|
|
35
35
|
"ycodium": {
|