orion-super-agent-dev 0.1.11 → 0.1.12
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/out/brains/darwin-arm64/orion-brain +0 -0
- package/out/brains/darwin-x64/orion-brain +0 -0
- package/out/brains/linux-arm64/orion-brain +0 -0
- package/out/brains/linux-x64/orion-brain +0 -0
- package/out/brains/win32-x64/orion-brain.exe +0 -0
- package/out/main.js +649 -28
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/out/main.js
CHANGED
|
@@ -28185,6 +28185,10 @@ var require_protocol = __commonJS({
|
|
|
28185
28185
|
"bash_background",
|
|
28186
28186
|
"bash_check",
|
|
28187
28187
|
"bash_stop",
|
|
28188
|
+
// Client-executed like the bash family. Whether it is OFFERED is a separate
|
|
28189
|
+
// question the backend answers from the client's advertised capabilities —
|
|
28190
|
+
// this set only says who runs it.
|
|
28191
|
+
"powershell",
|
|
28188
28192
|
"lsp_symbols",
|
|
28189
28193
|
"lsp_goto_definition",
|
|
28190
28194
|
"lsp_references",
|
|
@@ -29360,6 +29364,107 @@ var require_scratchpad = __commonJS({
|
|
|
29360
29364
|
}
|
|
29361
29365
|
});
|
|
29362
29366
|
|
|
29367
|
+
// ../packages/orion-client-core/dist/wellFormed.js
|
|
29368
|
+
var require_wellFormed = __commonJS({
|
|
29369
|
+
"../packages/orion-client-core/dist/wellFormed.js"(exports2) {
|
|
29370
|
+
"use strict";
|
|
29371
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
29372
|
+
exports2.splitsSurrogatePair = splitsSurrogatePair;
|
|
29373
|
+
exports2.toWellFormedString = toWellFormedString;
|
|
29374
|
+
exports2.toWellFormedJsonDeep = toWellFormedJsonDeep;
|
|
29375
|
+
var HIGH_SURROGATE_START = 55296;
|
|
29376
|
+
var HIGH_SURROGATE_END = 56319;
|
|
29377
|
+
var LOW_SURROGATE_START = 56320;
|
|
29378
|
+
var LOW_SURROGATE_END = 57343;
|
|
29379
|
+
var REPLACEMENT_CHAR = "\uFFFD";
|
|
29380
|
+
var HAS_NATIVE = typeof String.prototype.isWellFormed === "function" && typeof String.prototype.toWellFormed === "function";
|
|
29381
|
+
function isHighSurrogate(unit) {
|
|
29382
|
+
return unit >= HIGH_SURROGATE_START && unit <= HIGH_SURROGATE_END;
|
|
29383
|
+
}
|
|
29384
|
+
function isLowSurrogate(unit) {
|
|
29385
|
+
return unit >= LOW_SURROGATE_START && unit <= LOW_SURROGATE_END;
|
|
29386
|
+
}
|
|
29387
|
+
function splitsSurrogatePair(s, index) {
|
|
29388
|
+
if (index <= 0 || index >= s.length)
|
|
29389
|
+
return false;
|
|
29390
|
+
return isHighSurrogate(s.charCodeAt(index - 1)) && isLowSurrogate(s.charCodeAt(index));
|
|
29391
|
+
}
|
|
29392
|
+
function manualToWellFormed(s) {
|
|
29393
|
+
let dirty = false;
|
|
29394
|
+
for (let i2 = 0; i2 < s.length; i2++) {
|
|
29395
|
+
const unit = s.charCodeAt(i2);
|
|
29396
|
+
if (isHighSurrogate(unit)) {
|
|
29397
|
+
if (isLowSurrogate(s.charCodeAt(i2 + 1))) {
|
|
29398
|
+
i2++;
|
|
29399
|
+
} else {
|
|
29400
|
+
dirty = true;
|
|
29401
|
+
break;
|
|
29402
|
+
}
|
|
29403
|
+
} else if (isLowSurrogate(unit)) {
|
|
29404
|
+
dirty = true;
|
|
29405
|
+
break;
|
|
29406
|
+
}
|
|
29407
|
+
}
|
|
29408
|
+
if (!dirty)
|
|
29409
|
+
return s;
|
|
29410
|
+
let out2 = "";
|
|
29411
|
+
for (let i2 = 0; i2 < s.length; i2++) {
|
|
29412
|
+
const unit = s.charCodeAt(i2);
|
|
29413
|
+
if (isHighSurrogate(unit) && isLowSurrogate(s.charCodeAt(i2 + 1))) {
|
|
29414
|
+
out2 += s[i2] + s[i2 + 1];
|
|
29415
|
+
i2++;
|
|
29416
|
+
} else if (isHighSurrogate(unit) || isLowSurrogate(unit)) {
|
|
29417
|
+
out2 += REPLACEMENT_CHAR;
|
|
29418
|
+
} else {
|
|
29419
|
+
out2 += s[i2];
|
|
29420
|
+
}
|
|
29421
|
+
}
|
|
29422
|
+
return out2;
|
|
29423
|
+
}
|
|
29424
|
+
function toWellFormedString(s) {
|
|
29425
|
+
if (HAS_NATIVE) {
|
|
29426
|
+
const api = s;
|
|
29427
|
+
return api.isWellFormed() ? s : api.toWellFormed();
|
|
29428
|
+
}
|
|
29429
|
+
return manualToWellFormed(s);
|
|
29430
|
+
}
|
|
29431
|
+
function toWellFormedJsonDeep(value) {
|
|
29432
|
+
if (typeof value === "string") {
|
|
29433
|
+
return toWellFormedString(value);
|
|
29434
|
+
}
|
|
29435
|
+
if (Array.isArray(value)) {
|
|
29436
|
+
let copy;
|
|
29437
|
+
for (let i2 = 0; i2 < value.length; i2++) {
|
|
29438
|
+
const repaired = toWellFormedJsonDeep(value[i2]);
|
|
29439
|
+
if (repaired !== value[i2] && copy === void 0)
|
|
29440
|
+
copy = value.slice();
|
|
29441
|
+
if (copy !== void 0)
|
|
29442
|
+
copy[i2] = repaired;
|
|
29443
|
+
}
|
|
29444
|
+
return copy ?? value;
|
|
29445
|
+
}
|
|
29446
|
+
if (typeof value === "object" && value !== null) {
|
|
29447
|
+
const record = value;
|
|
29448
|
+
let copy;
|
|
29449
|
+
for (const key of Object.keys(record)) {
|
|
29450
|
+
const cleanKey = toWellFormedString(key);
|
|
29451
|
+
const repaired = toWellFormedJsonDeep(record[key]);
|
|
29452
|
+
if ((cleanKey !== key || repaired !== record[key]) && copy === void 0) {
|
|
29453
|
+
copy = { ...record };
|
|
29454
|
+
}
|
|
29455
|
+
if (copy !== void 0) {
|
|
29456
|
+
if (cleanKey !== key)
|
|
29457
|
+
delete copy[key];
|
|
29458
|
+
copy[cleanKey] = repaired;
|
|
29459
|
+
}
|
|
29460
|
+
}
|
|
29461
|
+
return copy ?? value;
|
|
29462
|
+
}
|
|
29463
|
+
return value;
|
|
29464
|
+
}
|
|
29465
|
+
}
|
|
29466
|
+
});
|
|
29467
|
+
|
|
29363
29468
|
// ../packages/orion-client-core/dist/wikiBundle.js
|
|
29364
29469
|
var require_wikiBundle = __commonJS({
|
|
29365
29470
|
"../packages/orion-client-core/dist/wikiBundle.js"(exports2) {
|
|
@@ -30008,6 +30113,7 @@ var require_segmentDriver = __commonJS({
|
|
|
30008
30113
|
var memoryIndex_js_1 = require_memoryIndex();
|
|
30009
30114
|
var pathResolution_js_1 = require_pathResolution();
|
|
30010
30115
|
var scratchpad_js_1 = require_scratchpad();
|
|
30116
|
+
var wellFormed_js_1 = require_wellFormed();
|
|
30011
30117
|
var orionSnapshot_js_1 = require_orionSnapshot();
|
|
30012
30118
|
var toolConcurrency_js_1 = require_toolConcurrency();
|
|
30013
30119
|
function turnAbortController() {
|
|
@@ -30299,7 +30405,7 @@ var require_segmentDriver = __commonJS({
|
|
|
30299
30405
|
const queued = start2.drainQueuedInput?.();
|
|
30300
30406
|
if (queued && queued.length > 0)
|
|
30301
30407
|
body2.queued_input = queued;
|
|
30302
|
-
return body2;
|
|
30408
|
+
return (0, wellFormed_js_1.toWellFormedJsonDeep)(body2);
|
|
30303
30409
|
}
|
|
30304
30410
|
function applyRouting(body2, routing) {
|
|
30305
30411
|
if (!routing)
|
|
@@ -32383,6 +32489,7 @@ var require_agentNarration = __commonJS({
|
|
|
32383
32489
|
return `Editing ${base(input.path)}`;
|
|
32384
32490
|
case "bash":
|
|
32385
32491
|
case "bash_background":
|
|
32492
|
+
case "powershell":
|
|
32386
32493
|
return `Running ${clip(input.command, 48)}`;
|
|
32387
32494
|
case "grep":
|
|
32388
32495
|
return `Grepping "${clip(input.pattern, 40)}"`;
|
|
@@ -36861,7 +36968,7 @@ var require_searchCommands = __commonJS({
|
|
|
36861
36968
|
"../packages/orion-client-core/dist/searchCommands.js"(exports2) {
|
|
36862
36969
|
"use strict";
|
|
36863
36970
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
36864
|
-
exports2.ALWAYS_EXCLUDE_GLOBS = void 0;
|
|
36971
|
+
exports2.GREP_DEFAULT_MAX_RESULTS = exports2.GREP_MAX_COLUMNS = exports2.ALWAYS_EXCLUDE_GLOBS = exports2.ALWAYS_EXCLUDE_GLOB_VALUES = void 0;
|
|
36865
36972
|
exports2.shq = shq;
|
|
36866
36973
|
exports2.normalizeContextLines = normalizeContextLines;
|
|
36867
36974
|
exports2.normalizeOutputMode = normalizeOutputMode;
|
|
@@ -36872,14 +36979,15 @@ var require_searchCommands = __commonJS({
|
|
|
36872
36979
|
exports2.buildGrepRg = buildGrepRg;
|
|
36873
36980
|
exports2.buildGrepPosix = buildGrepPosix;
|
|
36874
36981
|
exports2.truncateSearchOutput = truncateSearchOutput;
|
|
36875
|
-
exports2.
|
|
36982
|
+
exports2.ALWAYS_EXCLUDE_GLOB_VALUES = ["!**/node_modules/**", "!**/.git/**"];
|
|
36983
|
+
exports2.ALWAYS_EXCLUDE_GLOBS = exports2.ALWAYS_EXCLUDE_GLOB_VALUES.map((g2) => `'${g2}'`);
|
|
36876
36984
|
function shq(s) {
|
|
36877
36985
|
return JSON.stringify(s);
|
|
36878
36986
|
}
|
|
36879
36987
|
var CTX_MIN = 0;
|
|
36880
36988
|
var CTX_MAX = 50;
|
|
36881
|
-
|
|
36882
|
-
|
|
36989
|
+
exports2.GREP_MAX_COLUMNS = 400;
|
|
36990
|
+
exports2.GREP_DEFAULT_MAX_RESULTS = 200;
|
|
36883
36991
|
function withEarlyExit(command, cap, offset = 0) {
|
|
36884
36992
|
const skip = Math.max(0, Math.trunc(offset));
|
|
36885
36993
|
const pipe = skip > 0 ? ` | tail -n +${skip + 1} | head -n ${cap}` : ` | head -n ${cap}`;
|
|
@@ -36967,7 +37075,7 @@ var require_searchCommands = __commonJS({
|
|
|
36967
37075
|
const searchPath = p.path ?? ".";
|
|
36968
37076
|
const mode = normalizeOutputMode(p.outputMode);
|
|
36969
37077
|
const ctx = normalizeContextLines(p.contextLines);
|
|
36970
|
-
const cap = (p.maxResults ?? GREP_DEFAULT_MAX_RESULTS) + 1;
|
|
37078
|
+
const cap = (p.maxResults ?? exports2.GREP_DEFAULT_MAX_RESULTS) + 1;
|
|
36971
37079
|
const parts2 = [
|
|
36972
37080
|
shq(rgPath),
|
|
36973
37081
|
"--no-heading",
|
|
@@ -36985,7 +37093,7 @@ var require_searchCommands = __commonJS({
|
|
|
36985
37093
|
if (mode === "content" && ctx > 0)
|
|
36986
37094
|
parts2.push(`-C ${ctx}`);
|
|
36987
37095
|
if (mode === "content")
|
|
36988
|
-
parts2.push(`--max-columns=${GREP_MAX_COLUMNS}`, "--max-columns-preview");
|
|
37096
|
+
parts2.push(`--max-columns=${exports2.GREP_MAX_COLUMNS}`, "--max-columns-preview");
|
|
36989
37097
|
if (p.includeIgnored)
|
|
36990
37098
|
parts2.push("--no-ignore", "--hidden");
|
|
36991
37099
|
for (const g2 of exports2.ALWAYS_EXCLUDE_GLOBS)
|
|
@@ -37003,7 +37111,7 @@ var require_searchCommands = __commonJS({
|
|
|
37003
37111
|
const searchPath = p.path ?? ".";
|
|
37004
37112
|
const mode = normalizeOutputMode(p.outputMode);
|
|
37005
37113
|
const ctx = normalizeContextLines(p.contextLines);
|
|
37006
|
-
const cap = (p.maxResults ?? GREP_DEFAULT_MAX_RESULTS) + 1;
|
|
37114
|
+
const cap = (p.maxResults ?? exports2.GREP_DEFAULT_MAX_RESULTS) + 1;
|
|
37007
37115
|
const parts2 = ["grep", "-rn"];
|
|
37008
37116
|
if (p.caseInsensitive)
|
|
37009
37117
|
parts2.push("-i");
|
|
@@ -37567,6 +37675,7 @@ var require_toolText = __commonJS({
|
|
|
37567
37675
|
exports2.resolveOldString = resolveOldString;
|
|
37568
37676
|
exports2.isStaleAgainst = isStaleAgainst;
|
|
37569
37677
|
exports2.headTailTruncate = headTailTruncate;
|
|
37678
|
+
var wellFormed_js_1 = require_wellFormed();
|
|
37570
37679
|
function numberLines(lines, firstLineNo) {
|
|
37571
37680
|
return lines.map((l3, i2) => `${firstLineNo + i2} ${l3}`).join("\n");
|
|
37572
37681
|
}
|
|
@@ -37619,8 +37728,10 @@ var require_toolText = __commonJS({
|
|
|
37619
37728
|
function headTailTruncate(s, head, tail) {
|
|
37620
37729
|
if (s.length <= head + tail)
|
|
37621
37730
|
return s;
|
|
37622
|
-
const
|
|
37623
|
-
const
|
|
37731
|
+
const headEnd = (0, wellFormed_js_1.splitsSurrogatePair)(s, head) ? head - 1 : head;
|
|
37732
|
+
const tailStart = (0, wellFormed_js_1.splitsSurrogatePair)(s, s.length - tail) ? s.length - tail + 1 : s.length - tail;
|
|
37733
|
+
const headPart = s.slice(0, headEnd);
|
|
37734
|
+
const tailPart = s.slice(tailStart);
|
|
37624
37735
|
const headCut = headPart.lastIndexOf("\n");
|
|
37625
37736
|
const tailCut = tailPart.indexOf("\n");
|
|
37626
37737
|
const headClean = headCut > 0 ? headPart.slice(0, headCut) : headPart;
|
|
@@ -49474,6 +49585,7 @@ var require_bashResolver = __commonJS({
|
|
|
49474
49585
|
exports2.resetBashResolverCacheForTests = resetBashResolverCacheForTests;
|
|
49475
49586
|
exports2.resolveBashFile = resolveBashFile;
|
|
49476
49587
|
exports2.bashInvocation = bashInvocation2;
|
|
49588
|
+
exports2.isBashAvailable = isBashAvailable;
|
|
49477
49589
|
var fs_1 = __require("fs");
|
|
49478
49590
|
var path13 = __importStar(__require("path"));
|
|
49479
49591
|
var BashUnavailableError = class extends Error {
|
|
@@ -49500,7 +49612,7 @@ var require_bashResolver = __commonJS({
|
|
|
49500
49612
|
return ["System32", "Sysnative", "SysWOW64"].some((sys) => normalized.startsWith(w2.resolve(systemRoot, sys).toLowerCase()));
|
|
49501
49613
|
}
|
|
49502
49614
|
function windowsPathDirs(env3) {
|
|
49503
|
-
return (env3.PATH ?? env3.Path ?? "").split(";").filter(Boolean);
|
|
49615
|
+
return (env3.PATH ?? env3.Path ?? "").split(";").filter(Boolean).filter((dir) => w2.isAbsolute(dir));
|
|
49504
49616
|
}
|
|
49505
49617
|
function gitBashCandidates(env3) {
|
|
49506
49618
|
const roots = [];
|
|
@@ -49553,6 +49665,134 @@ var require_bashResolver = __commonJS({
|
|
|
49553
49665
|
function bashInvocation2(command, opts) {
|
|
49554
49666
|
return { file: resolveBashFile(opts), args: ["-lc", command] };
|
|
49555
49667
|
}
|
|
49668
|
+
function isBashAvailable(opts = {}) {
|
|
49669
|
+
try {
|
|
49670
|
+
resolveBashFile(opts);
|
|
49671
|
+
return true;
|
|
49672
|
+
} catch (error) {
|
|
49673
|
+
if (error instanceof BashUnavailableError)
|
|
49674
|
+
return false;
|
|
49675
|
+
throw error;
|
|
49676
|
+
}
|
|
49677
|
+
}
|
|
49678
|
+
}
|
|
49679
|
+
});
|
|
49680
|
+
|
|
49681
|
+
// ../packages/orion-client-core/dist/powershellResolver.js
|
|
49682
|
+
var require_powershellResolver = __commonJS({
|
|
49683
|
+
"../packages/orion-client-core/dist/powershellResolver.js"(exports2) {
|
|
49684
|
+
"use strict";
|
|
49685
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m2, k, k2) {
|
|
49686
|
+
if (k2 === void 0) k2 = k;
|
|
49687
|
+
var desc = Object.getOwnPropertyDescriptor(m2, k);
|
|
49688
|
+
if (!desc || ("get" in desc ? !m2.__esModule : desc.writable || desc.configurable)) {
|
|
49689
|
+
desc = { enumerable: true, get: function() {
|
|
49690
|
+
return m2[k];
|
|
49691
|
+
} };
|
|
49692
|
+
}
|
|
49693
|
+
Object.defineProperty(o, k2, desc);
|
|
49694
|
+
} : function(o, m2, k, k2) {
|
|
49695
|
+
if (k2 === void 0) k2 = k;
|
|
49696
|
+
o[k2] = m2[k];
|
|
49697
|
+
});
|
|
49698
|
+
var __setModuleDefault = exports2 && exports2.__setModuleDefault || (Object.create ? function(o, v2) {
|
|
49699
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v2 });
|
|
49700
|
+
} : function(o, v2) {
|
|
49701
|
+
o["default"] = v2;
|
|
49702
|
+
});
|
|
49703
|
+
var __importStar = exports2 && exports2.__importStar || /* @__PURE__ */ function() {
|
|
49704
|
+
var ownKeys = function(o) {
|
|
49705
|
+
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
49706
|
+
var ar = [];
|
|
49707
|
+
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
49708
|
+
return ar;
|
|
49709
|
+
};
|
|
49710
|
+
return ownKeys(o);
|
|
49711
|
+
};
|
|
49712
|
+
return function(mod) {
|
|
49713
|
+
if (mod && mod.__esModule) return mod;
|
|
49714
|
+
var result = {};
|
|
49715
|
+
if (mod != null) {
|
|
49716
|
+
for (var k = ownKeys(mod), i2 = 0; i2 < k.length; i2++) if (k[i2] !== "default") __createBinding(result, mod, k[i2]);
|
|
49717
|
+
}
|
|
49718
|
+
__setModuleDefault(result, mod);
|
|
49719
|
+
return result;
|
|
49720
|
+
};
|
|
49721
|
+
}();
|
|
49722
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
49723
|
+
exports2.PowerShellUnavailableError = void 0;
|
|
49724
|
+
exports2.resetPowerShellResolverCacheForTests = resetPowerShellResolverCacheForTests;
|
|
49725
|
+
exports2.resolvePowerShellFile = resolvePowerShellFile;
|
|
49726
|
+
exports2.powershellInvocation = powershellInvocation;
|
|
49727
|
+
exports2.isPowerShellFallbackActive = isPowerShellFallbackActive;
|
|
49728
|
+
exports2.platformCapabilities = platformCapabilities2;
|
|
49729
|
+
var fs_1 = __require("fs");
|
|
49730
|
+
var path13 = __importStar(__require("path"));
|
|
49731
|
+
var bashResolver_1 = require_bashResolver();
|
|
49732
|
+
var PowerShellUnavailableError = class extends Error {
|
|
49733
|
+
constructor(message) {
|
|
49734
|
+
super(message);
|
|
49735
|
+
this.name = "PowerShellUnavailableError";
|
|
49736
|
+
}
|
|
49737
|
+
};
|
|
49738
|
+
exports2.PowerShellUnavailableError = PowerShellUnavailableError;
|
|
49739
|
+
var w2 = path13.win32;
|
|
49740
|
+
var BASE_ARGS = ["-NoProfile", "-NonInteractive", "-Command"];
|
|
49741
|
+
function candidates(env3) {
|
|
49742
|
+
const systemRoot = env3.SystemRoot ?? env3.windir ?? "C:\\Windows";
|
|
49743
|
+
const programFiles = env3.ProgramFiles ?? "C:\\Program Files";
|
|
49744
|
+
const found = [];
|
|
49745
|
+
for (const major of ["7", "8"]) {
|
|
49746
|
+
found.push(w2.join(programFiles, "PowerShell", major, "pwsh.exe"));
|
|
49747
|
+
}
|
|
49748
|
+
for (const dir of (env3.PATH ?? env3.Path ?? "").split(";").filter(Boolean)) {
|
|
49749
|
+
if (w2.isAbsolute(dir))
|
|
49750
|
+
found.push(w2.join(dir, "pwsh.exe"));
|
|
49751
|
+
}
|
|
49752
|
+
found.push(w2.join(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe"));
|
|
49753
|
+
return [...new Set(found)];
|
|
49754
|
+
}
|
|
49755
|
+
var cachedFile;
|
|
49756
|
+
function resetPowerShellResolverCacheForTests() {
|
|
49757
|
+
cachedFile = void 0;
|
|
49758
|
+
}
|
|
49759
|
+
function resolvePowerShellFile(opts = {}) {
|
|
49760
|
+
if (cachedFile !== void 0 && opts.platform === void 0)
|
|
49761
|
+
return cachedFile;
|
|
49762
|
+
const platform2 = opts.platform ?? process.platform;
|
|
49763
|
+
const exists = opts.existsSync ?? fs_1.existsSync;
|
|
49764
|
+
const env3 = opts.env ?? process.env;
|
|
49765
|
+
if (platform2 !== "win32") {
|
|
49766
|
+
throw new PowerShellUnavailableError("The powershell tool is Windows-only; other platforms run commands through bash.");
|
|
49767
|
+
}
|
|
49768
|
+
for (const candidate of candidates(env3)) {
|
|
49769
|
+
if (exists(candidate)) {
|
|
49770
|
+
if (opts.platform === void 0)
|
|
49771
|
+
cachedFile = candidate;
|
|
49772
|
+
return candidate;
|
|
49773
|
+
}
|
|
49774
|
+
}
|
|
49775
|
+
throw new PowerShellUnavailableError("No PowerShell interpreter was found on this Windows machine (looked for pwsh.exe and the system powershell.exe). Install Git for Windows (https://git-scm.com/download/win) to run commands through bash instead.");
|
|
49776
|
+
}
|
|
49777
|
+
function powershellInvocation(command, opts) {
|
|
49778
|
+
return { file: resolvePowerShellFile(opts), args: [...BASE_ARGS, command] };
|
|
49779
|
+
}
|
|
49780
|
+
function isPowerShellFallbackActive(opts = {}) {
|
|
49781
|
+
const platform2 = opts.platform ?? process.platform;
|
|
49782
|
+
if (platform2 !== "win32")
|
|
49783
|
+
return false;
|
|
49784
|
+
if ((0, bashResolver_1.isBashAvailable)(opts))
|
|
49785
|
+
return false;
|
|
49786
|
+
try {
|
|
49787
|
+
resolvePowerShellFile(opts);
|
|
49788
|
+
return true;
|
|
49789
|
+
} catch {
|
|
49790
|
+
return false;
|
|
49791
|
+
}
|
|
49792
|
+
}
|
|
49793
|
+
function platformCapabilities2(opts = {}) {
|
|
49794
|
+
return isPowerShellFallbackActive(opts) ? ["powershell"] : [];
|
|
49795
|
+
}
|
|
49556
49796
|
}
|
|
49557
49797
|
});
|
|
49558
49798
|
|
|
@@ -50355,6 +50595,187 @@ var require_permissions = __commonJS({
|
|
|
50355
50595
|
}
|
|
50356
50596
|
});
|
|
50357
50597
|
|
|
50598
|
+
// ../packages/orion-client-core/dist/bashCommandRewrite.js
|
|
50599
|
+
var require_bashCommandRewrite = __commonJS({
|
|
50600
|
+
"../packages/orion-client-core/dist/bashCommandRewrite.js"(exports2) {
|
|
50601
|
+
"use strict";
|
|
50602
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
50603
|
+
exports2.rewriteWindowsNullRedirect = rewriteWindowsNullRedirect;
|
|
50604
|
+
exports2.normalizeShellCommand = normalizeShellCommand;
|
|
50605
|
+
var NUL_REDIRECT_RE = /(\d?&?>+\s*)[Nn][Uu][Ll](?=\s|$|[|&;)\n])/g;
|
|
50606
|
+
function rewriteWindowsNullRedirect(command) {
|
|
50607
|
+
return command.replace(NUL_REDIRECT_RE, "$1/dev/null");
|
|
50608
|
+
}
|
|
50609
|
+
function normalizeShellCommand(command, platform2 = process.platform) {
|
|
50610
|
+
if (platform2 !== "win32")
|
|
50611
|
+
return command;
|
|
50612
|
+
return rewriteWindowsNullRedirect(command);
|
|
50613
|
+
}
|
|
50614
|
+
}
|
|
50615
|
+
});
|
|
50616
|
+
|
|
50617
|
+
// ../packages/orion-client-core/dist/searchArgv.js
|
|
50618
|
+
var require_searchArgv = __commonJS({
|
|
50619
|
+
"../packages/orion-client-core/dist/searchArgv.js"(exports2) {
|
|
50620
|
+
"use strict";
|
|
50621
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
50622
|
+
exports2.globArgv = globArgv;
|
|
50623
|
+
exports2.grepArgv = grepArgv;
|
|
50624
|
+
exports2.grepLineBudget = grepLineBudget;
|
|
50625
|
+
var searchCommands_1 = require_searchCommands();
|
|
50626
|
+
function globArgv(p) {
|
|
50627
|
+
const args2 = ["--files", "--hidden", "--follow", "-g", p.pattern];
|
|
50628
|
+
for (const glob of searchCommands_1.ALWAYS_EXCLUDE_GLOB_VALUES)
|
|
50629
|
+
args2.push("-g", glob);
|
|
50630
|
+
args2.push("--", p.path ?? ".");
|
|
50631
|
+
return args2;
|
|
50632
|
+
}
|
|
50633
|
+
function grepArgv(p) {
|
|
50634
|
+
const mode = (0, searchCommands_1.normalizeOutputMode)(p.outputMode);
|
|
50635
|
+
const ctx = (0, searchCommands_1.normalizeContextLines)(p.contextLines);
|
|
50636
|
+
const args2 = ["--no-heading", "--color=never", "-n", "--sort=path"];
|
|
50637
|
+
if (p.caseInsensitive)
|
|
50638
|
+
args2.push("-i");
|
|
50639
|
+
if (p.multiline)
|
|
50640
|
+
args2.push("-U", "--multiline");
|
|
50641
|
+
if (mode === "content" && ctx > 0)
|
|
50642
|
+
args2.push("-C", String(ctx));
|
|
50643
|
+
if (mode === "content")
|
|
50644
|
+
args2.push(`--max-columns=${searchCommands_1.GREP_MAX_COLUMNS}`, "--max-columns-preview");
|
|
50645
|
+
if (p.includeIgnored)
|
|
50646
|
+
args2.push("--no-ignore", "--hidden");
|
|
50647
|
+
for (const glob of searchCommands_1.ALWAYS_EXCLUDE_GLOB_VALUES)
|
|
50648
|
+
args2.push("-g", glob);
|
|
50649
|
+
if (p.glob)
|
|
50650
|
+
args2.push("-g", p.glob);
|
|
50651
|
+
if (mode === "files_with_matches")
|
|
50652
|
+
args2.push("-l");
|
|
50653
|
+
else if (mode === "count")
|
|
50654
|
+
args2.push("-c");
|
|
50655
|
+
args2.push("-e", p.pattern, "--", p.path ?? ".");
|
|
50656
|
+
return args2;
|
|
50657
|
+
}
|
|
50658
|
+
function grepLineBudget(p) {
|
|
50659
|
+
return (p.maxResults ?? searchCommands_1.GREP_DEFAULT_MAX_RESULTS) + 1;
|
|
50660
|
+
}
|
|
50661
|
+
}
|
|
50662
|
+
});
|
|
50663
|
+
|
|
50664
|
+
// ../packages/orion-client-core/dist/processHardening.js
|
|
50665
|
+
var require_processHardening = __commonJS({
|
|
50666
|
+
"../packages/orion-client-core/dist/processHardening.js"(exports2) {
|
|
50667
|
+
"use strict";
|
|
50668
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
50669
|
+
exports2.HIDDEN_WINDOW_SPAWN_OPTIONS = void 0;
|
|
50670
|
+
exports2.killChild = killChild;
|
|
50671
|
+
exports2.hardenExecutableSearchPath = hardenExecutableSearchPath;
|
|
50672
|
+
exports2.HIDDEN_WINDOW_SPAWN_OPTIONS = { windowsHide: true };
|
|
50673
|
+
function killChild(child, signal = "SIGTERM", platform2 = process.platform) {
|
|
50674
|
+
try {
|
|
50675
|
+
if (platform2 === "win32")
|
|
50676
|
+
child.kill();
|
|
50677
|
+
else
|
|
50678
|
+
child.kill(signal);
|
|
50679
|
+
} catch {
|
|
50680
|
+
}
|
|
50681
|
+
}
|
|
50682
|
+
function hardenExecutableSearchPath(env3 = process.env, platform2 = process.platform) {
|
|
50683
|
+
if (platform2 !== "win32")
|
|
50684
|
+
return;
|
|
50685
|
+
env3.NoDefaultCurrentDirectoryInExePath = "1";
|
|
50686
|
+
}
|
|
50687
|
+
}
|
|
50688
|
+
});
|
|
50689
|
+
|
|
50690
|
+
// ../packages/orion-client-core/dist/searchRg.js
|
|
50691
|
+
var require_searchRg = __commonJS({
|
|
50692
|
+
"../packages/orion-client-core/dist/searchRg.js"(exports2) {
|
|
50693
|
+
"use strict";
|
|
50694
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
50695
|
+
exports2.spawnRg = void 0;
|
|
50696
|
+
var child_process_1 = __require("child_process");
|
|
50697
|
+
var processHardening_1 = require_processHardening();
|
|
50698
|
+
function isSuccessExit(code) {
|
|
50699
|
+
return code === 0 || code === 1;
|
|
50700
|
+
}
|
|
50701
|
+
function keepLines(text, max) {
|
|
50702
|
+
const lines = text.split("\n");
|
|
50703
|
+
if (lines.length <= max)
|
|
50704
|
+
return text;
|
|
50705
|
+
return lines.slice(0, max).join("\n") + "\n";
|
|
50706
|
+
}
|
|
50707
|
+
var spawnRg = (opts) => new Promise((resolve5, reject) => {
|
|
50708
|
+
const child = (0, child_process_1.spawn)(opts.rgPath, opts.args, {
|
|
50709
|
+
...processHardening_1.HIDDEN_WINDOW_SPAWN_OPTIONS,
|
|
50710
|
+
cwd: opts.cwd,
|
|
50711
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
50712
|
+
});
|
|
50713
|
+
let stdout = "";
|
|
50714
|
+
let stderr = "";
|
|
50715
|
+
let lines = 0;
|
|
50716
|
+
let cappedEarly = false;
|
|
50717
|
+
let timedOut = false;
|
|
50718
|
+
let settled = false;
|
|
50719
|
+
const finish = (result) => {
|
|
50720
|
+
if (settled)
|
|
50721
|
+
return;
|
|
50722
|
+
settled = true;
|
|
50723
|
+
clearTimeout(timer);
|
|
50724
|
+
resolve5(result);
|
|
50725
|
+
};
|
|
50726
|
+
const bounded = () => opts.maxLines === void 0 ? stdout : keepLines(stdout, opts.maxLines);
|
|
50727
|
+
const timer = setTimeout(() => {
|
|
50728
|
+
if (settled)
|
|
50729
|
+
return;
|
|
50730
|
+
timedOut = true;
|
|
50731
|
+
(0, processHardening_1.killChild)(child);
|
|
50732
|
+
finish({ stdout: bounded(), cappedEarly, timedOut });
|
|
50733
|
+
}, opts.timeoutMs);
|
|
50734
|
+
timer.unref?.();
|
|
50735
|
+
child.stdout.on("data", (chunk) => {
|
|
50736
|
+
if (settled)
|
|
50737
|
+
return;
|
|
50738
|
+
const text = chunk.toString();
|
|
50739
|
+
stdout += text;
|
|
50740
|
+
if (opts.maxLines === void 0 || cappedEarly)
|
|
50741
|
+
return;
|
|
50742
|
+
for (let i2 = 0; i2 < text.length; i2 += 1) {
|
|
50743
|
+
if (text.charCodeAt(i2) === 10)
|
|
50744
|
+
lines += 1;
|
|
50745
|
+
}
|
|
50746
|
+
if (lines >= opts.maxLines) {
|
|
50747
|
+
cappedEarly = true;
|
|
50748
|
+
stdout = keepLines(stdout, opts.maxLines);
|
|
50749
|
+
(0, processHardening_1.killChild)(child);
|
|
50750
|
+
finish({ stdout, cappedEarly, timedOut });
|
|
50751
|
+
}
|
|
50752
|
+
});
|
|
50753
|
+
child.stderr.on("data", (chunk) => {
|
|
50754
|
+
stderr += chunk.toString();
|
|
50755
|
+
});
|
|
50756
|
+
child.on("error", (error) => {
|
|
50757
|
+
if (settled)
|
|
50758
|
+
return;
|
|
50759
|
+
settled = true;
|
|
50760
|
+
clearTimeout(timer);
|
|
50761
|
+
reject(error);
|
|
50762
|
+
});
|
|
50763
|
+
child.on("close", (code) => {
|
|
50764
|
+
if (settled)
|
|
50765
|
+
return;
|
|
50766
|
+
if (isSuccessExit(code)) {
|
|
50767
|
+
finish({ stdout, cappedEarly, timedOut });
|
|
50768
|
+
return;
|
|
50769
|
+
}
|
|
50770
|
+
settled = true;
|
|
50771
|
+
clearTimeout(timer);
|
|
50772
|
+
reject(new Error(`ripgrep exited ${code}${stderr.trim() ? `: ${stderr.trim()}` : ""}`));
|
|
50773
|
+
});
|
|
50774
|
+
});
|
|
50775
|
+
exports2.spawnRg = spawnRg;
|
|
50776
|
+
}
|
|
50777
|
+
});
|
|
50778
|
+
|
|
50358
50779
|
// ../packages/orion-client-core/dist/o-vault/experienceStore.js
|
|
50359
50780
|
var require_experienceStore = __commonJS({
|
|
50360
50781
|
"../packages/orion-client-core/dist/o-vault/experienceStore.js"(exports2) {
|
|
@@ -51246,7 +51667,12 @@ var require_toolExecutor = __commonJS({
|
|
|
51246
51667
|
var os7 = __importStar(__require("os"));
|
|
51247
51668
|
var path13 = __importStar(__require("path"));
|
|
51248
51669
|
var bashFileChanges_1 = require_bashFileChanges();
|
|
51670
|
+
var bashCommandRewrite_1 = require_bashCommandRewrite();
|
|
51249
51671
|
var bashResolver_1 = require_bashResolver();
|
|
51672
|
+
var powershellResolver_1 = require_powershellResolver();
|
|
51673
|
+
var searchArgv_1 = require_searchArgv();
|
|
51674
|
+
var searchRg_1 = require_searchRg();
|
|
51675
|
+
var processHardening_1 = require_processHardening();
|
|
51250
51676
|
var fileCodec_1 = require_fileCodec();
|
|
51251
51677
|
var fileHistory_1 = require_fileHistory();
|
|
51252
51678
|
var multimodalRead_1 = require_multimodalRead();
|
|
@@ -51272,6 +51698,7 @@ var require_toolExecutor = __commonJS({
|
|
|
51272
51698
|
var BASH_HEAD_CHARS = 6e4;
|
|
51273
51699
|
var BASH_TAIL_CHARS = 2e4;
|
|
51274
51700
|
var GREP_MAX_RESULTS = 2e3;
|
|
51701
|
+
var SEARCH_TIMEOUT_S = 30;
|
|
51275
51702
|
var LIST_DIR_MAX_ENTRIES = 1e3;
|
|
51276
51703
|
var LIST_DIR_DEPTH_DEFAULT = 3;
|
|
51277
51704
|
var LIST_DIR_DEPTH_MAX = 16;
|
|
@@ -51608,6 +52035,7 @@ var require_toolExecutor = __commonJS({
|
|
|
51608
52035
|
this.getAdditionalDirectories = getAdditionalDirectories;
|
|
51609
52036
|
this.getPermissionRules = getPermissionRules;
|
|
51610
52037
|
this.rgPath = ripgrep.locate();
|
|
52038
|
+
(0, processHardening_1.hardenExecutableSearchPath)();
|
|
51611
52039
|
}
|
|
51612
52040
|
/** Attach the machine-local presence layer (post-construction, mirroring
|
|
51613
52041
|
* registerTools — the 12-arg constructor does not grow). Hosts that never
|
|
@@ -52218,6 +52646,7 @@ ${notes.join("\n\n")}`;
|
|
|
52218
52646
|
["glob", (req, params, sessionId, context) => this.toolGlob(req, params, sessionId, context)],
|
|
52219
52647
|
["grep", (req, params, sessionId, context) => this.toolGrep(req, params, sessionId, context)],
|
|
52220
52648
|
["bash", (req, params, sessionId, context) => this.toolBash(req, params, sessionId, context)],
|
|
52649
|
+
["powershell", (req, params, sessionId, context) => this.toolPowershell(req, params, sessionId, context)],
|
|
52221
52650
|
["bash_background", (req, params, sessionId, context) => this.toolBashBackground(req, params, sessionId, context)],
|
|
52222
52651
|
["bash_check", (req, params, sessionId, context) => this.toolBashCheck(req, params, sessionId, context)],
|
|
52223
52652
|
["bash_stop", (req, params, sessionId, context) => this.toolBashStop(req, params, sessionId, context)],
|
|
@@ -52516,8 +52945,11 @@ ${notes.join("\n\n")}`;
|
|
|
52516
52945
|
path: params.path != null ? String(params.path) : "."
|
|
52517
52946
|
};
|
|
52518
52947
|
const cwd = this.requireRoot(params);
|
|
52519
|
-
const
|
|
52520
|
-
|
|
52948
|
+
const raw = await this.runSearch({
|
|
52949
|
+
shellCommand: () => this.rgPath ? (0, searchCommands_1.buildGlobRg)(this.rgPath, p) : (0, searchCommands_1.buildGlobFind)(p),
|
|
52950
|
+
argv: () => (0, searchArgv_1.globArgv)(p),
|
|
52951
|
+
cwd
|
|
52952
|
+
});
|
|
52521
52953
|
const sorted = (0, searchCommands_1.sortPathsByMtimeDesc)(raw, (rel) => {
|
|
52522
52954
|
try {
|
|
52523
52955
|
return (0, fs_1.statSync)(path13.resolve(cwd, rel)).mtimeMs;
|
|
@@ -52544,15 +52976,24 @@ ${notes.join("\n\n")}`;
|
|
|
52544
52976
|
offset: (0, searchCommands_1.normalizeOffset)(params.offset)
|
|
52545
52977
|
};
|
|
52546
52978
|
const root2 = this.requireRoot(params);
|
|
52547
|
-
const
|
|
52548
|
-
|
|
52979
|
+
const raw = await this.runSearch({
|
|
52980
|
+
shellCommand: () => this.rgPath ? (0, searchCommands_1.buildGrepRg)(this.rgPath, p) : (0, searchCommands_1.buildGrepPosix)(p),
|
|
52981
|
+
argv: () => (0, searchArgv_1.grepArgv)(p),
|
|
52982
|
+
cwd: root2,
|
|
52983
|
+
// The argv transport has no pipe, so it takes the budget the shell
|
|
52984
|
+
// pipeline expresses as `| head -n cap`; both then hand
|
|
52985
|
+
// `truncateSearchOutput` the same shape (exactTotal:false — a capped run
|
|
52986
|
+
// knows only that MORE than maxLines exist, never the true total).
|
|
52987
|
+
maxLines: (0, searchArgv_1.grepLineBudget)(p),
|
|
52988
|
+
offset: p.offset
|
|
52989
|
+
});
|
|
52549
52990
|
return (0, searchCommands_1.truncateSearchOutput)(raw, maxLines, { exactTotal: false }).text;
|
|
52550
52991
|
}
|
|
52551
52992
|
/** `bash` */
|
|
52552
52993
|
async toolBash(req, params, sessionId, context) {
|
|
52553
52994
|
if (this.getPermissionMode() === "read_only")
|
|
52554
52995
|
throw new Error("read-only mode");
|
|
52555
|
-
const command = String(params.command);
|
|
52996
|
+
const command = (0, bashCommandRewrite_1.normalizeShellCommand)(String(params.command));
|
|
52556
52997
|
const reqId = req.request_id;
|
|
52557
52998
|
const sink = params._agent_id ? null : this.termSink;
|
|
52558
52999
|
let effectiveCwd;
|
|
@@ -52617,11 +53058,83 @@ exit $__orion_rc`;
|
|
|
52617
53058
|
}
|
|
52618
53059
|
}
|
|
52619
53060
|
}
|
|
53061
|
+
/** `powershell` — the shell tool a Windows machine with no bash gets instead.
|
|
53062
|
+
*
|
|
53063
|
+
* Deliberately mirrors `toolBash`'s CONTRACT (permission mode, cwd
|
|
53064
|
+
* resolution, sticky cwd across calls, live terminal streaming, output
|
|
53065
|
+
* compression) while speaking PowerShell, because the difference between the
|
|
53066
|
+
* two tools is the language, not the semantics. What it does NOT mirror is
|
|
53067
|
+
* the sandbox: OS write-containment exists on darwin/linux only, so there is
|
|
53068
|
+
* nothing to wrap here and no `disable_sandbox` param to honor. */
|
|
53069
|
+
async toolPowershell(req, params, sessionId, context) {
|
|
53070
|
+
if (this.getPermissionMode() === "read_only")
|
|
53071
|
+
throw new Error("read-only mode");
|
|
53072
|
+
const command = String(params.command);
|
|
53073
|
+
const reqId = req.request_id;
|
|
53074
|
+
const sink = params._agent_id ? null : this.termSink;
|
|
53075
|
+
let effectiveCwd;
|
|
53076
|
+
if (typeof params.cwd === "string" && params.cwd.length > 0) {
|
|
53077
|
+
effectiveCwd = this.resolveWithinWorkspace(params.cwd, sessionId, params._root, "write");
|
|
53078
|
+
} else if (!params._agent_id) {
|
|
53079
|
+
effectiveCwd = this.shellCwd.get(sessionId);
|
|
53080
|
+
}
|
|
53081
|
+
effectiveCwd = effectiveCwd || params._root || this.getWorkspaceRoot() || void 0;
|
|
53082
|
+
if (effectiveCwd && !(0, fs_1.existsSync)(effectiveCwd)) {
|
|
53083
|
+
effectiveCwd = this.getWorkspaceRoot() ?? void 0;
|
|
53084
|
+
}
|
|
53085
|
+
effectiveCwd = (0, pathResolution_1.effectiveWorkspaceRoot)(effectiveCwd ?? null);
|
|
53086
|
+
(0, pathResolution_1.assertNoWorkspacePathPrefixInCommand)(command, params._root || this.getWorkspaceRoot() || effectiveCwd);
|
|
53087
|
+
let wrapped = command;
|
|
53088
|
+
let cwdFile;
|
|
53089
|
+
if (!params._agent_id) {
|
|
53090
|
+
cwdFile = path13.join(os7.tmpdir(), `orion-pscwd-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`);
|
|
53091
|
+
const psPath = cwdFile.replace(/'/g, "''");
|
|
53092
|
+
wrapped = `${command}
|
|
53093
|
+
$__orion_rc = if ($null -ne $LASTEXITCODE) { $LASTEXITCODE } elseif ($?) { 0 } else { 1 }
|
|
53094
|
+
(Get-Location).Path | Out-File -FilePath '${psPath}' -Encoding utf8 -NoNewline
|
|
53095
|
+
exit $__orion_rc`;
|
|
53096
|
+
}
|
|
53097
|
+
const detectRoot = params._root || this.getWorkspaceRoot();
|
|
53098
|
+
const inScratch = this.isOwnScratchWrite(effectiveCwd, sessionId);
|
|
53099
|
+
const baseline = detectRoot && effectiveCwd && !inScratch ? await (0, bashFileChanges_1.captureBaseline)(effectiveCwd, detectRoot) : null;
|
|
53100
|
+
sink?.(sessionId, reqId, command, "start");
|
|
53101
|
+
try {
|
|
53102
|
+
const out2 = await this.runPowershell(wrapped, Math.min(300, Number(params.timeout_s ?? 60)), effectiveCwd, sink ? (chunk) => sink(sessionId, reqId, command, "chunk", chunk) : void 0);
|
|
53103
|
+
if (baseline) {
|
|
53104
|
+
const changes = await (0, bashFileChanges_1.diffAgainstBaseline)(baseline);
|
|
53105
|
+
if (changes.length > 0)
|
|
53106
|
+
this.pendingBashChanges.set(reqId, changes);
|
|
53107
|
+
}
|
|
53108
|
+
const compressed = (0, terminalOutputCompression_1.compressTerminalOutputWithMetrics)({
|
|
53109
|
+
toolName: req.name,
|
|
53110
|
+
command,
|
|
53111
|
+
output: out2,
|
|
53112
|
+
tokenSaving: context.tokenSaving
|
|
53113
|
+
});
|
|
53114
|
+
if (compressed.savings)
|
|
53115
|
+
this.pendingTerminalSavings.set(reqId, compressed.savings);
|
|
53116
|
+
return compressed.output;
|
|
53117
|
+
} finally {
|
|
53118
|
+
sink?.(sessionId, reqId, command, "end");
|
|
53119
|
+
if (cwdFile) {
|
|
53120
|
+
try {
|
|
53121
|
+
const newCwd = (await fs14.readFile(cwdFile, "utf8")).replace(/^/, "").trim();
|
|
53122
|
+
if (newCwd && (0, fs_1.existsSync)(newCwd) && this.getWorkspaceRoot()) {
|
|
53123
|
+
this.shellCwd.set(sessionId, newCwd);
|
|
53124
|
+
}
|
|
53125
|
+
} catch {
|
|
53126
|
+
} finally {
|
|
53127
|
+
await fs14.unlink(cwdFile).catch(() => {
|
|
53128
|
+
});
|
|
53129
|
+
}
|
|
53130
|
+
}
|
|
53131
|
+
}
|
|
53132
|
+
}
|
|
52620
53133
|
/** `bash_background` */
|
|
52621
53134
|
async toolBashBackground(req, params, sessionId, context) {
|
|
52622
53135
|
if (this.getPermissionMode() === "read_only")
|
|
52623
53136
|
throw new Error("read-only mode");
|
|
52624
|
-
const command = String(params.command);
|
|
53137
|
+
const command = (0, bashCommandRewrite_1.normalizeShellCommand)(String(params.command));
|
|
52625
53138
|
const root2 = this.requireRoot(params);
|
|
52626
53139
|
(0, pathResolution_1.assertNoWorkspacePathPrefixInCommand)(command, root2);
|
|
52627
53140
|
const bgSandbox = this.sandboxForParams(params);
|
|
@@ -52629,7 +53142,7 @@ exit $__orion_rc`;
|
|
|
52629
53142
|
capability: bgSandbox.capability,
|
|
52630
53143
|
writableRoots: bgSandbox.writableRoots
|
|
52631
53144
|
}) : (0, bashResolver_1.bashInvocation)(command);
|
|
52632
|
-
const proc = (0, child_process_1.spawn)(bgInv.file, bgInv.args, { cwd: root2 });
|
|
53145
|
+
const proc = (0, child_process_1.spawn)(bgInv.file, bgInv.args, { ...processHardening_1.HIDDEN_WINDOW_SPAWN_OPTIONS, cwd: root2 });
|
|
52633
53146
|
const handle2 = `bg-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
52634
53147
|
const rec = { proc, command, output: "" };
|
|
52635
53148
|
this.background.set(handle2, rec);
|
|
@@ -52835,6 +53348,7 @@ exit $__orion_rc`;
|
|
|
52835
53348
|
const envOverride = params.env ?? {};
|
|
52836
53349
|
return await new Promise((resolve5, reject) => {
|
|
52837
53350
|
const proc = (0, child_process_1.spawn)(argv[0], argv.slice(1), {
|
|
53351
|
+
...processHardening_1.HIDDEN_WINDOW_SPAWN_OPTIONS,
|
|
52838
53352
|
cwd: cwd || void 0,
|
|
52839
53353
|
env: { ...process.env, ...envOverride }
|
|
52840
53354
|
});
|
|
@@ -52968,6 +53482,98 @@ exit $__orion_rc`;
|
|
|
52968
53482
|
];
|
|
52969
53483
|
return { capability, writableRoots };
|
|
52970
53484
|
}
|
|
53485
|
+
/**
|
|
53486
|
+
* Run one search on whichever transport this machine has, and return the raw
|
|
53487
|
+
* output the caller then sorts/truncates.
|
|
53488
|
+
*
|
|
53489
|
+
* THE decision point, in one place for both search tools: a shell pipeline
|
|
53490
|
+
* wherever a POSIX shell exists — every mac, every linux, every Windows
|
|
53491
|
+
* carrying Git for Windows — and an argument vector only where none does. The
|
|
53492
|
+
* two builders are passed as thunks so the unused one is never constructed,
|
|
53493
|
+
* and the transport is never a caller's concern.
|
|
53494
|
+
*/
|
|
53495
|
+
async runSearch(opts) {
|
|
53496
|
+
if ((0, bashResolver_1.isBashAvailable)()) {
|
|
53497
|
+
return await this.runBash(opts.shellCommand(), SEARCH_TIMEOUT_S, opts.cwd, void 0, true);
|
|
53498
|
+
}
|
|
53499
|
+
return await this.runRgDirect({
|
|
53500
|
+
args: opts.argv(),
|
|
53501
|
+
cwd: opts.cwd,
|
|
53502
|
+
maxLines: opts.maxLines,
|
|
53503
|
+
offset: opts.offset
|
|
53504
|
+
});
|
|
53505
|
+
}
|
|
53506
|
+
/** Run ripgrep with an argument vector, for the machine that has no shell to
|
|
53507
|
+
* run the pipeline in. Applies the caller's line budget and `offset` exactly
|
|
53508
|
+
* as the pipeline's `| tail -n +N | head -n cap` does, so both transports
|
|
53509
|
+
* hand `truncateSearchOutput` the same shape. */
|
|
53510
|
+
async runRgDirect(opts) {
|
|
53511
|
+
if (!this.rgPath) {
|
|
53512
|
+
throw new Error("Search is unavailable: this machine has neither a POSIX shell nor a bundled ripgrep. Install Git for Windows (https://git-scm.com/download/win) to restore search.");
|
|
53513
|
+
}
|
|
53514
|
+
const skip = Math.max(0, Math.trunc(opts.offset ?? 0));
|
|
53515
|
+
const budget = opts.maxLines === void 0 ? void 0 : opts.maxLines + skip;
|
|
53516
|
+
const result = await (0, searchRg_1.spawnRg)({
|
|
53517
|
+
rgPath: this.rgPath,
|
|
53518
|
+
args: opts.args,
|
|
53519
|
+
cwd: opts.cwd,
|
|
53520
|
+
timeoutMs: SEARCH_TIMEOUT_S * 1e3,
|
|
53521
|
+
maxLines: budget
|
|
53522
|
+
});
|
|
53523
|
+
if (skip === 0)
|
|
53524
|
+
return result.stdout;
|
|
53525
|
+
const lines = result.stdout.split("\n");
|
|
53526
|
+
const trailingNewline = lines.length > 0 && lines[lines.length - 1] === "";
|
|
53527
|
+
const body2 = trailingNewline ? lines.slice(0, -1) : lines;
|
|
53528
|
+
const kept = body2.slice(skip);
|
|
53529
|
+
return kept.length === 0 ? "" : kept.join("\n") + (trailingNewline ? "\n" : "");
|
|
53530
|
+
}
|
|
53531
|
+
/** Spawn one PowerShell command. Shares `runBash`'s streaming, truncation and
|
|
53532
|
+
* exit-marker conventions so the model reads the same shape of result from
|
|
53533
|
+
* either shell; the interpreter and its flags are the only difference. */
|
|
53534
|
+
async runPowershell(command, timeoutS, cwd, onChunk) {
|
|
53535
|
+
const inv = (0, powershellResolver_1.powershellInvocation)(command);
|
|
53536
|
+
return await new Promise((resolve5, reject) => {
|
|
53537
|
+
const proc = (0, child_process_1.spawn)(inv.file, inv.args, {
|
|
53538
|
+
...processHardening_1.HIDDEN_WINDOW_SPAWN_OPTIONS,
|
|
53539
|
+
cwd: cwd || this.getWorkspaceRoot() || void 0,
|
|
53540
|
+
env: { ...process.env, PAGER: "cat", GIT_PAGER: "cat" }
|
|
53541
|
+
});
|
|
53542
|
+
let out2 = "";
|
|
53543
|
+
const take = (chunk) => {
|
|
53544
|
+
const text = chunk.toString();
|
|
53545
|
+
out2 += text;
|
|
53546
|
+
onChunk?.(text);
|
|
53547
|
+
};
|
|
53548
|
+
proc.stdout?.on("data", take);
|
|
53549
|
+
proc.stderr?.on("data", take);
|
|
53550
|
+
let timedOut = false;
|
|
53551
|
+
const timer = setTimeout(() => {
|
|
53552
|
+
timedOut = true;
|
|
53553
|
+
(0, processHardening_1.killChild)(proc);
|
|
53554
|
+
reject(new Error(`command timed out after ${timeoutS}s`));
|
|
53555
|
+
}, timeoutS * 1e3);
|
|
53556
|
+
proc.on("close", (code) => {
|
|
53557
|
+
clearTimeout(timer);
|
|
53558
|
+
if (timedOut)
|
|
53559
|
+
return;
|
|
53560
|
+
const modelOut = (0, toolText_1.headTailTruncate)((0, toolText_1.stripAnsiCodes)(out2), BASH_HEAD_CHARS, BASH_TAIL_CHARS);
|
|
53561
|
+
if (code === 0) {
|
|
53562
|
+
resolve5(modelOut);
|
|
53563
|
+
} else {
|
|
53564
|
+
const suffix = `
|
|
53565
|
+
(exit ${code})`;
|
|
53566
|
+
onChunk?.(suffix);
|
|
53567
|
+
resolve5(modelOut + suffix);
|
|
53568
|
+
}
|
|
53569
|
+
});
|
|
53570
|
+
proc.on("error", (e) => {
|
|
53571
|
+
clearTimeout(timer);
|
|
53572
|
+
if (!timedOut)
|
|
53573
|
+
reject(e);
|
|
53574
|
+
});
|
|
53575
|
+
});
|
|
53576
|
+
}
|
|
52971
53577
|
async runBash(command, timeoutS, cwd, onChunk, partialOnTimeout = false, sandbox) {
|
|
52972
53578
|
const inv = sandbox && sandbox.capability ? (0, bashSandbox_1.buildSandboxedInvocation)(command, {
|
|
52973
53579
|
capability: sandbox.capability,
|
|
@@ -52975,6 +53581,7 @@ exit $__orion_rc`;
|
|
|
52975
53581
|
}) : (0, bashResolver_1.bashInvocation)(command);
|
|
52976
53582
|
return await new Promise((resolve5, reject) => {
|
|
52977
53583
|
const proc = (0, child_process_1.spawn)(inv.file, inv.args, {
|
|
53584
|
+
...processHardening_1.HIDDEN_WINDOW_SPAWN_OPTIONS,
|
|
52978
53585
|
cwd: cwd || this.getWorkspaceRoot() || void 0,
|
|
52979
53586
|
// We run without a PTY, so CLIs (vite, npm, eslint, jest, …) see a
|
|
52980
53587
|
// pipe and disable colors by default. Force color on so the live
|
|
@@ -53005,7 +53612,7 @@ exit $__orion_rc`;
|
|
|
53005
53612
|
let timedOut = false;
|
|
53006
53613
|
const timer = setTimeout(() => {
|
|
53007
53614
|
timedOut = true;
|
|
53008
|
-
|
|
53615
|
+
(0, processHardening_1.killChild)(proc);
|
|
53009
53616
|
if (partialOnTimeout) {
|
|
53010
53617
|
const note = `
|
|
53011
53618
|
[timed out after ${timeoutS}s \u2014 partial results above; narrow the pattern, or use search_codebase for ranked results]`;
|
|
@@ -59903,13 +60510,15 @@ var require_connection = __commonJS({
|
|
|
59903
60510
|
var BrainConnection = class _BrainConnection {
|
|
59904
60511
|
io;
|
|
59905
60512
|
brainVersion;
|
|
60513
|
+
log;
|
|
59906
60514
|
pending = /* @__PURE__ */ new Map();
|
|
59907
60515
|
nextId = 0;
|
|
59908
60516
|
closed = false;
|
|
59909
60517
|
closeError;
|
|
59910
|
-
constructor(io, brainVersion) {
|
|
60518
|
+
constructor(io, brainVersion, log) {
|
|
59911
60519
|
this.io = io;
|
|
59912
60520
|
this.brainVersion = brainVersion;
|
|
60521
|
+
this.log = log;
|
|
59913
60522
|
}
|
|
59914
60523
|
/** True while the underlying channel is usable. */
|
|
59915
60524
|
get alive() {
|
|
@@ -59960,7 +60569,7 @@ var require_connection = __commonJS({
|
|
|
59960
60569
|
settled = true;
|
|
59961
60570
|
clearTimeout(timer);
|
|
59962
60571
|
io.readable.removeListener("data", onData);
|
|
59963
|
-
const connection = new _BrainConnection(io, frame.brain_version);
|
|
60572
|
+
const connection = new _BrainConnection(io, frame.brain_version, options.log);
|
|
59964
60573
|
connection.attach();
|
|
59965
60574
|
resolve5(connection);
|
|
59966
60575
|
});
|
|
@@ -60037,6 +60646,9 @@ var require_connection = __commonJS({
|
|
|
60037
60646
|
this.closeError = error;
|
|
60038
60647
|
const inFlight2 = [...this.pending.values()];
|
|
60039
60648
|
this.pending.clear();
|
|
60649
|
+
if (inFlight2.length > 0) {
|
|
60650
|
+
this.log?.(`brain connection failed \u2014 rejecting ${inFlight2.length} in-flight segment(s)`, error);
|
|
60651
|
+
}
|
|
60040
60652
|
const rejection = error instanceof segmentDriver_1.TransportError ? error : new segmentDriver_1.TransportError(`brain connection failed: ${String(error)}`, { cause: error });
|
|
60041
60653
|
for (const pending of inFlight2)
|
|
60042
60654
|
pending.reject(rejection);
|
|
@@ -60506,7 +61118,8 @@ var require_supervisor = __commonJS({
|
|
|
60506
61118
|
}
|
|
60507
61119
|
}, {
|
|
60508
61120
|
helloTimeoutMs: this.options.helloTimeoutMs,
|
|
60509
|
-
clientVersion: this.options.clientVersion
|
|
61121
|
+
clientVersion: this.options.clientVersion,
|
|
61122
|
+
log: this.options.log
|
|
60510
61123
|
});
|
|
60511
61124
|
this.connection = connection;
|
|
60512
61125
|
return connection;
|
|
@@ -60685,7 +61298,8 @@ var require_socketClient = __commonJS({
|
|
|
60685
61298
|
}
|
|
60686
61299
|
}, {
|
|
60687
61300
|
helloTimeoutMs: this.options.helloTimeoutMs,
|
|
60688
|
-
clientVersion: this.options.clientVersion
|
|
61301
|
+
clientVersion: this.options.clientVersion,
|
|
61302
|
+
log: this.options.log
|
|
60689
61303
|
}).then(resolve5, reject);
|
|
60690
61304
|
});
|
|
60691
61305
|
});
|
|
@@ -60974,6 +61588,7 @@ var require_dist = __commonJS({
|
|
|
60974
61588
|
__exportStar(require_workerPool(), exports2);
|
|
60975
61589
|
__exportStar(require_pathResolution(), exports2);
|
|
60976
61590
|
__exportStar(require_bashResolver(), exports2);
|
|
61591
|
+
__exportStar(require_powershellResolver(), exports2);
|
|
60977
61592
|
__exportStar(require_bashSandbox(), exports2);
|
|
60978
61593
|
__exportStar(require_workingDirectories(), exports2);
|
|
60979
61594
|
__exportStar(require_permissions(), exports2);
|
|
@@ -61173,7 +61788,7 @@ var require_permissionCard = __commonJS({
|
|
|
61173
61788
|
{ source: "user", label: "All projects" },
|
|
61174
61789
|
{ source: "session", label: "This session" }
|
|
61175
61790
|
];
|
|
61176
|
-
var
|
|
61791
|
+
var COMMAND_TOOLS = /* @__PURE__ */ new Set(["bash", "bash_background", "powershell"]);
|
|
61177
61792
|
function firstLine(text) {
|
|
61178
61793
|
return text.split("\n", 1)[0] ?? text;
|
|
61179
61794
|
}
|
|
@@ -61203,7 +61818,7 @@ var require_permissionCard = __commonJS({
|
|
|
61203
61818
|
const tool = req.tool_name;
|
|
61204
61819
|
let header;
|
|
61205
61820
|
let body2;
|
|
61206
|
-
if (
|
|
61821
|
+
if (COMMAND_TOOLS.has(tool)) {
|
|
61207
61822
|
const command = String(input.command ?? "");
|
|
61208
61823
|
header = { verb: "Run", subject: firstLine(command) };
|
|
61209
61824
|
body2 = { kind: "command", command };
|
|
@@ -98416,7 +99031,7 @@ function OrionRing() {
|
|
|
98416
99031
|
|
|
98417
99032
|
// src/services/version.ts
|
|
98418
99033
|
function tuiVersion() {
|
|
98419
|
-
return "0.1.
|
|
99034
|
+
return "0.1.12".length > 0 ? "0.1.12" : null;
|
|
98420
99035
|
}
|
|
98421
99036
|
|
|
98422
99037
|
// src/components/layout/WelcomeCard.tsx
|
|
@@ -103982,7 +104597,10 @@ async function main() {
|
|
|
103982
104597
|
const attachAgentParent = (sid) => {
|
|
103983
104598
|
agentManager.attachParent(sid, {
|
|
103984
104599
|
routing: () => currentRouting(),
|
|
103985
|
-
clientCapabilities: () =>
|
|
104600
|
+
clientCapabilities: () => [
|
|
104601
|
+
...(0, import_client_core34.platformCapabilities)(),
|
|
104602
|
+
...appStore.getState().subagentsEnabled ? ["subagents"] : []
|
|
104603
|
+
],
|
|
103986
104604
|
transcript: () => transcriptStore.getState().messages,
|
|
103987
104605
|
queueParentInput: (text) => heldAgentReports.push(text),
|
|
103988
104606
|
wakeParent: () => {
|
|
@@ -104147,7 +104765,10 @@ async function main() {
|
|
|
104147
104765
|
// the def catalog is sent and the backend hides the whole family.
|
|
104148
104766
|
// `workgraph` rides the same switch as the fan-out family: a work graph IS a
|
|
104149
104767
|
// fan-out (its phases are sub-agents), so turning sub-agents off must hide both.
|
|
104150
|
-
clientCapabilities:
|
|
104768
|
+
clientCapabilities: [
|
|
104769
|
+
...(0, import_client_core34.platformCapabilities)(),
|
|
104770
|
+
...appStore.getState().subagentsEnabled ? ["scheduling", "subagents", "workgraph"] : ["scheduling"]
|
|
104771
|
+
],
|
|
104151
104772
|
extraBody: {
|
|
104152
104773
|
...appStore.getState().subagentsEnabled ? agentManager.parentExtraBody() : {},
|
|
104153
104774
|
...peerAgents.length > 0 ? { peer_agents: peerAgents } : {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orion-super-agent-dev",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "[dev] Orion \u2014 a terminal AI super-agent, strongest at coding. Local brain, local disk: the agent loop runs on your machine; only the metered model call leaves it.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|