@orbit-build/cli 0.1.5 → 0.1.6
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/README.md +61 -60
- package/dist/index.js +388 -426
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -43,7 +43,7 @@ var require_windows = __commonJS({
|
|
|
43
43
|
"use strict";
|
|
44
44
|
module.exports = isexe;
|
|
45
45
|
isexe.sync = sync;
|
|
46
|
-
var
|
|
46
|
+
var fs5 = __require("fs");
|
|
47
47
|
function checkPathExt(path5, options) {
|
|
48
48
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
49
49
|
if (!pathext) {
|
|
@@ -68,12 +68,12 @@ var require_windows = __commonJS({
|
|
|
68
68
|
return checkPathExt(path5, options);
|
|
69
69
|
}
|
|
70
70
|
function isexe(path5, options, cb) {
|
|
71
|
-
|
|
71
|
+
fs5.stat(path5, function(er, stat) {
|
|
72
72
|
cb(er, er ? false : checkStat(stat, path5, options));
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
function sync(path5, options) {
|
|
76
|
-
return checkStat(
|
|
76
|
+
return checkStat(fs5.statSync(path5), path5, options);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
});
|
|
@@ -84,14 +84,14 @@ var require_mode = __commonJS({
|
|
|
84
84
|
"use strict";
|
|
85
85
|
module.exports = isexe;
|
|
86
86
|
isexe.sync = sync;
|
|
87
|
-
var
|
|
87
|
+
var fs5 = __require("fs");
|
|
88
88
|
function isexe(path5, options, cb) {
|
|
89
|
-
|
|
89
|
+
fs5.stat(path5, function(er, stat) {
|
|
90
90
|
cb(er, er ? false : checkStat(stat, options));
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
function sync(path5, options) {
|
|
94
|
-
return checkStat(
|
|
94
|
+
return checkStat(fs5.statSync(path5), options);
|
|
95
95
|
}
|
|
96
96
|
function checkStat(stat, options) {
|
|
97
97
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -116,7 +116,7 @@ var require_mode = __commonJS({
|
|
|
116
116
|
var require_isexe = __commonJS({
|
|
117
117
|
"../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js"(exports, module) {
|
|
118
118
|
"use strict";
|
|
119
|
-
var
|
|
119
|
+
var fs5 = __require("fs");
|
|
120
120
|
var core;
|
|
121
121
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
122
122
|
core = require_windows();
|
|
@@ -381,16 +381,16 @@ var require_shebang_command = __commonJS({
|
|
|
381
381
|
var require_readShebang = __commonJS({
|
|
382
382
|
"../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
|
|
383
383
|
"use strict";
|
|
384
|
-
var
|
|
384
|
+
var fs5 = __require("fs");
|
|
385
385
|
var shebangCommand = require_shebang_command();
|
|
386
386
|
function readShebang(command) {
|
|
387
387
|
const size = 150;
|
|
388
388
|
const buffer = Buffer.alloc(size);
|
|
389
389
|
let fd;
|
|
390
390
|
try {
|
|
391
|
-
fd =
|
|
392
|
-
|
|
393
|
-
|
|
391
|
+
fd = fs5.openSync(command, "r");
|
|
392
|
+
fs5.readSync(fd, buffer, 0, size, 0);
|
|
393
|
+
fs5.closeSync(fd);
|
|
394
394
|
} catch (e2) {
|
|
395
395
|
}
|
|
396
396
|
return shebangCommand(buffer.toString());
|
|
@@ -4235,10 +4235,10 @@ var require_typescript = __commonJS({
|
|
|
4235
4235
|
function and(f2, g2) {
|
|
4236
4236
|
return (arg) => f2(arg) && g2(arg);
|
|
4237
4237
|
}
|
|
4238
|
-
function or(...
|
|
4238
|
+
function or(...fs5) {
|
|
4239
4239
|
return (...args) => {
|
|
4240
4240
|
let lastResult;
|
|
4241
|
-
for (const f2 of
|
|
4241
|
+
for (const f2 of fs5) {
|
|
4242
4242
|
lastResult = f2(...args);
|
|
4243
4243
|
if (lastResult) {
|
|
4244
4244
|
return lastResult;
|
|
@@ -5813,7 +5813,7 @@ ${lanes.join("\n")}
|
|
|
5813
5813
|
var tracing;
|
|
5814
5814
|
var tracingEnabled;
|
|
5815
5815
|
((tracingEnabled2) => {
|
|
5816
|
-
let
|
|
5816
|
+
let fs5;
|
|
5817
5817
|
let traceCount = 0;
|
|
5818
5818
|
let traceFd = 0;
|
|
5819
5819
|
let mode;
|
|
@@ -5822,9 +5822,9 @@ ${lanes.join("\n")}
|
|
|
5822
5822
|
const legend = [];
|
|
5823
5823
|
function startTracing2(tracingMode, traceDir, configFilePath) {
|
|
5824
5824
|
Debug.assert(!tracing, "Tracing already started");
|
|
5825
|
-
if (
|
|
5825
|
+
if (fs5 === void 0) {
|
|
5826
5826
|
try {
|
|
5827
|
-
|
|
5827
|
+
fs5 = __require("fs");
|
|
5828
5828
|
} catch (e2) {
|
|
5829
5829
|
throw new Error(`tracing requires having fs
|
|
5830
5830
|
(original error: ${e2.message || e2})`);
|
|
@@ -5835,8 +5835,8 @@ ${lanes.join("\n")}
|
|
|
5835
5835
|
if (legendPath === void 0) {
|
|
5836
5836
|
legendPath = combinePaths(traceDir, "legend.json");
|
|
5837
5837
|
}
|
|
5838
|
-
if (!
|
|
5839
|
-
|
|
5838
|
+
if (!fs5.existsSync(traceDir)) {
|
|
5839
|
+
fs5.mkdirSync(traceDir, { recursive: true });
|
|
5840
5840
|
}
|
|
5841
5841
|
const countPart = mode === "build" ? `.${process.pid}-${++traceCount}` : mode === "server" ? `.${process.pid}` : ``;
|
|
5842
5842
|
const tracePath = combinePaths(traceDir, `trace${countPart}.json`);
|
|
@@ -5846,10 +5846,10 @@ ${lanes.join("\n")}
|
|
|
5846
5846
|
tracePath,
|
|
5847
5847
|
typesPath
|
|
5848
5848
|
});
|
|
5849
|
-
traceFd =
|
|
5849
|
+
traceFd = fs5.openSync(tracePath, "w");
|
|
5850
5850
|
tracing = tracingEnabled2;
|
|
5851
5851
|
const meta = { cat: "__metadata", ph: "M", ts: 1e3 * timestamp(), pid: 1, tid: 1 };
|
|
5852
|
-
|
|
5852
|
+
fs5.writeSync(
|
|
5853
5853
|
traceFd,
|
|
5854
5854
|
"[\n" + [{ name: "process_name", args: { name: "tsc" }, ...meta }, { name: "thread_name", args: { name: "Main" }, ...meta }, { name: "TracingStartedInBrowser", ...meta, cat: "disabled-by-default-devtools.timeline" }].map((v2) => JSON.stringify(v2)).join(",\n")
|
|
5855
5855
|
);
|
|
@@ -5858,10 +5858,10 @@ ${lanes.join("\n")}
|
|
|
5858
5858
|
function stopTracing() {
|
|
5859
5859
|
Debug.assert(tracing, "Tracing is not in progress");
|
|
5860
5860
|
Debug.assert(!!typeCatalog.length === (mode !== "server"));
|
|
5861
|
-
|
|
5861
|
+
fs5.writeSync(traceFd, `
|
|
5862
5862
|
]
|
|
5863
5863
|
`);
|
|
5864
|
-
|
|
5864
|
+
fs5.closeSync(traceFd);
|
|
5865
5865
|
tracing = void 0;
|
|
5866
5866
|
if (typeCatalog.length) {
|
|
5867
5867
|
dumpTypes(typeCatalog);
|
|
@@ -5933,11 +5933,11 @@ ${lanes.join("\n")}
|
|
|
5933
5933
|
function writeEvent(eventType, phase, name, args, extras, time = 1e3 * timestamp()) {
|
|
5934
5934
|
if (mode === "server" && phase === "checkTypes") return;
|
|
5935
5935
|
mark("beginTracing");
|
|
5936
|
-
|
|
5936
|
+
fs5.writeSync(traceFd, `,
|
|
5937
5937
|
{"pid":1,"tid":1,"ph":"${eventType}","cat":"${phase}","ts":${time},"name":"${name}"`);
|
|
5938
|
-
if (extras)
|
|
5939
|
-
if (args)
|
|
5940
|
-
|
|
5938
|
+
if (extras) fs5.writeSync(traceFd, `,${extras}`);
|
|
5939
|
+
if (args) fs5.writeSync(traceFd, `,"args":${JSON.stringify(args)}`);
|
|
5940
|
+
fs5.writeSync(traceFd, `}`);
|
|
5941
5941
|
mark("endTracing");
|
|
5942
5942
|
measure("Tracing", "beginTracing", "endTracing");
|
|
5943
5943
|
}
|
|
@@ -5959,9 +5959,9 @@ ${lanes.join("\n")}
|
|
|
5959
5959
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
|
|
5960
5960
|
mark("beginDumpTypes");
|
|
5961
5961
|
const typesPath = legend[legend.length - 1].typesPath;
|
|
5962
|
-
const typesFd =
|
|
5962
|
+
const typesFd = fs5.openSync(typesPath, "w");
|
|
5963
5963
|
const recursionIdentityMap = /* @__PURE__ */ new Map();
|
|
5964
|
-
|
|
5964
|
+
fs5.writeSync(typesFd, "[");
|
|
5965
5965
|
const numTypes = types.length;
|
|
5966
5966
|
for (let i = 0; i < numTypes; i++) {
|
|
5967
5967
|
const type = types[i];
|
|
@@ -6057,13 +6057,13 @@ ${lanes.join("\n")}
|
|
|
6057
6057
|
flags: Debug.formatTypeFlags(type.flags).split("|"),
|
|
6058
6058
|
display
|
|
6059
6059
|
};
|
|
6060
|
-
|
|
6060
|
+
fs5.writeSync(typesFd, JSON.stringify(descriptor));
|
|
6061
6061
|
if (i < numTypes - 1) {
|
|
6062
|
-
|
|
6062
|
+
fs5.writeSync(typesFd, ",\n");
|
|
6063
6063
|
}
|
|
6064
6064
|
}
|
|
6065
|
-
|
|
6066
|
-
|
|
6065
|
+
fs5.writeSync(typesFd, "]\n");
|
|
6066
|
+
fs5.closeSync(typesFd);
|
|
6067
6067
|
mark("endDumpTypes");
|
|
6068
6068
|
measure("Dump types", "beginDumpTypes", "endDumpTypes");
|
|
6069
6069
|
}
|
|
@@ -6071,7 +6071,7 @@ ${lanes.join("\n")}
|
|
|
6071
6071
|
if (!legendPath) {
|
|
6072
6072
|
return;
|
|
6073
6073
|
}
|
|
6074
|
-
|
|
6074
|
+
fs5.writeFileSync(legendPath, JSON.stringify(legend));
|
|
6075
6075
|
}
|
|
6076
6076
|
tracingEnabled2.dumpLegend = dumpLegend;
|
|
6077
6077
|
})(tracingEnabled || (tracingEnabled = {}));
|
|
@@ -225389,7 +225389,7 @@ var Renderer = class {
|
|
|
225389
225389
|
};
|
|
225390
225390
|
|
|
225391
225391
|
// ../core/dist/index.js
|
|
225392
|
-
import { z as
|
|
225392
|
+
import { z as z73 } from "zod";
|
|
225393
225393
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
225394
225394
|
import {
|
|
225395
225395
|
chmodSync as chmodSync4,
|
|
@@ -225407,12 +225407,11 @@ import { z as z34 } from "zod";
|
|
|
225407
225407
|
import { EventEmitter } from "events";
|
|
225408
225408
|
import { z as z44 } from "zod";
|
|
225409
225409
|
import picocolors8 from "picocolors";
|
|
225410
|
-
import
|
|
225411
|
-
import
|
|
225412
|
-
import { createHash as
|
|
225413
|
-
import { exec as exec2, execFile as
|
|
225414
|
-
import { promisify as
|
|
225415
|
-
import { createRequire } from "module";
|
|
225410
|
+
import path32 from "path";
|
|
225411
|
+
import fs3 from "fs";
|
|
225412
|
+
import { createHash as createHash32, randomUUID as randomUUID32 } from "crypto";
|
|
225413
|
+
import { exec as exec2, execFile as execFile3 } from "child_process";
|
|
225414
|
+
import { promisify as promisify3 } from "util";
|
|
225416
225415
|
|
|
225417
225416
|
// ../mcp/dist/index.js
|
|
225418
225417
|
import { spawn } from "child_process";
|
|
@@ -225566,7 +225565,7 @@ var MCPClient = class {
|
|
|
225566
225565
|
await this.sendRequest("initialize", {
|
|
225567
225566
|
protocolVersion: "2024-11-05",
|
|
225568
225567
|
capabilities: {},
|
|
225569
|
-
clientInfo: { name: "orbit-client", version: "0.1.
|
|
225568
|
+
clientInfo: { name: "orbit-client", version: "0.1.6" }
|
|
225570
225569
|
});
|
|
225571
225570
|
this.sendNotification("notifications/initialized");
|
|
225572
225571
|
}
|
|
@@ -225703,15 +225702,23 @@ var DynamicMCPTool = class {
|
|
|
225703
225702
|
|
|
225704
225703
|
// ../core/dist/index.js
|
|
225705
225704
|
import { z as z53 } from "zod";
|
|
225706
|
-
import
|
|
225705
|
+
import fs2 from "fs";
|
|
225707
225706
|
import path4 from "path";
|
|
225708
225707
|
import { exec, execFile } from "child_process";
|
|
225709
225708
|
import { promisify } from "util";
|
|
225710
|
-
import
|
|
225711
|
-
import
|
|
225709
|
+
import { createHash as createHash23 } from "crypto";
|
|
225710
|
+
import { randomUUID as randomUUID24 } from "crypto";
|
|
225711
|
+
import { z as z63 } from "zod";
|
|
225712
|
+
import fs22 from "fs";
|
|
225713
|
+
import path22 from "path";
|
|
225714
|
+
import { execFile as execFile2 } from "child_process";
|
|
225715
|
+
import { createRequire } from "module";
|
|
225716
|
+
import { promisify as promisify2 } from "util";
|
|
225717
|
+
import fs4 from "fs";
|
|
225718
|
+
import path42 from "path";
|
|
225712
225719
|
import { existsSync as existsSync34, statSync as statSync4 } from "fs";
|
|
225713
|
-
import { z as z73 } from "zod";
|
|
225714
225720
|
import { z as z83 } from "zod";
|
|
225721
|
+
import { z as z93 } from "zod";
|
|
225715
225722
|
function createInitialState(sessionId, task, maxAttempts = 8) {
|
|
225716
225723
|
return {
|
|
225717
225724
|
sessionId,
|
|
@@ -225996,11 +226003,11 @@ var PromptCacheSlabBuilder = class {
|
|
|
225996
226003
|
} catch {
|
|
225997
226004
|
}
|
|
225998
226005
|
}
|
|
225999
|
-
static readMetadata(
|
|
226000
|
-
if (!existsSync13(
|
|
226006
|
+
static readMetadata(path5) {
|
|
226007
|
+
if (!existsSync13(path5)) return void 0;
|
|
226001
226008
|
try {
|
|
226002
226009
|
return PromptCacheSlabMetadataSchema.parse(
|
|
226003
|
-
JSON.parse(readFileSync13(
|
|
226010
|
+
JSON.parse(readFileSync13(path5, "utf8"))
|
|
226004
226011
|
);
|
|
226005
226012
|
} catch {
|
|
226006
226013
|
return void 0;
|
|
@@ -227009,9 +227016,9 @@ var VerificationContractManager = class {
|
|
|
227009
227016
|
}
|
|
227010
227017
|
loadContract() {
|
|
227011
227018
|
const contractPath = path4.join(this.cwd, ".orbit", "verification.json");
|
|
227012
|
-
if (
|
|
227019
|
+
if (fs2.existsSync(contractPath)) {
|
|
227013
227020
|
try {
|
|
227014
|
-
const content =
|
|
227021
|
+
const content = fs2.readFileSync(contractPath, "utf8");
|
|
227015
227022
|
const parsed = JSON.parse(content);
|
|
227016
227023
|
const validated = VerificationContractSchema.safeParse(parsed);
|
|
227017
227024
|
if (validated.success) {
|
|
@@ -227125,7 +227132,7 @@ ${output}`
|
|
|
227125
227132
|
});
|
|
227126
227133
|
for (const requiredFile of this.contract.requiredFiles) {
|
|
227127
227134
|
const filePath = resolveSafePath(this.cwd, requiredFile);
|
|
227128
|
-
if (!
|
|
227135
|
+
if (!fs2.existsSync(filePath)) {
|
|
227129
227136
|
eventBus.emitEvent("verification_ended", {
|
|
227130
227137
|
success: false,
|
|
227131
227138
|
results: { missingRequiredFile: requiredFile }
|
|
@@ -227149,8 +227156,240 @@ ${output}`
|
|
|
227149
227156
|
}
|
|
227150
227157
|
}
|
|
227151
227158
|
};
|
|
227152
|
-
var
|
|
227159
|
+
var AUDIT_CONTENT_MAX_CHARS = 4e4;
|
|
227160
|
+
function isFileMutationTool(toolName) {
|
|
227161
|
+
return [
|
|
227162
|
+
"write_file",
|
|
227163
|
+
"edit_file",
|
|
227164
|
+
"replace_file_content",
|
|
227165
|
+
"multi_replace_file_content"
|
|
227166
|
+
].includes(toolName);
|
|
227167
|
+
}
|
|
227168
|
+
function sha256(value) {
|
|
227169
|
+
return createHash23("sha256").update(value).digest("hex");
|
|
227170
|
+
}
|
|
227171
|
+
function buildAuditDiff(filePath, before, after) {
|
|
227172
|
+
const bounded = (value) => value.length <= AUDIT_CONTENT_MAX_CHARS ? value : `${value.slice(0, AUDIT_CONTENT_MAX_CHARS)}
|
|
227173
|
+
... [truncated by Orbit audit]`;
|
|
227174
|
+
const beforeText = bounded(before ?? "").split("\n").map((line) => `-${line}`).join("\n");
|
|
227175
|
+
const afterText = bounded(after).split("\n").map((line) => `+${line}`).join("\n");
|
|
227176
|
+
return `--- a/${filePath}
|
|
227177
|
+
+++ b/${filePath}
|
|
227178
|
+
@@ Orbit recorded before/after @@
|
|
227179
|
+
${beforeText}
|
|
227180
|
+
${afterText}`;
|
|
227181
|
+
}
|
|
227182
|
+
function extractFilePathFromLine(line) {
|
|
227183
|
+
const windowsAbsolutePath = line.match(/([a-zA-Z]:[\\/][^`*\":#\s]+)/);
|
|
227184
|
+
if (windowsAbsolutePath) return windowsAbsolutePath[1];
|
|
227185
|
+
const unixAbsolutePath = line.match(/(?:^|\s)(\/[^`*\":#\s]+)/);
|
|
227186
|
+
if (unixAbsolutePath) return unixAbsolutePath[1];
|
|
227187
|
+
const relativePath = line.match(/([.\w\-+]+[\\/][^`*\":#\s]+)/);
|
|
227188
|
+
if (relativePath) return relativePath[1];
|
|
227189
|
+
return line.replace(/[`*:*#\-+]/g, "").trim();
|
|
227190
|
+
}
|
|
227191
|
+
function parseSearchReplaceBlocks(text) {
|
|
227192
|
+
const blocks = [];
|
|
227193
|
+
const blockPattern = /<<<<<<< SEARCH\r?\n([\s\S]*?)\r?\n=======\r?\n([\s\S]*?)\r?\n>>>>>>>/g;
|
|
227194
|
+
let match;
|
|
227195
|
+
while ((match = blockPattern.exec(text)) !== null) {
|
|
227196
|
+
const linesBeforeBlock = text.slice(0, match.index).split(/\r?\n/);
|
|
227197
|
+
const filePath = linesBeforeBlock.reverse().map((line) => extractFilePathFromLine(line.trim())).find(
|
|
227198
|
+
(candidate) => candidate.includes("/") || candidate.includes("\\") || /\.(?:js|ts|txt)$/.test(candidate)
|
|
227199
|
+
);
|
|
227200
|
+
if (filePath) {
|
|
227201
|
+
blocks.push({ filePath, oldText: match[1], newText: match[2] });
|
|
227202
|
+
}
|
|
227203
|
+
}
|
|
227204
|
+
return blocks;
|
|
227205
|
+
}
|
|
227206
|
+
function cleanAndTruncateTestLog(log) {
|
|
227207
|
+
const lines = log.replace(/\u001b\[\d+(;\d+)*m/g, "").replace(/\x1B\[[0-9;]*[a-zA-Z]/g, "").split(/\r?\n/);
|
|
227208
|
+
const filteredLines = [];
|
|
227209
|
+
let skippedFrames = 0;
|
|
227210
|
+
const flushSkippedFrames = () => {
|
|
227211
|
+
if (skippedFrames === 0) return;
|
|
227212
|
+
filteredLines.push(
|
|
227213
|
+
` ... skipped ${skippedFrames} internal/library stack frames ...`
|
|
227214
|
+
);
|
|
227215
|
+
skippedFrames = 0;
|
|
227216
|
+
};
|
|
227217
|
+
for (const line of lines) {
|
|
227218
|
+
const trimmed = line.trim();
|
|
227219
|
+
if (trimmed.startsWith("at ") && (trimmed.includes("node_modules") || trimmed.includes("node:internal") || trimmed.includes("node:events"))) {
|
|
227220
|
+
skippedFrames++;
|
|
227221
|
+
continue;
|
|
227222
|
+
}
|
|
227223
|
+
flushSkippedFrames();
|
|
227224
|
+
filteredLines.push(line);
|
|
227225
|
+
}
|
|
227226
|
+
flushSkippedFrames();
|
|
227227
|
+
if (filteredLines.length <= 200) return filteredLines.join("\n");
|
|
227228
|
+
return [
|
|
227229
|
+
...filteredLines.slice(0, 80),
|
|
227230
|
+
"\n[... WARNING: Log output truncated by Orbit for Token Optimization ...]\n",
|
|
227231
|
+
...filteredLines.slice(-120)
|
|
227232
|
+
].join("\n");
|
|
227233
|
+
}
|
|
227234
|
+
function generateXMLToolsPrompt(tools) {
|
|
227235
|
+
const lines = [
|
|
227236
|
+
"",
|
|
227237
|
+
"",
|
|
227238
|
+
"### Tool Use Instructions",
|
|
227239
|
+
"You can execute tasks by calling tools. To call a tool, wrap it in a <tool_call> XML block with the correct parameter tags.",
|
|
227240
|
+
"Format:",
|
|
227241
|
+
'<tool_call name="tool_name">',
|
|
227242
|
+
" <param_name>value</param_name>",
|
|
227243
|
+
"</tool_call>",
|
|
227244
|
+
"",
|
|
227245
|
+
"Crucial XML Rules:",
|
|
227246
|
+
"1. DO NOT escape special characters (like <, >, &) inside parameter tags (e.g. inside <content> or <newText>). Write them raw. The parser handles raw content.",
|
|
227247
|
+
"2. Ensure parameter tag names match the parameter names exactly (case-sensitive).",
|
|
227248
|
+
"3. You can execute multiple tool calls in a single turn.",
|
|
227249
|
+
"",
|
|
227250
|
+
"Available Tools:",
|
|
227251
|
+
""
|
|
227252
|
+
];
|
|
227253
|
+
for (const tool of tools) {
|
|
227254
|
+
lines.push(`- **${tool.name}**: ${tool.description}`, " Parameters:");
|
|
227255
|
+
if (tool.inputSchema instanceof z63.ZodObject) {
|
|
227256
|
+
for (const [key, property] of Object.entries(tool.inputSchema.shape)) {
|
|
227257
|
+
const field = describeZodPromptField(property);
|
|
227258
|
+
const values = field.values ? `, values: ${field.values}` : "";
|
|
227259
|
+
const description = field.description ? ` - ${field.description.replace(/\s+/g, " ").trim()}` : "";
|
|
227260
|
+
lines.push(
|
|
227261
|
+
` - \`${key}\`: (type: ${field.typeName}${field.isOptional ? ", optional" : ""}${values})${description}`
|
|
227262
|
+
);
|
|
227263
|
+
}
|
|
227264
|
+
}
|
|
227265
|
+
lines.push("");
|
|
227266
|
+
}
|
|
227267
|
+
return lines.join("\n");
|
|
227268
|
+
}
|
|
227269
|
+
function generateNativeToolsPrompt(tools) {
|
|
227270
|
+
const names = tools.map((tool) => tool.name).sort().join(", ");
|
|
227271
|
+
return [
|
|
227272
|
+
"### Native Tool Use",
|
|
227273
|
+
"Use the provided native function tools when an operation requires workspace access.",
|
|
227274
|
+
"Validate every argument against the supplied schema, use exact tool names, and wait for tool results before claiming success.",
|
|
227275
|
+
"Do not print XML <tool_call> blocks or imitate tool calls in normal response text.",
|
|
227276
|
+
`Available tools: ${names || "none"}.`
|
|
227277
|
+
].join("\n");
|
|
227278
|
+
}
|
|
227279
|
+
function describeZodPromptField(schema) {
|
|
227280
|
+
let current = schema;
|
|
227281
|
+
let isOptional = false;
|
|
227282
|
+
while (true) {
|
|
227283
|
+
if (current instanceof z63.ZodOptional) {
|
|
227284
|
+
isOptional = true;
|
|
227285
|
+
current = current.unwrap();
|
|
227286
|
+
} else if (current instanceof z63.ZodDefault) {
|
|
227287
|
+
isOptional = true;
|
|
227288
|
+
current = current.removeDefault();
|
|
227289
|
+
} else if (current instanceof z63.ZodNullable) {
|
|
227290
|
+
current = current.unwrap();
|
|
227291
|
+
} else if (current instanceof z63.ZodEffects) {
|
|
227292
|
+
current = current.innerType();
|
|
227293
|
+
} else {
|
|
227294
|
+
break;
|
|
227295
|
+
}
|
|
227296
|
+
}
|
|
227297
|
+
return {
|
|
227298
|
+
typeName: String(current._def.typeName).replace("Zod", "").toLowerCase(),
|
|
227299
|
+
isOptional,
|
|
227300
|
+
values: current instanceof z63.ZodEnum ? current.options.join(", ") : void 0,
|
|
227301
|
+
description: schema.description ?? current.description
|
|
227302
|
+
};
|
|
227303
|
+
}
|
|
227304
|
+
function parseXMLToolCalls(text) {
|
|
227305
|
+
const toolCalls = [];
|
|
227306
|
+
const toolCallPattern = /<tool_call\s+name="([^"]+)"\s*>([\s\S]*?)<\/tool_call>/g;
|
|
227307
|
+
let toolCallMatch;
|
|
227308
|
+
while ((toolCallMatch = toolCallPattern.exec(text)) !== null) {
|
|
227309
|
+
const argumentsRecord = {};
|
|
227310
|
+
const parameterPattern = /<([a-zA-Z0-9_]+)\s*>([\s\S]*?)<\/\1\s*>/g;
|
|
227311
|
+
let parameterMatch;
|
|
227312
|
+
while ((parameterMatch = parameterPattern.exec(toolCallMatch[2])) !== null) {
|
|
227313
|
+
argumentsRecord[parameterMatch[1]] = parseToolArgument(
|
|
227314
|
+
trimOneBoundaryNewline(parameterMatch[2])
|
|
227315
|
+
);
|
|
227316
|
+
}
|
|
227317
|
+
toolCalls.push({
|
|
227318
|
+
id: `xml_call_${randomUUID24()}`,
|
|
227319
|
+
name: toolCallMatch[1],
|
|
227320
|
+
arguments: JSON.stringify(argumentsRecord)
|
|
227321
|
+
});
|
|
227322
|
+
}
|
|
227323
|
+
return toolCalls;
|
|
227324
|
+
}
|
|
227325
|
+
function trimOneBoundaryNewline(value) {
|
|
227326
|
+
return value.replace(/^\r?\n/, "").replace(/\r?\n$/, "");
|
|
227327
|
+
}
|
|
227328
|
+
function parseToolArgument(value) {
|
|
227329
|
+
if (value === "true") return true;
|
|
227330
|
+
if (value === "false") return false;
|
|
227331
|
+
if (/^-?\d+$/.test(value)) return Number.parseInt(value, 10);
|
|
227332
|
+
if (/^-?\d+\.\d+$/.test(value)) return Number.parseFloat(value);
|
|
227333
|
+
if (value.startsWith("[") && value.endsWith("]") || value.startsWith("{") && value.endsWith("}")) {
|
|
227334
|
+
try {
|
|
227335
|
+
return JSON.parse(value);
|
|
227336
|
+
} catch {
|
|
227337
|
+
}
|
|
227338
|
+
}
|
|
227339
|
+
return value;
|
|
227340
|
+
}
|
|
227153
227341
|
var execFilePromise2 = promisify2(execFile2);
|
|
227342
|
+
async function executeLocalPackageBinary(cwd, packageName, binaryName, args) {
|
|
227343
|
+
const binaryPath = resolveLocalPackageBinary(cwd, packageName, binaryName);
|
|
227344
|
+
const isJavaScript = /\.(?:cjs|mjs|js)$/i.test(binaryPath);
|
|
227345
|
+
const executable = isJavaScript ? process.execPath : binaryPath;
|
|
227346
|
+
const executableArgs = isJavaScript ? [binaryPath, ...args] : args;
|
|
227347
|
+
return execFilePromise2(executable, executableArgs, {
|
|
227348
|
+
cwd,
|
|
227349
|
+
encoding: "utf8",
|
|
227350
|
+
timeout: 12e4
|
|
227351
|
+
});
|
|
227352
|
+
}
|
|
227353
|
+
function resolveLocalPackageBinary(cwd, packageName, binaryName) {
|
|
227354
|
+
const workspaceRequire = createRequire(path22.join(cwd, "package.json"));
|
|
227355
|
+
const entryPath = workspaceRequire.resolve(packageName);
|
|
227356
|
+
let currentDirectory = path22.dirname(entryPath);
|
|
227357
|
+
while (true) {
|
|
227358
|
+
const manifestPath = path22.join(currentDirectory, "package.json");
|
|
227359
|
+
if (fs22.existsSync(manifestPath)) {
|
|
227360
|
+
const manifest = JSON.parse(fs22.readFileSync(manifestPath, "utf8"));
|
|
227361
|
+
if (manifest.name === packageName) {
|
|
227362
|
+
const relativeBinary = resolveManifestBinary(manifest.bin, binaryName);
|
|
227363
|
+
if (!relativeBinary) {
|
|
227364
|
+
throw new Error(
|
|
227365
|
+
`Package "${packageName}" does not expose binary "${binaryName}".`
|
|
227366
|
+
);
|
|
227367
|
+
}
|
|
227368
|
+
return path22.resolve(currentDirectory, relativeBinary);
|
|
227369
|
+
}
|
|
227370
|
+
}
|
|
227371
|
+
const parent = path22.dirname(currentDirectory);
|
|
227372
|
+
if (parent === currentDirectory) break;
|
|
227373
|
+
currentDirectory = parent;
|
|
227374
|
+
}
|
|
227375
|
+
throw new Error(
|
|
227376
|
+
`Unable to locate local package binary for "${packageName}".`
|
|
227377
|
+
);
|
|
227378
|
+
}
|
|
227379
|
+
function resolveManifestBinary(bin, binaryName) {
|
|
227380
|
+
if (typeof bin === "string") return bin;
|
|
227381
|
+
if (typeof bin !== "object" || bin === null) return void 0;
|
|
227382
|
+
const candidate = bin[binaryName];
|
|
227383
|
+
return typeof candidate === "string" ? candidate : void 0;
|
|
227384
|
+
}
|
|
227385
|
+
function isValidPackageName(packageName) {
|
|
227386
|
+
if (packageName.length === 0 || packageName.length > 214) return false;
|
|
227387
|
+
return /^(?:@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*$/.test(
|
|
227388
|
+
packageName
|
|
227389
|
+
);
|
|
227390
|
+
}
|
|
227391
|
+
var execPromise2 = promisify3(exec2);
|
|
227392
|
+
var execFilePromise3 = promisify3(execFile3);
|
|
227154
227393
|
var DEEPSEEK_CACHE_DEGRADED_HIT_RATE = 0.85;
|
|
227155
227394
|
var DEEPSEEK_VERBOSE_CACHE_ENV = "ORBIT_DEEPSEEK_VERBOSE_CACHE";
|
|
227156
227395
|
var NETWORK_TOOL_RESULT_MAX_RESULTS = 10;
|
|
@@ -227188,8 +227427,8 @@ var AgentLoop = class {
|
|
|
227188
227427
|
cwd,
|
|
227189
227428
|
config.session.store === "jsonl" ? config.session.path : ".orbit/sessions"
|
|
227190
227429
|
);
|
|
227191
|
-
const workspaceIdentity =
|
|
227192
|
-
this.userId =
|
|
227430
|
+
const workspaceIdentity = path32.resolve(cwd).replace(/\\/g, "/");
|
|
227431
|
+
this.userId = createHash32("sha256").update(
|
|
227193
227432
|
process.platform === "win32" ? workspaceIdentity.toLowerCase() : workspaceIdentity
|
|
227194
227433
|
).digest("hex");
|
|
227195
227434
|
let session;
|
|
@@ -227559,8 +227798,8 @@ ${normalized}`);
|
|
|
227559
227798
|
try {
|
|
227560
227799
|
const indexer = new SymbolIndexer(this.cwd);
|
|
227561
227800
|
const indexPath = indexer.indexPath;
|
|
227562
|
-
if (
|
|
227563
|
-
const stat =
|
|
227801
|
+
if (fs3.existsSync(indexPath)) {
|
|
227802
|
+
const stat = fs3.statSync(indexPath);
|
|
227564
227803
|
if (stat.mtimeMs === this.lastSymbolsMtime && this.cachedRepoMapText) {
|
|
227565
227804
|
repoMapText = this.cachedRepoMapText;
|
|
227566
227805
|
} else {
|
|
@@ -228193,7 +228432,7 @@ Please analyze this failure log, locate the files causing assertion or compile e
|
|
|
228193
228432
|
if (tc.name === "write_file" || tc.name === "edit_file" || tc.name === "replace_file_content" || tc.name === "multi_replace_file_content") {
|
|
228194
228433
|
const targetPath2 = evalArgs.path || evalArgs.TargetFile || evalArgs.filePath || evalArgs.file;
|
|
228195
228434
|
if (targetPath2) {
|
|
228196
|
-
const relPath =
|
|
228435
|
+
const relPath = path32.relative(this.cwd, path32.resolve(this.cwd, targetPath2)).replace(/\\/g, "/");
|
|
228197
228436
|
const foundFile = this.state.relevantFiles.find(
|
|
228198
228437
|
(f2) => f2.path === relPath
|
|
228199
228438
|
);
|
|
@@ -228298,7 +228537,7 @@ Please analyze this failure log, locate the files causing assertion or compile e
|
|
|
228298
228537
|
break;
|
|
228299
228538
|
} else if (choice === "edit") {
|
|
228300
228539
|
let edited = null;
|
|
228301
|
-
const isObjectSchema = registeredTool?.inputSchema instanceof
|
|
228540
|
+
const isObjectSchema = registeredTool?.inputSchema instanceof z73.ZodObject;
|
|
228302
228541
|
if (isObjectSchema) {
|
|
228303
228542
|
const editChoice = await Prompt.askSelect(
|
|
228304
228543
|
"Choose edit mode:",
|
|
@@ -228642,7 +228881,7 @@ ${stdout.substring(0, 2e4)}`
|
|
|
228642
228881
|
}
|
|
228643
228882
|
if (finalResult.ok && targetPath && absoluteTargetPath && (tc.name === "write_file" || tc.name === "edit_file" || tc.name === "replace_file_content" || tc.name === "multi_replace_file_content")) {
|
|
228644
228883
|
try {
|
|
228645
|
-
if (
|
|
228884
|
+
if (fs3.existsSync(path32.join(this.cwd, "biome.json")) || fs3.existsSync(path32.join(this.cwd, "biome.jsonc"))) {
|
|
228646
228885
|
this.interaction.showText(`\u25CF Running Biome Auto-Format...`);
|
|
228647
228886
|
await executeLocalPackageBinary(
|
|
228648
228887
|
this.cwd,
|
|
@@ -228661,7 +228900,7 @@ ${stdout.substring(0, 2e4)}`
|
|
|
228661
228900
|
];
|
|
228662
228901
|
let hasPrettierConfig = false;
|
|
228663
228902
|
for (const c2 of prettierCandidates) {
|
|
228664
|
-
if (
|
|
228903
|
+
if (fs3.existsSync(path32.join(this.cwd, c2))) {
|
|
228665
228904
|
hasPrettierConfig = true;
|
|
228666
228905
|
break;
|
|
228667
228906
|
}
|
|
@@ -228686,7 +228925,7 @@ ${stdout.substring(0, 2e4)}`
|
|
|
228686
228925
|
];
|
|
228687
228926
|
let hasEslintConfig = false;
|
|
228688
228927
|
for (const c2 of eslintCandidates) {
|
|
228689
|
-
if (
|
|
228928
|
+
if (fs3.existsSync(path32.join(this.cwd, c2))) {
|
|
228690
228929
|
hasEslintConfig = true;
|
|
228691
228930
|
break;
|
|
228692
228931
|
}
|
|
@@ -228704,7 +228943,7 @@ ${stdout.substring(0, 2e4)}`
|
|
|
228704
228943
|
let lintPackage = "eslint";
|
|
228705
228944
|
let lintBinary = "eslint";
|
|
228706
228945
|
let lintArgs = ["--quiet", absoluteTargetPath];
|
|
228707
|
-
if (
|
|
228946
|
+
if (fs3.existsSync(path32.join(this.cwd, "biome.json")) || fs3.existsSync(path32.join(this.cwd, "biome.jsonc"))) {
|
|
228708
228947
|
lintPackage = "@biomejs/biome";
|
|
228709
228948
|
lintBinary = "biome";
|
|
228710
228949
|
lintArgs = ["lint", absoluteTargetPath];
|
|
@@ -228766,11 +229005,11 @@ ${stdout.substring(0, 2e4)}`
|
|
|
228766
229005
|
);
|
|
228767
229006
|
if (installPkg) {
|
|
228768
229007
|
this.interaction.showText(`\u25CF Installing "${pkg}"...`);
|
|
228769
|
-
const isPnpm =
|
|
228770
|
-
|
|
229008
|
+
const isPnpm = fs3.existsSync(
|
|
229009
|
+
path32.join(this.cwd, "pnpm-lock.yaml")
|
|
228771
229010
|
);
|
|
228772
|
-
const isYarn =
|
|
228773
|
-
|
|
229011
|
+
const isYarn = fs3.existsSync(
|
|
229012
|
+
path32.join(this.cwd, "yarn.lock")
|
|
228774
229013
|
);
|
|
228775
229014
|
try {
|
|
228776
229015
|
if (!isValidPackageName(pkg)) {
|
|
@@ -228780,7 +229019,7 @@ ${stdout.substring(0, 2e4)}`
|
|
|
228780
229019
|
}
|
|
228781
229020
|
const executable = isPnpm ? "pnpm" : isYarn ? "yarn" : "npm";
|
|
228782
229021
|
const args = isPnpm || isYarn ? ["add", "-D", pkg] : ["install", "--save-dev", pkg];
|
|
228783
|
-
await
|
|
229022
|
+
await execFilePromise3(executable, args, {
|
|
228784
229023
|
cwd: this.cwd
|
|
228785
229024
|
});
|
|
228786
229025
|
this.interaction.showText(
|
|
@@ -228837,11 +229076,11 @@ ${stdout.substring(0, 2e4)}`
|
|
|
228837
229076
|
}
|
|
228838
229077
|
if (missingSymbols.length > 0) {
|
|
228839
229078
|
const indexPath = new SymbolIndexer(this.cwd).indexPath;
|
|
228840
|
-
if (
|
|
228841
|
-
const raw =
|
|
229079
|
+
if (fs3.existsSync(indexPath)) {
|
|
229080
|
+
const raw = fs3.readFileSync(indexPath, "utf8");
|
|
228842
229081
|
const index = JSON.parse(raw);
|
|
228843
229082
|
if (index.files && typeof index.files === "object") {
|
|
228844
|
-
const fileContent =
|
|
229083
|
+
const fileContent = fs3.readFileSync(
|
|
228845
229084
|
absoluteTargetPath,
|
|
228846
229085
|
"utf8"
|
|
228847
229086
|
);
|
|
@@ -228862,12 +229101,12 @@ ${stdout.substring(0, 2e4)}`
|
|
|
228862
229101
|
}
|
|
228863
229102
|
}
|
|
228864
229103
|
if (foundFile) {
|
|
228865
|
-
const targetDir =
|
|
228866
|
-
const exportFileAbs =
|
|
229104
|
+
const targetDir = path32.dirname(absoluteTargetPath);
|
|
229105
|
+
const exportFileAbs = path32.resolve(
|
|
228867
229106
|
this.cwd,
|
|
228868
229107
|
foundFile
|
|
228869
229108
|
);
|
|
228870
|
-
let relPath =
|
|
229109
|
+
let relPath = path32.relative(
|
|
228871
229110
|
targetDir,
|
|
228872
229111
|
exportFileAbs
|
|
228873
229112
|
);
|
|
@@ -228884,7 +229123,7 @@ ${stdout.substring(0, 2e4)}`
|
|
|
228884
229123
|
}
|
|
228885
229124
|
}
|
|
228886
229125
|
if (newImports) {
|
|
228887
|
-
|
|
229126
|
+
fs3.writeFileSync(
|
|
228888
229127
|
absoluteTargetPath,
|
|
228889
229128
|
newImports + fileContent,
|
|
228890
229129
|
"utf8"
|
|
@@ -228946,7 +229185,7 @@ ${stdout.substring(0, 2e4)}`
|
|
|
228946
229185
|
if (finalResult.ok && targetPath && absoluteTargetPath && (tc.name === "write_file" || tc.name === "edit_file" || tc.name === "replace_file_content" || tc.name === "multi_replace_file_content")) {
|
|
228947
229186
|
let afterContent = "";
|
|
228948
229187
|
try {
|
|
228949
|
-
afterContent =
|
|
229188
|
+
afterContent = fs3.readFileSync(absoluteTargetPath, "utf8");
|
|
228950
229189
|
} catch {
|
|
228951
229190
|
try {
|
|
228952
229191
|
const afterArgs = JSON.parse(tc.arguments);
|
|
@@ -229103,7 +229342,7 @@ ${stdout.substring(0, 2e4)}`
|
|
|
229103
229342
|
lastB = hunk.endB;
|
|
229104
229343
|
}
|
|
229105
229344
|
mergedLines.push(...linesBefore.slice(lastB));
|
|
229106
|
-
|
|
229345
|
+
fs3.writeFileSync(
|
|
229107
229346
|
absoluteTargetPath,
|
|
229108
229347
|
mergedLines.join("\n"),
|
|
229109
229348
|
"utf8"
|
|
@@ -229140,9 +229379,9 @@ ${stdout.substring(0, 2e4)}`
|
|
|
229140
229379
|
}
|
|
229141
229380
|
if (finalResult.ok && targetPath && absoluteTargetPath && isFileMutationTool(tc.name)) {
|
|
229142
229381
|
try {
|
|
229143
|
-
const afterContent =
|
|
229382
|
+
const afterContent = fs3.readFileSync(absoluteTargetPath, "utf8");
|
|
229144
229383
|
this.sessionManager.recordFileModification(
|
|
229145
|
-
|
|
229384
|
+
path32.relative(this.cwd, absoluteTargetPath).replace(/\\/g, "/"),
|
|
229146
229385
|
buildAuditDiff(targetPath, beforeContent, afterContent),
|
|
229147
229386
|
beforeContent === null ? void 0 : sha256(beforeContent),
|
|
229148
229387
|
sha256(afterContent)
|
|
@@ -229386,14 +229625,14 @@ ${diff.substring(0, 2e4)}`
|
|
|
229386
229625
|
});
|
|
229387
229626
|
this.sessionManager.saveHistory(this.state.history);
|
|
229388
229627
|
}
|
|
229389
|
-
addRelevantFile(
|
|
229390
|
-
if (!this.state.relevantFiles.some((f2) => f2.path ===
|
|
229391
|
-
this.state.relevantFiles.push({ path:
|
|
229628
|
+
addRelevantFile(path5, reason) {
|
|
229629
|
+
if (!this.state.relevantFiles.some((f2) => f2.path === path5)) {
|
|
229630
|
+
this.state.relevantFiles.push({ path: path5, reason });
|
|
229392
229631
|
}
|
|
229393
229632
|
}
|
|
229394
229633
|
async runHook(hookCommand, filePath) {
|
|
229395
|
-
const absolutePath =
|
|
229396
|
-
const relativePath =
|
|
229634
|
+
const absolutePath = path32.isAbsolute(filePath) ? filePath : path32.resolve(this.cwd, filePath);
|
|
229635
|
+
const relativePath = path32.relative(this.cwd, absolutePath);
|
|
229397
229636
|
if (hookCommand.includes("{file}")) {
|
|
229398
229637
|
return {
|
|
229399
229638
|
ok: false,
|
|
@@ -229453,7 +229692,7 @@ ${diff.substring(0, 2e4)}`
|
|
|
229453
229692
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
229454
229693
|
const plan = this.sessionManager.getTaskPlan();
|
|
229455
229694
|
const item = {
|
|
229456
|
-
id: `step_${
|
|
229695
|
+
id: `step_${randomUUID32()}`,
|
|
229457
229696
|
text: text.trim(),
|
|
229458
229697
|
status: "pending",
|
|
229459
229698
|
createdAt: now,
|
|
@@ -229517,18 +229756,18 @@ ${diff.substring(0, 2e4)}`
|
|
|
229517
229756
|
content: [{ type: "text", text: task }]
|
|
229518
229757
|
});
|
|
229519
229758
|
}
|
|
229520
|
-
addRelevantFilePublic(
|
|
229521
|
-
this.addRelevantFile(
|
|
229759
|
+
addRelevantFilePublic(path5, reason) {
|
|
229760
|
+
this.addRelevantFile(path5, reason);
|
|
229522
229761
|
}
|
|
229523
|
-
addReadOnlyFilePublic(
|
|
229524
|
-
if (!this.state.relevantFiles.some((f2) => f2.path ===
|
|
229525
|
-
this.state.relevantFiles.push({ path:
|
|
229762
|
+
addReadOnlyFilePublic(path5, reason) {
|
|
229763
|
+
if (!this.state.relevantFiles.some((f2) => f2.path === path5)) {
|
|
229764
|
+
this.state.relevantFiles.push({ path: path5, reason, readOnly: true });
|
|
229526
229765
|
}
|
|
229527
229766
|
this.cachedContextPack = null;
|
|
229528
229767
|
}
|
|
229529
|
-
removeRelevantFilePublic(
|
|
229768
|
+
removeRelevantFilePublic(path5) {
|
|
229530
229769
|
this.state.relevantFiles = this.state.relevantFiles.filter(
|
|
229531
|
-
(f2) => f2.path !==
|
|
229770
|
+
(f2) => f2.path !== path5
|
|
229532
229771
|
);
|
|
229533
229772
|
this.cachedContextPack = null;
|
|
229534
229773
|
}
|
|
@@ -229725,11 +229964,11 @@ ${diff.substring(0, 2e4)}`
|
|
|
229725
229964
|
const safePath = resolveSafePath(this.cwd, backup.path);
|
|
229726
229965
|
try {
|
|
229727
229966
|
if (backup.originalContent === null) {
|
|
229728
|
-
if (
|
|
229729
|
-
|
|
229967
|
+
if (fs3.existsSync(safePath)) {
|
|
229968
|
+
fs3.unlinkSync(safePath);
|
|
229730
229969
|
}
|
|
229731
229970
|
} else {
|
|
229732
|
-
|
|
229971
|
+
fs3.writeFileSync(safePath, backup.originalContent, "utf8");
|
|
229733
229972
|
}
|
|
229734
229973
|
return true;
|
|
229735
229974
|
} catch {
|
|
@@ -229850,7 +230089,7 @@ ${diff.substring(0, 2e4)}`
|
|
|
229850
230089
|
if (this.options?.nonInteractive) return null;
|
|
229851
230090
|
try {
|
|
229852
230091
|
const schema = registeredTool.inputSchema;
|
|
229853
|
-
if (!(schema instanceof
|
|
230092
|
+
if (!(schema instanceof z73.ZodObject)) {
|
|
229854
230093
|
return null;
|
|
229855
230094
|
}
|
|
229856
230095
|
const currentArgs = JSON.parse(currentArgsStr);
|
|
@@ -229862,17 +230101,17 @@ ${diff.substring(0, 2e4)}`
|
|
|
229862
230101
|
const description = fieldSchema.description || `Parameter "${key}"`;
|
|
229863
230102
|
let result = null;
|
|
229864
230103
|
let unwrapped = fieldSchema;
|
|
229865
|
-
while (unwrapped instanceof
|
|
230104
|
+
while (unwrapped instanceof z73.ZodOptional || unwrapped instanceof z73.ZodNullable || unwrapped instanceof z73.ZodEffects) {
|
|
229866
230105
|
unwrapped = unwrapped._def.innerType || unwrapped._def.schema;
|
|
229867
230106
|
}
|
|
229868
|
-
if (unwrapped instanceof
|
|
230107
|
+
if (unwrapped instanceof z73.ZodBoolean) {
|
|
229869
230108
|
const choice = await Prompt.askSelect(`${description} (boolean):`, [
|
|
229870
230109
|
{ value: "true", label: "true" },
|
|
229871
230110
|
{ value: "false", label: "false" }
|
|
229872
230111
|
]);
|
|
229873
230112
|
if (choice === null) return null;
|
|
229874
230113
|
result = choice === "true";
|
|
229875
|
-
} else if (unwrapped instanceof
|
|
230114
|
+
} else if (unwrapped instanceof z73.ZodEnum) {
|
|
229876
230115
|
const options = unwrapped._def.values.map((v2) => ({
|
|
229877
230116
|
value: v2,
|
|
229878
230117
|
label: v2
|
|
@@ -229889,10 +230128,10 @@ ${diff.substring(0, 2e4)}`
|
|
|
229889
230128
|
valStr
|
|
229890
230129
|
);
|
|
229891
230130
|
if (input === null) return null;
|
|
229892
|
-
if (unwrapped instanceof
|
|
230131
|
+
if (unwrapped instanceof z73.ZodNumber) {
|
|
229893
230132
|
const num = Number(input);
|
|
229894
230133
|
result = isNaN(num) ? input : num;
|
|
229895
|
-
} else if (unwrapped instanceof
|
|
230134
|
+
} else if (unwrapped instanceof z73.ZodArray || unwrapped instanceof z73.ZodObject) {
|
|
229896
230135
|
try {
|
|
229897
230136
|
result = JSON.parse(input);
|
|
229898
230137
|
} catch {
|
|
@@ -229982,286 +230221,9 @@ ${diff.substring(0, 2e4)}`
|
|
|
229982
230221
|
}
|
|
229983
230222
|
}
|
|
229984
230223
|
};
|
|
229985
|
-
|
|
229986
|
-
|
|
229987
|
-
|
|
229988
|
-
"edit_file",
|
|
229989
|
-
"replace_file_content",
|
|
229990
|
-
"multi_replace_file_content"
|
|
229991
|
-
].includes(toolName);
|
|
229992
|
-
}
|
|
229993
|
-
function sha256(value) {
|
|
229994
|
-
return createHash23("sha256").update(value).digest("hex");
|
|
229995
|
-
}
|
|
229996
|
-
function buildAuditDiff(filePath, before, after) {
|
|
229997
|
-
const maxChars = 4e4;
|
|
229998
|
-
const bounded = (value) => value.length <= maxChars ? value : `${value.slice(0, maxChars)}
|
|
229999
|
-
... [truncated by Orbit audit]`;
|
|
230000
|
-
const beforeText = bounded(before || "").split("\n").map((line) => `-${line}`).join("\n");
|
|
230001
|
-
const afterText = bounded(after).split("\n").map((line) => `+${line}`).join("\n");
|
|
230002
|
-
return `--- a/${filePath}
|
|
230003
|
-
+++ b/${filePath}
|
|
230004
|
-
@@ Orbit recorded before/after @@
|
|
230005
|
-
${beforeText}
|
|
230006
|
-
${afterText}`;
|
|
230007
|
-
}
|
|
230008
|
-
function generateXMLToolsPrompt(tools) {
|
|
230009
|
-
let prompt = `
|
|
230010
|
-
|
|
230011
|
-
### Tool Use Instructions
|
|
230012
|
-
`;
|
|
230013
|
-
prompt += `You can execute tasks by calling tools. To call a tool, wrap it in a <tool_call> XML block with the correct parameter tags.
|
|
230014
|
-
`;
|
|
230015
|
-
prompt += `Format:
|
|
230016
|
-
`;
|
|
230017
|
-
prompt += `<tool_call name="tool_name">
|
|
230018
|
-
`;
|
|
230019
|
-
prompt += ` <param_name>value</param_name>
|
|
230020
|
-
`;
|
|
230021
|
-
prompt += `</tool_call>
|
|
230022
|
-
|
|
230023
|
-
`;
|
|
230024
|
-
prompt += `Crucial XML Rules:
|
|
230025
|
-
`;
|
|
230026
|
-
prompt += `1. DO NOT escape special characters (like <, >, &) inside parameter tags (e.g. inside <content> or <newText>). Write them raw. The parser handles raw content.
|
|
230027
|
-
`;
|
|
230028
|
-
prompt += `2. Ensure parameter tag names match the parameter names exactly (case-sensitive).
|
|
230029
|
-
`;
|
|
230030
|
-
prompt += `3. You can execute multiple tool calls in a single turn.
|
|
230031
|
-
|
|
230032
|
-
`;
|
|
230033
|
-
prompt += `Available Tools:
|
|
230034
|
-
|
|
230035
|
-
`;
|
|
230036
|
-
for (const tool of tools) {
|
|
230037
|
-
prompt += `- **${tool.name}**: ${tool.description}
|
|
230038
|
-
`;
|
|
230039
|
-
prompt += ` Parameters:
|
|
230040
|
-
`;
|
|
230041
|
-
const schema = tool.inputSchema;
|
|
230042
|
-
if (schema && schema.shape) {
|
|
230043
|
-
for (const [key, prop] of Object.entries(schema.shape)) {
|
|
230044
|
-
const field = describeZodPromptField(prop);
|
|
230045
|
-
const values = field.values ? `, values: ${field.values}` : "";
|
|
230046
|
-
const description = field.description ? ` - ${field.description.replace(/\s+/g, " ").trim()}` : "";
|
|
230047
|
-
prompt += ` - \`${key}\`: (type: ${field.typeName}${field.isOptional ? ", optional" : ""}${values})${description}
|
|
230048
|
-
`;
|
|
230049
|
-
}
|
|
230050
|
-
}
|
|
230051
|
-
prompt += `
|
|
230052
|
-
`;
|
|
230053
|
-
}
|
|
230054
|
-
return prompt;
|
|
230055
|
-
}
|
|
230056
|
-
function generateNativeToolsPrompt(tools) {
|
|
230057
|
-
const names = tools.map((tool) => tool.name).sort().join(", ");
|
|
230058
|
-
return [
|
|
230059
|
-
"### Native Tool Use",
|
|
230060
|
-
"Use the provided native function tools when an operation requires workspace access.",
|
|
230061
|
-
"Validate every argument against the supplied schema, use exact tool names, and wait for tool results before claiming success.",
|
|
230062
|
-
"Do not print XML <tool_call> blocks or imitate tool calls in normal response text.",
|
|
230063
|
-
`Available tools: ${names || "none"}.`
|
|
230064
|
-
].join("\n");
|
|
230065
|
-
}
|
|
230066
|
-
function describeZodPromptField(schema) {
|
|
230067
|
-
const description = schema?.description || schema?._def?.description;
|
|
230068
|
-
let current = schema;
|
|
230069
|
-
let isOptional = false;
|
|
230070
|
-
while (current?._def) {
|
|
230071
|
-
const typeName2 = current._def.typeName;
|
|
230072
|
-
if (typeName2 === "ZodOptional" || typeName2 === "ZodDefault") {
|
|
230073
|
-
isOptional = true;
|
|
230074
|
-
current = current._def.innerType;
|
|
230075
|
-
continue;
|
|
230076
|
-
}
|
|
230077
|
-
if (typeName2 === "ZodNullable" || typeName2 === "ZodEffects") {
|
|
230078
|
-
current = current._def.innerType || current._def.schema;
|
|
230079
|
-
continue;
|
|
230080
|
-
}
|
|
230081
|
-
break;
|
|
230082
|
-
}
|
|
230083
|
-
const typeName = String(current?._def?.typeName || "ZodString").replace("Zod", "").toLowerCase();
|
|
230084
|
-
const values = current instanceof z63.ZodEnum ? current._def.values.join(", ") : void 0;
|
|
230085
|
-
return {
|
|
230086
|
-
typeName,
|
|
230087
|
-
isOptional,
|
|
230088
|
-
values,
|
|
230089
|
-
description: description || current?.description || current?._def?.description
|
|
230090
|
-
};
|
|
230091
|
-
}
|
|
230092
|
-
function parseXMLToolCalls(text) {
|
|
230093
|
-
const toolCalls = [];
|
|
230094
|
-
const toolCallRegex = /<tool_call\s+name="([^"]+)"\s*>([\s\S]*?)<\/tool_call>/g;
|
|
230095
|
-
let match;
|
|
230096
|
-
let idCounter = 1;
|
|
230097
|
-
while ((match = toolCallRegex.exec(text)) !== null) {
|
|
230098
|
-
const name = match[1];
|
|
230099
|
-
const innerContent = match[2];
|
|
230100
|
-
const paramRegex = /<([a-zA-Z0-9_]+)\s*>([\s\S]*?)<\/\1\s*>/g;
|
|
230101
|
-
const args = {};
|
|
230102
|
-
let paramMatch;
|
|
230103
|
-
while ((paramMatch = paramRegex.exec(innerContent)) !== null) {
|
|
230104
|
-
const paramName = paramMatch[1];
|
|
230105
|
-
let paramValue = paramMatch[2];
|
|
230106
|
-
if (paramValue.startsWith("\n")) {
|
|
230107
|
-
paramValue = paramValue.substring(1);
|
|
230108
|
-
}
|
|
230109
|
-
if (paramValue.endsWith("\n")) {
|
|
230110
|
-
paramValue = paramValue.substring(0, paramValue.length - 1);
|
|
230111
|
-
} else if (paramValue.endsWith("\r\n")) {
|
|
230112
|
-
paramValue = paramValue.substring(0, paramValue.length - 2);
|
|
230113
|
-
}
|
|
230114
|
-
let typedValue = paramValue;
|
|
230115
|
-
if (paramValue === "true") {
|
|
230116
|
-
typedValue = true;
|
|
230117
|
-
} else if (paramValue === "false") {
|
|
230118
|
-
typedValue = false;
|
|
230119
|
-
} else if (/^-?\d+$/.test(paramValue)) {
|
|
230120
|
-
typedValue = parseInt(paramValue, 10);
|
|
230121
|
-
} else if (/^-?\d+\.\d+$/.test(paramValue)) {
|
|
230122
|
-
typedValue = parseFloat(paramValue);
|
|
230123
|
-
} else if (paramValue.startsWith("[") && paramValue.endsWith("]") || paramValue.startsWith("{") && paramValue.endsWith("}")) {
|
|
230124
|
-
try {
|
|
230125
|
-
typedValue = JSON.parse(paramValue);
|
|
230126
|
-
} catch {
|
|
230127
|
-
}
|
|
230128
|
-
}
|
|
230129
|
-
args[paramName] = typedValue;
|
|
230130
|
-
}
|
|
230131
|
-
toolCalls.push({
|
|
230132
|
-
id: `xml_call_${idCounter++}_${Date.now()}`,
|
|
230133
|
-
name,
|
|
230134
|
-
arguments: JSON.stringify(args)
|
|
230135
|
-
});
|
|
230136
|
-
}
|
|
230137
|
-
return toolCalls;
|
|
230138
|
-
}
|
|
230139
|
-
function extractFilePathFromLine(line) {
|
|
230140
|
-
const winAbsMatch = line.match(/([a-zA-Z]:[\\/][^`*:"#\s]+)/);
|
|
230141
|
-
if (winAbsMatch) {
|
|
230142
|
-
return winAbsMatch[1];
|
|
230143
|
-
}
|
|
230144
|
-
const unixAbsMatch = line.match(/(?:^|\s)(\/[^`*:"#\s]+)/);
|
|
230145
|
-
if (unixAbsMatch) {
|
|
230146
|
-
return unixAbsMatch[1];
|
|
230147
|
-
}
|
|
230148
|
-
const pathMatch = line.match(/([.\w\-+]+[\\/][^`*:"#\s]+)/);
|
|
230149
|
-
if (pathMatch) {
|
|
230150
|
-
return pathMatch[1];
|
|
230151
|
-
}
|
|
230152
|
-
return line.replace(/[`*:*#\-+]/g, "").trim();
|
|
230153
|
-
}
|
|
230154
|
-
function parseSearchReplaceBlocks(text) {
|
|
230155
|
-
const blocks = [];
|
|
230156
|
-
const regex = /<<<<<<< SEARCH\r?\n([\s\S]*?)\r?\n=======\r?\n([\s\S]*?)\r?\n>>>>>>>/g;
|
|
230157
|
-
let match;
|
|
230158
|
-
while ((match = regex.exec(text)) !== null) {
|
|
230159
|
-
const startIndex = match.index;
|
|
230160
|
-
const oldText = match[1];
|
|
230161
|
-
const newText = match[2];
|
|
230162
|
-
const beforeText = text.substring(0, startIndex);
|
|
230163
|
-
const lines = beforeText.split(/\r?\n/);
|
|
230164
|
-
let filePath = "";
|
|
230165
|
-
for (let i = lines.length - 1; i >= 0; i--) {
|
|
230166
|
-
const line = lines[i].trim();
|
|
230167
|
-
const extracted = extractFilePathFromLine(line);
|
|
230168
|
-
if (extracted && (extracted.includes("/") || extracted.includes("\\") || extracted.endsWith(".ts") || extracted.endsWith(".js") || extracted.endsWith(".txt"))) {
|
|
230169
|
-
filePath = extracted;
|
|
230170
|
-
break;
|
|
230171
|
-
}
|
|
230172
|
-
}
|
|
230173
|
-
if (filePath) {
|
|
230174
|
-
blocks.push({
|
|
230175
|
-
filePath,
|
|
230176
|
-
oldText,
|
|
230177
|
-
newText
|
|
230178
|
-
});
|
|
230179
|
-
}
|
|
230180
|
-
}
|
|
230181
|
-
return blocks;
|
|
230182
|
-
}
|
|
230183
|
-
function cleanAndTruncateTestLog(log) {
|
|
230184
|
-
const cleaned = log.replace(/\u001b\[\d+(;\d+)*m/g, "").replace(/\x1B\[[0-9;]*[a-zA-Z]/g, "");
|
|
230185
|
-
const lines = cleaned.split(/\r?\n/);
|
|
230186
|
-
const filteredLines = [];
|
|
230187
|
-
let skipCount = 0;
|
|
230188
|
-
for (const line of lines) {
|
|
230189
|
-
const trimmed = line.trim();
|
|
230190
|
-
if (trimmed.startsWith("at ") && (trimmed.includes("node_modules") || trimmed.includes("node:internal") || trimmed.includes("node:events"))) {
|
|
230191
|
-
skipCount++;
|
|
230192
|
-
continue;
|
|
230193
|
-
}
|
|
230194
|
-
if (skipCount > 0) {
|
|
230195
|
-
filteredLines.push(
|
|
230196
|
-
` ... skipped ${skipCount} internal/library stack frames ...`
|
|
230197
|
-
);
|
|
230198
|
-
skipCount = 0;
|
|
230199
|
-
}
|
|
230200
|
-
filteredLines.push(line);
|
|
230201
|
-
}
|
|
230202
|
-
if (skipCount > 0) {
|
|
230203
|
-
filteredLines.push(
|
|
230204
|
-
` ... skipped ${skipCount} internal/library stack frames ...`
|
|
230205
|
-
);
|
|
230206
|
-
}
|
|
230207
|
-
if (filteredLines.length > 200) {
|
|
230208
|
-
const top = filteredLines.slice(0, 80);
|
|
230209
|
-
const bottom = filteredLines.slice(filteredLines.length - 120);
|
|
230210
|
-
return [
|
|
230211
|
-
...top,
|
|
230212
|
-
"\n[... WARNING: Log output truncated by Orbit for Token Optimization ...]\n",
|
|
230213
|
-
...bottom
|
|
230214
|
-
].join("\n");
|
|
230215
|
-
}
|
|
230216
|
-
return filteredLines.join("\n");
|
|
230217
|
-
}
|
|
230218
|
-
async function executeLocalPackageBinary(cwd, packageName, binaryName, args) {
|
|
230219
|
-
const binaryPath = resolveLocalPackageBinary(cwd, packageName, binaryName);
|
|
230220
|
-
const isJavaScript = /\.(?:cjs|mjs|js)$/i.test(binaryPath);
|
|
230221
|
-
const executable = isJavaScript ? process.execPath : binaryPath;
|
|
230222
|
-
const executableArgs = isJavaScript ? [binaryPath, ...args] : args;
|
|
230223
|
-
return execFilePromise2(executable, executableArgs, {
|
|
230224
|
-
cwd,
|
|
230225
|
-
encoding: "utf8",
|
|
230226
|
-
timeout: 12e4
|
|
230227
|
-
});
|
|
230228
|
-
}
|
|
230229
|
-
function resolveLocalPackageBinary(cwd, packageName, binaryName) {
|
|
230230
|
-
const workspaceRequire = createRequire(path22.join(cwd, "package.json"));
|
|
230231
|
-
const entryPath = workspaceRequire.resolve(packageName);
|
|
230232
|
-
let currentDirectory = path22.dirname(entryPath);
|
|
230233
|
-
while (true) {
|
|
230234
|
-
const manifestPath = path22.join(currentDirectory, "package.json");
|
|
230235
|
-
if (fs2.existsSync(manifestPath)) {
|
|
230236
|
-
const manifest = JSON.parse(fs2.readFileSync(manifestPath, "utf8"));
|
|
230237
|
-
if (manifest.name === packageName) {
|
|
230238
|
-
const bin = manifest.bin;
|
|
230239
|
-
const relativeBinary = typeof bin === "string" ? bin : typeof bin === "object" && bin !== null && binaryName in bin && typeof bin[binaryName] === "string" ? bin[binaryName] : void 0;
|
|
230240
|
-
if (!relativeBinary) {
|
|
230241
|
-
throw new Error(
|
|
230242
|
-
`Package "${packageName}" does not expose binary "${binaryName}".`
|
|
230243
|
-
);
|
|
230244
|
-
}
|
|
230245
|
-
return path22.resolve(currentDirectory, relativeBinary);
|
|
230246
|
-
}
|
|
230247
|
-
}
|
|
230248
|
-
const parent = path22.dirname(currentDirectory);
|
|
230249
|
-
if (parent === currentDirectory) break;
|
|
230250
|
-
currentDirectory = parent;
|
|
230251
|
-
}
|
|
230252
|
-
throw new Error(
|
|
230253
|
-
`Unable to locate local package binary for "${packageName}".`
|
|
230254
|
-
);
|
|
230255
|
-
}
|
|
230256
|
-
function isValidPackageName(packageName) {
|
|
230257
|
-
if (packageName.length === 0 || packageName.length > 214) return false;
|
|
230258
|
-
return /^(?:@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*$/.test(
|
|
230259
|
-
packageName
|
|
230260
|
-
);
|
|
230261
|
-
}
|
|
230262
|
-
var ReviewVerdictSchema = z73.object({
|
|
230263
|
-
verdict: z73.enum(["approved", "rejected"]),
|
|
230264
|
-
feedback: z73.string().default("")
|
|
230224
|
+
var ReviewVerdictSchema = z83.object({
|
|
230225
|
+
verdict: z83.enum(["approved", "rejected"]),
|
|
230226
|
+
feedback: z83.string().default("")
|
|
230265
230227
|
});
|
|
230266
230228
|
var Orchestrator = class {
|
|
230267
230229
|
constructor(cwd, config, provider, task, interaction) {
|
|
@@ -230560,9 +230522,9 @@ Your final response must be one JSON object with this exact shape:
|
|
|
230560
230522
|
}
|
|
230561
230523
|
persistPlan(plan) {
|
|
230562
230524
|
try {
|
|
230563
|
-
const planPath =
|
|
230564
|
-
|
|
230565
|
-
|
|
230525
|
+
const planPath = path42.join(this.cwd, ".orbit", "task.md");
|
|
230526
|
+
fs4.mkdirSync(path42.dirname(planPath), { recursive: true });
|
|
230527
|
+
fs4.writeFileSync(planPath, plan, "utf8");
|
|
230566
230528
|
this.interaction.showText(" \u2714 Plan saved to .orbit/task.md");
|
|
230567
230529
|
} catch (error) {
|
|
230568
230530
|
this.interaction.showText(
|
|
@@ -230601,48 +230563,48 @@ function errorMessage(error) {
|
|
|
230601
230563
|
const raw = error instanceof Error ? error.message : String(error);
|
|
230602
230564
|
return redactSecrets(raw).replace(/[\u0000-\u001f\u007f-\u009f]/g, " ").replace(/\s+/g, " ").trim().slice(0, 2e3);
|
|
230603
230565
|
}
|
|
230604
|
-
var AcceptanceVerificationSchema =
|
|
230605
|
-
name:
|
|
230606
|
-
command:
|
|
230607
|
-
timeoutMs:
|
|
230566
|
+
var AcceptanceVerificationSchema = z93.object({
|
|
230567
|
+
name: z93.string().trim().min(1).max(120),
|
|
230568
|
+
command: z93.string().trim().min(1).max(4e3),
|
|
230569
|
+
timeoutMs: z93.number().int().min(1e3).max(30 * 6e4).default(12e4)
|
|
230608
230570
|
});
|
|
230609
|
-
var AcceptanceTaskSchema =
|
|
230610
|
-
id:
|
|
230611
|
-
prompt:
|
|
230612
|
-
mode:
|
|
230613
|
-
provider:
|
|
230614
|
-
model:
|
|
230615
|
-
verification:
|
|
230616
|
-
requiredChangedFiles:
|
|
230617
|
-
forbiddenChangedFiles:
|
|
230618
|
-
maxChangedFiles:
|
|
230571
|
+
var AcceptanceTaskSchema = z93.object({
|
|
230572
|
+
id: z93.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/),
|
|
230573
|
+
prompt: z93.string().trim().min(1).max(2e4),
|
|
230574
|
+
mode: z93.enum(["single", "multi"]).default("single"),
|
|
230575
|
+
provider: z93.string().trim().min(1).optional(),
|
|
230576
|
+
model: z93.string().trim().min(1).optional(),
|
|
230577
|
+
verification: z93.array(AcceptanceVerificationSchema).max(20).default([]),
|
|
230578
|
+
requiredChangedFiles: z93.array(z93.string().trim().min(1)).max(100).default([]),
|
|
230579
|
+
forbiddenChangedFiles: z93.array(z93.string().trim().min(1)).max(100).default([]),
|
|
230580
|
+
maxChangedFiles: z93.number().int().min(0).max(1e4).optional()
|
|
230619
230581
|
});
|
|
230620
|
-
var AcceptanceSuiteSchema =
|
|
230621
|
-
schemaVersion:
|
|
230622
|
-
name:
|
|
230623
|
-
description:
|
|
230624
|
-
tasks:
|
|
230582
|
+
var AcceptanceSuiteSchema = z93.object({
|
|
230583
|
+
schemaVersion: z93.literal(1),
|
|
230584
|
+
name: z93.string().trim().min(1).max(200),
|
|
230585
|
+
description: z93.string().trim().max(2e3).optional(),
|
|
230586
|
+
tasks: z93.array(AcceptanceTaskSchema).min(1).max(100)
|
|
230625
230587
|
});
|
|
230626
|
-
var AcceptanceCheckResultSchema =
|
|
230627
|
-
name:
|
|
230628
|
-
passed:
|
|
230629
|
-
durationMs:
|
|
230630
|
-
exitCode:
|
|
230631
|
-
summary:
|
|
230588
|
+
var AcceptanceCheckResultSchema = z93.object({
|
|
230589
|
+
name: z93.string(),
|
|
230590
|
+
passed: z93.boolean(),
|
|
230591
|
+
durationMs: z93.number().int().nonnegative(),
|
|
230592
|
+
exitCode: z93.number().int().optional(),
|
|
230593
|
+
summary: z93.string().max(4e3)
|
|
230632
230594
|
});
|
|
230633
|
-
var AcceptanceTaskResultSchema =
|
|
230634
|
-
taskId:
|
|
230635
|
-
sessionId:
|
|
230636
|
-
traceFile:
|
|
230637
|
-
passed:
|
|
230638
|
-
agentStatus:
|
|
230639
|
-
durationMs:
|
|
230640
|
-
requestedProvider:
|
|
230641
|
-
requestedModel:
|
|
230642
|
-
resolvedModels:
|
|
230643
|
-
changedFiles:
|
|
230644
|
-
checks:
|
|
230645
|
-
failureReasons:
|
|
230595
|
+
var AcceptanceTaskResultSchema = z93.object({
|
|
230596
|
+
taskId: z93.string(),
|
|
230597
|
+
sessionId: z93.string().optional(),
|
|
230598
|
+
traceFile: z93.string().optional(),
|
|
230599
|
+
passed: z93.boolean(),
|
|
230600
|
+
agentStatus: z93.enum(["completed", "failed", "aborted"]),
|
|
230601
|
+
durationMs: z93.number().int().nonnegative(),
|
|
230602
|
+
requestedProvider: z93.string().optional(),
|
|
230603
|
+
requestedModel: z93.string().optional(),
|
|
230604
|
+
resolvedModels: z93.array(z93.string()).default([]),
|
|
230605
|
+
changedFiles: z93.array(z93.string()),
|
|
230606
|
+
checks: z93.array(AcceptanceCheckResultSchema),
|
|
230607
|
+
failureReasons: z93.array(z93.string())
|
|
230646
230608
|
});
|
|
230647
230609
|
function scoreAcceptanceTask(input) {
|
|
230648
230610
|
const task = AcceptanceTaskSchema.parse(input.task);
|
|
@@ -246276,9 +246238,9 @@ function launchOrbitProject(request, options = {}) {
|
|
|
246276
246238
|
}
|
|
246277
246239
|
|
|
246278
246240
|
// src/runtime/ProjectFolderPicker.ts
|
|
246279
|
-
import { execFile as
|
|
246280
|
-
import { promisify as
|
|
246281
|
-
var execFileAsync =
|
|
246241
|
+
import { execFile as execFile4 } from "child_process";
|
|
246242
|
+
import { promisify as promisify4 } from "util";
|
|
246243
|
+
var execFileAsync = promisify4(execFile4);
|
|
246282
246244
|
async function selectOrbitProjectFolder(options = {}) {
|
|
246283
246245
|
const platform = options.platform ?? process.platform;
|
|
246284
246246
|
const run = options.run ?? (async (executable, args) => execFileAsync(executable, args, {
|
|
@@ -249153,11 +249115,11 @@ import {
|
|
|
249153
249115
|
writeFileSync as writeFileSync14
|
|
249154
249116
|
} from "fs";
|
|
249155
249117
|
import { basename as basename6, dirname as dirname11, join as join19 } from "path";
|
|
249156
|
-
import { promisify as
|
|
249118
|
+
import { promisify as promisify5 } from "util";
|
|
249157
249119
|
import picocolors21 from "picocolors";
|
|
249158
249120
|
import { parse as parseYaml } from "yaml";
|
|
249159
249121
|
import { z as z47 } from "zod";
|
|
249160
|
-
var exec4 =
|
|
249122
|
+
var exec4 = promisify5(execCallback);
|
|
249161
249123
|
var MAX_SUITE_BYTES = 1024 * 1024;
|
|
249162
249124
|
var MAX_VERIFICATION_OUTPUT = 4e3;
|
|
249163
249125
|
var EvalOptionsSchema = z47.object({
|