@orbit-build/cli 0.5.6 → 0.5.8
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 +5 -0
- package/commands/cumcm-draft.md +11 -0
- package/commands/math-draft.md +4 -8
- package/dist/index.js +385 -242
- package/package.json +1 -1
- package/skills/{math-model-draft → cumcm-draft}/SKILL.md +124 -27
- package/skills/cumcm-draft/agents/openai.yaml +6 -0
- package/skills/{math-model-draft → cumcm-draft}/assets/project-template/code/always/config.py +1 -0
- package/skills/{math-model-draft → cumcm-draft}/assets/project-template/code/always/data.py +1 -0
- package/skills/{math-model-draft → cumcm-draft}/assets/project-template/code/always/plotting.py +1 -0
- package/skills/{math-model-draft → cumcm-draft}/assets/project-template/code/always/validation.py +1 -0
- package/skills/{math-model-draft → cumcm-draft}/assets/project-template/code/finalize.py +9 -3
- package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/AI/345/267/245/345/205/267/344/275/277/347/224/250/350/257/246/346/203/205.tex +12 -3
- package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/contest-profile.json +7 -4
- package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/main.tex +28 -0
- package/skills/cumcm-draft/assets/project-template/paper/sections/ai-disclosure.tex +3 -0
- package/skills/cumcm-draft/assets/project-template/paper/sections/appendix.tex +3 -0
- package/skills/cumcm-draft/assets/project-template/paper/sections/references.tex +12 -0
- package/skills/{math-model-draft → cumcm-draft}/references/code-and-output-style.md +37 -6
- package/skills/cumcm-draft/references/cumcm-compliance.md +64 -0
- package/skills/{math-model-draft → cumcm-draft}/references/latex-figures-tables.md +5 -0
- package/skills/cumcm-draft/references/modeling-quality.md +161 -0
- package/skills/{math-model-draft → cumcm-draft}/references/paper-architecture.md +51 -5
- package/skills/cumcm-draft/references/project-architecture.md +124 -0
- package/skills/{math-model-draft → cumcm-draft}/scripts/audit_paper.py +40 -0
- package/skills/{math-model-draft → cumcm-draft}/scripts/bootstrap_project.py +44 -42
- package/skills/{math-model-draft → cumcm-draft}/scripts/build_paper.py +76 -5
- package/skills/{math-model-draft → cumcm-draft}/scripts/clean_project.py +7 -1
- package/skills/{math-model-draft → cumcm-draft}/scripts/package_support.py +8 -1
- package/skills/{math-model-draft → cumcm-draft}/scripts/project_utils.py +12 -9
- package/skills/{math-model-draft → cumcm-draft}/scripts/validate_project.py +191 -6
- package/skills/mcm-draft/SKILL.md +11 -0
- package/skills/mcm-draft/agents/openai.yaml +6 -0
- package/skills/math-model-draft/agents/openai.yaml +0 -6
- package/skills/math-model-draft/assets/project-template/paper/sections/ai-disclosure.tex +0 -3
- package/skills/math-model-draft/assets/project-template/paper/sections/appendix.tex +0 -9
- package/skills/math-model-draft/assets/project-template/paper/sections/references.tex +0 -6
- package/skills/math-model-draft/references/cumcm-compliance.md +0 -56
- package/skills/math-model-draft/references/modeling-quality.md +0 -91
- package/skills/math-model-draft/references/project-architecture.md +0 -65
- /package/skills/{math-model-draft → cumcm-draft}/assets/project-template/code/always/__init__.py +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/assets/project-template/code/requirements.txt +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/ai-use-log.md +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/sections/abstract.tex +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/sections/assumptions.tex +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/sections/data.tex +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/sections/evaluation.tex +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/sections/problem-analysis.tex +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/sections/problem-restatement.tex +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/sections/source-code.tex +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/assets/project-template/paper/sections/support-files.tex +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/references/paper-revision.md +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/scripts/capture_environment.py +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/scripts/evidence_freeze.py +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/scripts/finalize_project.py +0 -0
- /package/skills/{math-model-draft → cumcm-draft}/scripts/inspect_inputs.py +0 -0
package/dist/index.js
CHANGED
|
@@ -28598,7 +28598,7 @@ ${lanes.join("\n")}
|
|
|
28598
28598
|
return process.memoryUsage().heapUsed;
|
|
28599
28599
|
},
|
|
28600
28600
|
getFileSize(path9) {
|
|
28601
|
-
const stat =
|
|
28601
|
+
const stat = statSync7(path9);
|
|
28602
28602
|
if (stat == null ? void 0 : stat.isFile()) {
|
|
28603
28603
|
return stat.size;
|
|
28604
28604
|
}
|
|
@@ -28642,7 +28642,7 @@ ${lanes.join("\n")}
|
|
|
28642
28642
|
}
|
|
28643
28643
|
};
|
|
28644
28644
|
return nodeSystem;
|
|
28645
|
-
function
|
|
28645
|
+
function statSync7(path9) {
|
|
28646
28646
|
try {
|
|
28647
28647
|
return _fs.statSync(path9, statSyncOptions);
|
|
28648
28648
|
} catch {
|
|
@@ -28701,7 +28701,7 @@ ${lanes.join("\n")}
|
|
|
28701
28701
|
activeSession.post("Profiler.stop", (err, { profile }) => {
|
|
28702
28702
|
var _a;
|
|
28703
28703
|
if (!err) {
|
|
28704
|
-
if ((_a =
|
|
28704
|
+
if ((_a = statSync7(profilePath)) == null ? void 0 : _a.isDirectory()) {
|
|
28705
28705
|
profilePath = _path.join(profilePath, `${(/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-")}+P${process.pid}.cpuprofile`);
|
|
28706
28706
|
}
|
|
28707
28707
|
try {
|
|
@@ -28821,7 +28821,7 @@ ${lanes.join("\n")}
|
|
|
28821
28821
|
let stat;
|
|
28822
28822
|
if (typeof dirent === "string" || dirent.isSymbolicLink()) {
|
|
28823
28823
|
const name = combinePaths(path9, entry);
|
|
28824
|
-
stat =
|
|
28824
|
+
stat = statSync7(name);
|
|
28825
28825
|
if (!stat) {
|
|
28826
28826
|
continue;
|
|
28827
28827
|
}
|
|
@@ -28845,7 +28845,7 @@ ${lanes.join("\n")}
|
|
|
28845
28845
|
return matchFiles(path9, extensions, excludes, includes, useCaseSensitiveFileNames2, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
|
|
28846
28846
|
}
|
|
28847
28847
|
function fileSystemEntryExists(path9, entryKind) {
|
|
28848
|
-
const stat =
|
|
28848
|
+
const stat = statSync7(path9);
|
|
28849
28849
|
if (!stat) {
|
|
28850
28850
|
return false;
|
|
28851
28851
|
}
|
|
@@ -28887,7 +28887,7 @@ ${lanes.join("\n")}
|
|
|
28887
28887
|
}
|
|
28888
28888
|
function getModifiedTime3(path9) {
|
|
28889
28889
|
var _a;
|
|
28890
|
-
return (_a =
|
|
28890
|
+
return (_a = statSync7(path9)) == null ? void 0 : _a.mtime;
|
|
28891
28891
|
}
|
|
28892
28892
|
function setModifiedTime(path9, time) {
|
|
28893
28893
|
try {
|
|
@@ -253391,7 +253391,7 @@ var ContextPackBuilder = class {
|
|
|
253391
253391
|
};
|
|
253392
253392
|
|
|
253393
253393
|
// ../core/dist/index.js
|
|
253394
|
-
import { randomUUID as
|
|
253394
|
+
import { randomUUID as randomUUID7 } from "crypto";
|
|
253395
253395
|
import { EventEmitter } from "events";
|
|
253396
253396
|
import { z as z38 } from "zod";
|
|
253397
253397
|
import { z as z83 } from "zod";
|
|
@@ -255911,12 +255911,19 @@ import { createCipheriv, createDecipheriv, randomBytes as randomBytes2 } from "c
|
|
|
255911
255911
|
import { z as z28 } from "zod";
|
|
255912
255912
|
import { randomBytes as randomBytes22 } from "crypto";
|
|
255913
255913
|
import {
|
|
255914
|
+
closeSync as closeSync3,
|
|
255914
255915
|
existsSync as existsSync25,
|
|
255916
|
+
fsyncSync as fsyncSync3,
|
|
255915
255917
|
lstatSync as lstatSync22,
|
|
255916
255918
|
mkdirSync as mkdirSync22,
|
|
255919
|
+
openSync as openSync3,
|
|
255920
|
+
renameSync as renameSync22,
|
|
255921
|
+
rmSync as rmSync22,
|
|
255922
|
+
statSync,
|
|
255917
255923
|
unlinkSync as unlinkSync3,
|
|
255918
255924
|
writeFileSync as writeFileSync6
|
|
255919
255925
|
} from "fs";
|
|
255926
|
+
import { randomUUID as randomUUID5 } from "crypto";
|
|
255920
255927
|
import { dirname as dirname7 } from "path";
|
|
255921
255928
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
255922
255929
|
import fs4 from "fs";
|
|
@@ -256281,7 +256288,43 @@ var RollbackManager = class {
|
|
|
256281
256288
|
}
|
|
256282
256289
|
mkdirSync22(dirname7(safePath), { recursive: true });
|
|
256283
256290
|
safePath = resolveSafePath(this.cwd, path24);
|
|
256284
|
-
|
|
256291
|
+
this.replaceFileAtomically(safePath, content);
|
|
256292
|
+
}
|
|
256293
|
+
/**
|
|
256294
|
+
* Publish each restored file with a same-directory atomic rename. A crash
|
|
256295
|
+
* while the temporary file is being written therefore leaves the original
|
|
256296
|
+
* target intact instead of exposing a truncated source file.
|
|
256297
|
+
*/
|
|
256298
|
+
replaceFileAtomically(path24, content) {
|
|
256299
|
+
const temporaryPath = `${path24}.orbit-rollback-${process.pid}-${randomUUID5()}.tmp`;
|
|
256300
|
+
const existingMode = existsSync25(path24) ? statSync(path24).mode : void 0;
|
|
256301
|
+
let descriptor;
|
|
256302
|
+
try {
|
|
256303
|
+
descriptor = openSync3(
|
|
256304
|
+
temporaryPath,
|
|
256305
|
+
"wx",
|
|
256306
|
+
existingMode === void 0 ? 438 : existingMode
|
|
256307
|
+
);
|
|
256308
|
+
writeFileSync6(descriptor, content);
|
|
256309
|
+
fsyncSync3(descriptor);
|
|
256310
|
+
closeSync3(descriptor);
|
|
256311
|
+
descriptor = void 0;
|
|
256312
|
+
renameSync22(temporaryPath, path24);
|
|
256313
|
+
this.fsyncParentDirectory(dirname7(path24));
|
|
256314
|
+
} finally {
|
|
256315
|
+
if (descriptor !== void 0) closeSync3(descriptor);
|
|
256316
|
+
rmSync22(temporaryPath, { force: true });
|
|
256317
|
+
}
|
|
256318
|
+
}
|
|
256319
|
+
fsyncParentDirectory(directory) {
|
|
256320
|
+
let descriptor;
|
|
256321
|
+
try {
|
|
256322
|
+
descriptor = openSync3(directory, "r");
|
|
256323
|
+
fsyncSync3(descriptor);
|
|
256324
|
+
} catch {
|
|
256325
|
+
} finally {
|
|
256326
|
+
if (descriptor !== void 0) closeSync3(descriptor);
|
|
256327
|
+
}
|
|
256285
256328
|
}
|
|
256286
256329
|
};
|
|
256287
256330
|
function isFileSystemError2(error, code) {
|
|
@@ -256561,16 +256604,16 @@ function toErrorMessage2(error) {
|
|
|
256561
256604
|
|
|
256562
256605
|
// ../session/dist/index.js
|
|
256563
256606
|
import { z as z29 } from "zod";
|
|
256564
|
-
import { createHash as createHash5, randomUUID as
|
|
256607
|
+
import { createHash as createHash5, randomUUID as randomUUID6 } from "crypto";
|
|
256565
256608
|
import { dirname as dirname8, isAbsolute as isAbsolute4, join as join9, relative as relative4, resolve as resolve7, sep } from "path";
|
|
256566
256609
|
import {
|
|
256567
256610
|
appendFileSync,
|
|
256568
|
-
closeSync as
|
|
256611
|
+
closeSync as closeSync4,
|
|
256569
256612
|
existsSync as existsSync10,
|
|
256570
|
-
fsyncSync as
|
|
256613
|
+
fsyncSync as fsyncSync4,
|
|
256571
256614
|
lstatSync as lstatSync5,
|
|
256572
256615
|
mkdirSync as mkdirSync5,
|
|
256573
|
-
openSync as
|
|
256616
|
+
openSync as openSync4,
|
|
256574
256617
|
readdirSync as readdirSync3,
|
|
256575
256618
|
renameSync as renameSync5,
|
|
256576
256619
|
rmSync as rmSync4,
|
|
@@ -256582,7 +256625,7 @@ import {
|
|
|
256582
256625
|
lstatSync as lstatSync23,
|
|
256583
256626
|
openSync as openSync22,
|
|
256584
256627
|
realpathSync as realpathSync2,
|
|
256585
|
-
statSync,
|
|
256628
|
+
statSync as statSync2,
|
|
256586
256629
|
unlinkSync as unlinkSync4
|
|
256587
256630
|
} from "fs";
|
|
256588
256631
|
import { homedir as homedir5 } from "os";
|
|
@@ -256932,13 +256975,13 @@ function writeJsonAtomically(filePath, value, schema) {
|
|
|
256932
256975
|
if (serialized === void 0) {
|
|
256933
256976
|
throw new Error(`Unable to serialize JSON for ${filePath}.`);
|
|
256934
256977
|
}
|
|
256935
|
-
const temporaryPath = `${filePath}.${process.pid}.${
|
|
256978
|
+
const temporaryPath = `${filePath}.${process.pid}.${randomUUID6()}.tmp`;
|
|
256936
256979
|
let temporaryFd;
|
|
256937
256980
|
try {
|
|
256938
|
-
temporaryFd =
|
|
256981
|
+
temporaryFd = openSync4(temporaryPath, "wx", PRIVATE_FILE_MODE2);
|
|
256939
256982
|
writeFileSync7(temporaryFd, serialized, { encoding: "utf8" });
|
|
256940
|
-
|
|
256941
|
-
|
|
256983
|
+
fsyncSync4(temporaryFd);
|
|
256984
|
+
closeSync4(temporaryFd);
|
|
256942
256985
|
temporaryFd = void 0;
|
|
256943
256986
|
preserveLastKnownGoodFile(filePath, schema);
|
|
256944
256987
|
replaceFileAtomically(temporaryPath, filePath);
|
|
@@ -256946,7 +256989,7 @@ function writeJsonAtomically(filePath, value, schema) {
|
|
|
256946
256989
|
} finally {
|
|
256947
256990
|
if (temporaryFd !== void 0) {
|
|
256948
256991
|
try {
|
|
256949
|
-
|
|
256992
|
+
closeSync4(temporaryFd);
|
|
256950
256993
|
} catch {
|
|
256951
256994
|
}
|
|
256952
256995
|
}
|
|
@@ -256960,13 +257003,13 @@ function syncParentDirectory(filePath) {
|
|
|
256960
257003
|
if (process.platform === "win32") return;
|
|
256961
257004
|
let directoryFd;
|
|
256962
257005
|
try {
|
|
256963
|
-
directoryFd =
|
|
256964
|
-
|
|
257006
|
+
directoryFd = openSync4(dirname8(filePath), "r");
|
|
257007
|
+
fsyncSync4(directoryFd);
|
|
256965
257008
|
} catch {
|
|
256966
257009
|
} finally {
|
|
256967
257010
|
if (directoryFd !== void 0) {
|
|
256968
257011
|
try {
|
|
256969
|
-
|
|
257012
|
+
closeSync4(directoryFd);
|
|
256970
257013
|
} catch {
|
|
256971
257014
|
}
|
|
256972
257015
|
}
|
|
@@ -256976,19 +257019,19 @@ function preserveLastKnownGoodFile(filePath, schema) {
|
|
|
256976
257019
|
const previous = readValidatedSnapshot(filePath, schema);
|
|
256977
257020
|
if (previous === void 0) return;
|
|
256978
257021
|
const backupPath = `${filePath}.bak`;
|
|
256979
|
-
const temporaryBackupPath = `${backupPath}.${process.pid}.${
|
|
257022
|
+
const temporaryBackupPath = `${backupPath}.${process.pid}.${randomUUID6()}.tmp`;
|
|
256980
257023
|
let descriptor;
|
|
256981
257024
|
try {
|
|
256982
|
-
descriptor =
|
|
257025
|
+
descriptor = openSync4(temporaryBackupPath, "wx", PRIVATE_FILE_MODE2);
|
|
256983
257026
|
writeFileSync7(descriptor, JSON.stringify(previous, null, 2), "utf8");
|
|
256984
|
-
|
|
256985
|
-
|
|
257027
|
+
fsyncSync4(descriptor);
|
|
257028
|
+
closeSync4(descriptor);
|
|
256986
257029
|
descriptor = void 0;
|
|
256987
257030
|
replaceFileAtomically(temporaryBackupPath, backupPath);
|
|
256988
257031
|
} finally {
|
|
256989
257032
|
if (descriptor !== void 0) {
|
|
256990
257033
|
try {
|
|
256991
|
-
|
|
257034
|
+
closeSync4(descriptor);
|
|
256992
257035
|
} catch {
|
|
256993
257036
|
}
|
|
256994
257037
|
}
|
|
@@ -257006,7 +257049,7 @@ function replaceFileAtomically(temporaryPath, destinationPath) {
|
|
|
257006
257049
|
const code = typeof error === "object" && error !== null && "code" in error && typeof error.code === "string" ? error.code : "";
|
|
257007
257050
|
if (!["EPERM", "EEXIST", "ENOTEMPTY"].includes(code)) throw error;
|
|
257008
257051
|
}
|
|
257009
|
-
const backupPath = `${destinationPath}.${process.pid}.${
|
|
257052
|
+
const backupPath = `${destinationPath}.${process.pid}.${randomUUID6()}.bak`;
|
|
257010
257053
|
let previousMoved = false;
|
|
257011
257054
|
try {
|
|
257012
257055
|
if (existsSync10(destinationPath)) {
|
|
@@ -258138,7 +258181,7 @@ function projectIdentity(projectPath) {
|
|
|
258138
258181
|
}
|
|
258139
258182
|
function isDirectory(targetPath) {
|
|
258140
258183
|
try {
|
|
258141
|
-
return
|
|
258184
|
+
return statSync2(targetPath).isDirectory();
|
|
258142
258185
|
} catch {
|
|
258143
258186
|
return false;
|
|
258144
258187
|
}
|
|
@@ -258646,7 +258689,7 @@ import { z as z73 } from "zod";
|
|
|
258646
258689
|
import { z as z103 } from "zod";
|
|
258647
258690
|
import { z as z93 } from "zod";
|
|
258648
258691
|
import path8 from "path";
|
|
258649
|
-
import { existsSync as existsSync34, statSync as
|
|
258692
|
+
import { existsSync as existsSync34, statSync as statSync3 } from "fs";
|
|
258650
258693
|
import { z as z112 } from "zod";
|
|
258651
258694
|
import { z as z122 } from "zod";
|
|
258652
258695
|
function createInitialState(sessionId, task, maxAttempts = 8) {
|
|
@@ -259995,7 +260038,7 @@ var AgentInputQueueController = class {
|
|
|
259995
260038
|
sessions;
|
|
259996
260039
|
enqueue(text2, options) {
|
|
259997
260040
|
const queued = this.sessions.enqueueAgentInput({
|
|
259998
|
-
id: `input_${
|
|
260041
|
+
id: `input_${randomUUID7().replace(/-/g, "")}`,
|
|
259999
260042
|
mode: options.mode,
|
|
260000
260043
|
source: options.source,
|
|
260001
260044
|
text: text2.trim(),
|
|
@@ -261436,15 +261479,81 @@ function workspaceUserId(cwd) {
|
|
|
261436
261479
|
process.platform === "win32" ? workspaceIdentity.toLowerCase() : workspaceIdentity
|
|
261437
261480
|
).digest("hex");
|
|
261438
261481
|
}
|
|
261482
|
+
var NETWORK_RESULT_LIMIT = 10;
|
|
261483
|
+
var NETWORK_SUMMARY_CHARS = 280;
|
|
261484
|
+
var NETWORK_RESULT_CHARS = 6e3;
|
|
261485
|
+
var TOOL_RESULT_MAX_CHARS = 24e3;
|
|
261486
|
+
var TOOL_STATUS_MAX_CHARS = 2e3;
|
|
261487
|
+
function buildToolResultContent(toolName, result) {
|
|
261488
|
+
const content = result.ok ? serializeToolResultData(result.data, result.display) : result.error || "Unknown error";
|
|
261489
|
+
const redacted = redactSecrets(content);
|
|
261490
|
+
if (!result.ok || toolName !== "web_search") {
|
|
261491
|
+
return truncateToolText(
|
|
261492
|
+
redacted,
|
|
261493
|
+
result.ok ? TOOL_RESULT_MAX_CHARS : TOOL_STATUS_MAX_CHARS
|
|
261494
|
+
);
|
|
261495
|
+
}
|
|
261496
|
+
return compactSearchResult(redacted, redactSecrets(result.display || ""));
|
|
261497
|
+
}
|
|
261498
|
+
function truncateToolText(text2, maxChars) {
|
|
261499
|
+
if (text2.length <= maxChars) return text2;
|
|
261500
|
+
const suffix = "\n... [truncated for context budget]";
|
|
261501
|
+
return `${text2.slice(0, Math.max(0, maxChars - suffix.length)).trimEnd()}${suffix}`;
|
|
261502
|
+
}
|
|
261503
|
+
function serializeToolResultData(data, display) {
|
|
261504
|
+
if (typeof data === "string") return data;
|
|
261505
|
+
if (data === void 0) return display?.trim() || "Done";
|
|
261506
|
+
try {
|
|
261507
|
+
return JSON.stringify(data) ?? String(data);
|
|
261508
|
+
} catch {
|
|
261509
|
+
return String(data);
|
|
261510
|
+
}
|
|
261511
|
+
}
|
|
261512
|
+
function compactSearchResult(content, display) {
|
|
261513
|
+
const normalized = content.replace(/\r\n/g, "\n").trim();
|
|
261514
|
+
const header = display ? `web_search result: ${display}` : "web_search result";
|
|
261515
|
+
if (!normalized) return header;
|
|
261516
|
+
if (normalized.startsWith("Source: Open-Meteo weather API")) {
|
|
261517
|
+
return truncateToolText(`${header}
|
|
261518
|
+
${normalized}`, NETWORK_RESULT_CHARS);
|
|
261519
|
+
}
|
|
261520
|
+
const parsedResults = parseSearchResultBlocks(normalized);
|
|
261521
|
+
if (parsedResults.length === 0) {
|
|
261522
|
+
return truncateToolText(`${header}
|
|
261523
|
+
${normalized}`, NETWORK_RESULT_CHARS);
|
|
261524
|
+
}
|
|
261525
|
+
const keep = parsedResults.slice(0, NETWORK_RESULT_LIMIT);
|
|
261526
|
+
const lines = [
|
|
261527
|
+
header,
|
|
261528
|
+
`Results kept for reasoning: ${keep.length}/${parsedResults.length}. Use another live lookup only if these results are insufficient or stale.`
|
|
261529
|
+
];
|
|
261530
|
+
for (const result of keep) {
|
|
261531
|
+
lines.push(
|
|
261532
|
+
`[${result.index}] ${result.title}`,
|
|
261533
|
+
`Link: ${result.link}`,
|
|
261534
|
+
`Summary: ${truncateToolText(result.summary, NETWORK_SUMMARY_CHARS)}`
|
|
261535
|
+
);
|
|
261536
|
+
}
|
|
261537
|
+
return truncateToolText(lines.join("\n"), NETWORK_RESULT_CHARS);
|
|
261538
|
+
}
|
|
261539
|
+
function parseSearchResultBlocks(content) {
|
|
261540
|
+
const results = [];
|
|
261541
|
+
const regex = /\[(\d+)\]\s+Title:\s*([\s\S]*?)\n\s*Link:\s*([^\n]+)\n\s*Summary:\s*([\s\S]*?)(?=\n\n\[\d+\]\s+Title:|\s*$)/g;
|
|
261542
|
+
let match;
|
|
261543
|
+
while ((match = regex.exec(content)) !== null) {
|
|
261544
|
+
results.push({
|
|
261545
|
+
index: match[1],
|
|
261546
|
+
title: truncateToolText(match[2], 180),
|
|
261547
|
+
link: match[3].trim(),
|
|
261548
|
+
summary: match[4].replace(/\s+/g, " ").trim()
|
|
261549
|
+
});
|
|
261550
|
+
}
|
|
261551
|
+
return results;
|
|
261552
|
+
}
|
|
261439
261553
|
var execPromise2 = promisify3(exec2);
|
|
261440
261554
|
var execFilePromise3 = promisify3(execFile3);
|
|
261441
261555
|
var DEEPSEEK_CACHE_DEGRADED_HIT_RATE = 0.85;
|
|
261442
261556
|
var DEEPSEEK_VERBOSE_CACHE_ENV = "ORBIT_DEEPSEEK_VERBOSE_CACHE";
|
|
261443
|
-
var NETWORK_TOOL_RESULT_MAX_RESULTS = 10;
|
|
261444
|
-
var NETWORK_TOOL_RESULT_SUMMARY_CHARS = 280;
|
|
261445
|
-
var NETWORK_TOOL_RESULT_MAX_CHARS = 6e3;
|
|
261446
|
-
var TOOL_RESULT_MAX_CHARS = 24e3;
|
|
261447
|
-
var TOOL_STATUS_MAX_CHARS = 2e3;
|
|
261448
261557
|
var AGENT_LOOP_ERROR_MESSAGE_MAX_CHARS = 2e3;
|
|
261449
261558
|
var AGENT_EDIT_FILE_MAX_BYTES = 16 * 1024 * 1024;
|
|
261450
261559
|
var AgentLoopExecutionError = class extends Error {
|
|
@@ -261754,75 +261863,6 @@ var AgentLoop = class _AgentLoop {
|
|
|
261754
261863
|
}
|
|
261755
261864
|
return null;
|
|
261756
261865
|
}
|
|
261757
|
-
buildToolResultContent(toolName, result) {
|
|
261758
|
-
const content = result.ok ? this.serializeToolResultData(result.data, result.display) : result.error || "Unknown error";
|
|
261759
|
-
if (!result.ok || toolName !== "web_search") {
|
|
261760
|
-
return this.truncatePlain(
|
|
261761
|
-
redactSecrets(content),
|
|
261762
|
-
result.ok ? TOOL_RESULT_MAX_CHARS : TOOL_STATUS_MAX_CHARS
|
|
261763
|
-
);
|
|
261764
|
-
}
|
|
261765
|
-
return this.compactNetworkToolResult(
|
|
261766
|
-
toolName,
|
|
261767
|
-
redactSecrets(content),
|
|
261768
|
-
redactSecrets(result.display || "")
|
|
261769
|
-
);
|
|
261770
|
-
}
|
|
261771
|
-
serializeToolResultData(data, display) {
|
|
261772
|
-
if (typeof data === "string") return data;
|
|
261773
|
-
if (data === void 0) return display?.trim() || "Done";
|
|
261774
|
-
try {
|
|
261775
|
-
return JSON.stringify(data) ?? String(data);
|
|
261776
|
-
} catch {
|
|
261777
|
-
return String(data);
|
|
261778
|
-
}
|
|
261779
|
-
}
|
|
261780
|
-
compactNetworkToolResult(toolName, content, display) {
|
|
261781
|
-
const normalized = content.replace(/\r\n/g, "\n").trim();
|
|
261782
|
-
const header = display ? `${toolName} result: ${display}` : `${toolName} result`;
|
|
261783
|
-
if (!normalized) {
|
|
261784
|
-
return header;
|
|
261785
|
-
}
|
|
261786
|
-
if (normalized.startsWith("Source: Open-Meteo weather API")) {
|
|
261787
|
-
return this.truncateToolResultText(`${header}
|
|
261788
|
-
${normalized}`);
|
|
261789
|
-
}
|
|
261790
|
-
const parsedResults = this.parseSearchResultBlocks(normalized);
|
|
261791
|
-
if (parsedResults.length === 0) {
|
|
261792
|
-
return this.truncateToolResultText(`${header}
|
|
261793
|
-
${normalized}`);
|
|
261794
|
-
}
|
|
261795
|
-
const keep = parsedResults.slice(0, NETWORK_TOOL_RESULT_MAX_RESULTS);
|
|
261796
|
-
const lines = [
|
|
261797
|
-
`${header}`,
|
|
261798
|
-
`Results kept for reasoning: ${keep.length}/${parsedResults.length}. Use another live lookup only if these results are insufficient or stale.`
|
|
261799
|
-
];
|
|
261800
|
-
for (const result of keep) {
|
|
261801
|
-
lines.push(
|
|
261802
|
-
`[${result.index}] ${result.title}`,
|
|
261803
|
-
`Link: ${result.link}`,
|
|
261804
|
-
`Summary: ${this.truncatePlain(result.summary, NETWORK_TOOL_RESULT_SUMMARY_CHARS)}`
|
|
261805
|
-
);
|
|
261806
|
-
}
|
|
261807
|
-
return this.truncateToolResultText(lines.join("\n"));
|
|
261808
|
-
}
|
|
261809
|
-
parseSearchResultBlocks(content) {
|
|
261810
|
-
const results = [];
|
|
261811
|
-
const regex = /\[(\d+)\]\s+Title:\s*([\s\S]*?)\n\s*Link:\s*([^\n]+)\n\s*Summary:\s*([\s\S]*?)(?=\n\n\[\d+\]\s+Title:|\s*$)/g;
|
|
261812
|
-
let match;
|
|
261813
|
-
while ((match = regex.exec(content)) !== null) {
|
|
261814
|
-
results.push({
|
|
261815
|
-
index: match[1],
|
|
261816
|
-
title: this.truncatePlain(match[2], 180),
|
|
261817
|
-
link: match[3].trim(),
|
|
261818
|
-
summary: match[4].replace(/\s+/g, " ").trim()
|
|
261819
|
-
});
|
|
261820
|
-
}
|
|
261821
|
-
return results;
|
|
261822
|
-
}
|
|
261823
|
-
truncateToolResultText(text2) {
|
|
261824
|
-
return this.truncatePlain(text2, NETWORK_TOOL_RESULT_MAX_CHARS);
|
|
261825
|
-
}
|
|
261826
261866
|
appendBackgroundTaskNotification(tasks, remainingRunning = 0) {
|
|
261827
261867
|
const message2 = {
|
|
261828
261868
|
id: `msg_background_tasks_${randomUUID52().replace(/-/g, "")}`,
|
|
@@ -261892,11 +261932,6 @@ ${normalized}`);
|
|
|
261892
261932
|
);
|
|
261893
261933
|
return true;
|
|
261894
261934
|
}
|
|
261895
|
-
truncatePlain(text2, maxChars) {
|
|
261896
|
-
if (text2.length <= maxChars) return text2;
|
|
261897
|
-
return `${text2.slice(0, Math.max(0, maxChars - 32)).trimEnd()}
|
|
261898
|
-
... [truncated for context budget]`;
|
|
261899
|
-
}
|
|
261900
261935
|
async run() {
|
|
261901
261936
|
let outcome;
|
|
261902
261937
|
try {
|
|
@@ -263957,7 +263992,7 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
263957
263992
|
}
|
|
263958
263993
|
}
|
|
263959
263994
|
if (finalResult.ok) {
|
|
263960
|
-
const statusText =
|
|
263995
|
+
const statusText = truncateToolText(
|
|
263961
263996
|
redactSecrets(finalResult.display || "Done"),
|
|
263962
263997
|
TOOL_STATUS_MAX_CHARS
|
|
263963
263998
|
);
|
|
@@ -263972,7 +264007,7 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
263972
264007
|
void this.contextBuilder.warmCodebaseRetrieval().catch(() => void 0);
|
|
263973
264008
|
}
|
|
263974
264009
|
} else {
|
|
263975
|
-
const statusError =
|
|
264010
|
+
const statusError = truncateToolText(
|
|
263976
264011
|
redactSecrets(finalResult.error || "Unknown error"),
|
|
263977
264012
|
TOOL_STATUS_MAX_CHARS
|
|
263978
264013
|
);
|
|
@@ -264009,7 +264044,7 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
264009
264044
|
toolResult: {
|
|
264010
264045
|
toolCallId: tc.id,
|
|
264011
264046
|
name: tc.name,
|
|
264012
|
-
content:
|
|
264047
|
+
content: buildToolResultContent(tc.name, finalResult) + (guardNudge ? `
|
|
264013
264048
|
|
|
264014
264049
|
${guardNudge.message}` : ""),
|
|
264015
264050
|
isError: !finalResult.ok
|
|
@@ -265581,7 +265616,7 @@ var Orchestrator = class {
|
|
|
265581
265616
|
worktree = worktrees.createWorktree(worktreeId, {
|
|
265582
265617
|
snapshotWorkingTree: true
|
|
265583
265618
|
});
|
|
265584
|
-
if (!existsSync34(worktree.path) || !
|
|
265619
|
+
if (!existsSync34(worktree.path) || !statSync3(worktree.path).isDirectory()) {
|
|
265585
265620
|
throw new Error(
|
|
265586
265621
|
`Worktree manager returned a missing directory: ${worktree.path}`
|
|
265587
265622
|
);
|
|
@@ -266718,7 +266753,7 @@ function compareProviderBenchmarkResults(results) {
|
|
|
266718
266753
|
}
|
|
266719
266754
|
|
|
266720
266755
|
// src/runtime/ModelCatalog.ts
|
|
266721
|
-
var DEEPSEEK_MODELS = [
|
|
266756
|
+
var DEEPSEEK_MODELS = [DEEPSEEK_V4_FLASH, DEEPSEEK_V4_PRO];
|
|
266722
266757
|
var DEEPSEEK_LEGACY_ALIAS_DEPRECATION = "2026-07-24T15:59:00Z";
|
|
266723
266758
|
var DEEPSEEK_LEGACY_ALIAS_MIGRATIONS = {
|
|
266724
266759
|
"deepseek-chat": { model: "deepseek-v4-flash", thinking: "disabled" },
|
|
@@ -266735,6 +266770,22 @@ var OLLAMA_MODELS = ["qwen2.5-coder:7b", "qwen2.5-coder:1.5b", "llama3"];
|
|
|
266735
266770
|
function uniqueModels(models) {
|
|
266736
266771
|
return Array.from(new Set(models.map((m2) => m2.trim()).filter(Boolean)));
|
|
266737
266772
|
}
|
|
266773
|
+
function isOfficialDeepSeekProvider(config, providerId = config?.provider?.default) {
|
|
266774
|
+
const provider = providerId ? config?.providers?.[providerId] : void 0;
|
|
266775
|
+
const normalizedId = providerId?.trim().toLowerCase();
|
|
266776
|
+
if (normalizedId === "deepseek-openai" || normalizedId === "deepseek-anthropic") {
|
|
266777
|
+
return !provider?.baseUrl || isOfficialDeepSeekApi(provider.baseUrl);
|
|
266778
|
+
}
|
|
266779
|
+
return Boolean(provider?.baseUrl && isOfficialDeepSeekApi(provider.baseUrl));
|
|
266780
|
+
}
|
|
266781
|
+
function normalizeOfficialDeepSeekModels(models) {
|
|
266782
|
+
const available = /* @__PURE__ */ new Set();
|
|
266783
|
+
for (const model of models) {
|
|
266784
|
+
const profile = getDeepSeekV4ModelProfile(model);
|
|
266785
|
+
if (profile) available.add(profile.canonicalModel);
|
|
266786
|
+
}
|
|
266787
|
+
return DEEPSEEK_MODELS.filter((model) => available.has(model));
|
|
266788
|
+
}
|
|
266738
266789
|
var NON_CHAT_MODEL_KINDS = /* @__PURE__ */ new Set([
|
|
266739
266790
|
"embedding",
|
|
266740
266791
|
"image",
|
|
@@ -266779,6 +266830,10 @@ function getProviderModelCandidates(config, providerId = config?.provider?.defau
|
|
|
266779
266830
|
(model) => isChatModelCandidate(config, providerId, model)
|
|
266780
266831
|
) : [];
|
|
266781
266832
|
if (configuredModels.length > 0) {
|
|
266833
|
+
if (isOfficialDeepSeekProvider(config, providerId)) {
|
|
266834
|
+
const officialModels = normalizeOfficialDeepSeekModels(configuredModels);
|
|
266835
|
+
if (officialModels.length > 0) return officialModels;
|
|
266836
|
+
}
|
|
266782
266837
|
return configuredModels;
|
|
266783
266838
|
}
|
|
266784
266839
|
const providerType = providerConfig?.type;
|
|
@@ -266829,11 +266884,9 @@ function formatModelOptionLabel(model) {
|
|
|
266829
266884
|
if (migration) {
|
|
266830
266885
|
return `${model} (deprecated -> ${migration.model}; thinking ${migration.thinking})`;
|
|
266831
266886
|
}
|
|
266832
|
-
|
|
266833
|
-
|
|
266834
|
-
|
|
266835
|
-
if (lower.includes("deepseek-v4-pro")) {
|
|
266836
|
-
return `${model} (quality / pro; thinking available)`;
|
|
266887
|
+
const deepSeekProfile = getDeepSeekV4ModelProfile(model);
|
|
266888
|
+
if (deepSeekProfile && !deepSeekProfile.legacyAlias) {
|
|
266889
|
+
return deepSeekProfile.canonicalModel;
|
|
266837
266890
|
}
|
|
266838
266891
|
if (lower.includes("gpt-5.5") || lower.includes("gpt-5.4")) {
|
|
266839
266892
|
return `${model} (OpenAI)`;
|
|
@@ -267675,7 +267728,7 @@ async function runDoctor(cwd, options = {}) {
|
|
|
267675
267728
|
|
|
267676
267729
|
// src/commands/bench.ts
|
|
267677
267730
|
import picocolors7 from "picocolors";
|
|
267678
|
-
import { createHash as createHash8, randomUUID as
|
|
267731
|
+
import { createHash as createHash8, randomUUID as randomUUID8 } from "crypto";
|
|
267679
267732
|
import { resolve as resolve8 } from "path";
|
|
267680
267733
|
import { z as z46 } from "zod";
|
|
267681
267734
|
var BenchOptionsSchema = z46.object({
|
|
@@ -267998,7 +268051,7 @@ async function runBench(cwd, options = {}) {
|
|
|
267998
268051
|
if (models.length === 0) {
|
|
267999
268052
|
models.push(config.models.fast || config.models.default);
|
|
268000
268053
|
}
|
|
268001
|
-
const prompt = options.cacheProfile ? buildCacheProfilePrompt(
|
|
268054
|
+
const prompt = options.cacheProfile ? buildCacheProfilePrompt(randomUUID8(), options.prompt) : options.prompt || "Reply with one concise sentence explaining what Orbit is.";
|
|
268002
268055
|
const repeat = options.cacheProfile ? Math.max(3, clampRepeat(options.repeat)) : clampRepeat(options.repeat);
|
|
268003
268056
|
const minCacheHit = clampCacheHitThreshold(options.minCacheHit);
|
|
268004
268057
|
const benchmarkThresholds = {
|
|
@@ -274195,7 +274248,7 @@ import { rmSync as rmSync6, watch } from "fs";
|
|
|
274195
274248
|
import { dirname as dirname13, resolve as resolve14 } from "path";
|
|
274196
274249
|
import { homedir as homedir10 } from "os";
|
|
274197
274250
|
import http3 from "http";
|
|
274198
|
-
import { randomBytes as randomBytes4, randomUUID as
|
|
274251
|
+
import { randomBytes as randomBytes4, randomUUID as randomUUID12, timingSafeEqual as timingSafeEqual2 } from "crypto";
|
|
274199
274252
|
import { z as z66 } from "zod";
|
|
274200
274253
|
|
|
274201
274254
|
// src/runtime/CommandRouter.ts
|
|
@@ -274413,7 +274466,7 @@ import { createRequire as createRequire2 } from "module";
|
|
|
274413
274466
|
|
|
274414
274467
|
// src/runtime/webui/WebUiRuntime.ts
|
|
274415
274468
|
import http2 from "http";
|
|
274416
|
-
import { randomBytes as randomBytes3, randomUUID as
|
|
274469
|
+
import { randomBytes as randomBytes3, randomUUID as randomUUID9 } from "crypto";
|
|
274417
274470
|
import { isAbsolute as isAbsolute5, relative as relative7, resolve as resolve11 } from "path";
|
|
274418
274471
|
import { z as z55 } from "zod";
|
|
274419
274472
|
|
|
@@ -275182,6 +275235,10 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
|
|
|
275182
275235
|
applySettings({ model: elements.modelSelect.value }, true).catch(() => {});
|
|
275183
275236
|
});
|
|
275184
275237
|
|
|
275238
|
+
elements.settingsModelSelect.addEventListener('change', () => {
|
|
275239
|
+
applySettings({ model: elements.settingsModelSelect.value }, true).catch(() => {});
|
|
275240
|
+
});
|
|
275241
|
+
|
|
275185
275242
|
async function submitCustomModel() {
|
|
275186
275243
|
const model = elements.customModel.value.trim();
|
|
275187
275244
|
if (!model || state.busy || state.customModelPending) return;
|
|
@@ -275758,34 +275815,40 @@ var WEB_UI_CLIENT_CAPABILITIES_SCRIPT = String.raw` function syncSkillControls(
|
|
|
275758
275815
|
`;
|
|
275759
275816
|
|
|
275760
275817
|
// src/runtime/webui/WebUiClientApproval.ts
|
|
275761
|
-
|
|
275762
|
-
|
|
275818
|
+
function createApprovalController(runtime) {
|
|
275819
|
+
const { copy, elements, state, api, showToast, reconcileStatus } = runtime;
|
|
275820
|
+
function renderPendingApproval(approval) {
|
|
275821
|
+
state.pendingApproval = approval?.id ? approval : null;
|
|
275763
275822
|
const visible = Boolean(state.pendingApproval);
|
|
275764
275823
|
elements.approvalPanel.hidden = !visible;
|
|
275765
|
-
if (!
|
|
275766
|
-
elements.approvalTitle.textContent =
|
|
275767
|
-
elements.approvalReason.textContent =
|
|
275768
|
-
elements.approvalPreview.textContent =
|
|
275824
|
+
if (!state.pendingApproval) {
|
|
275825
|
+
elements.approvalTitle.textContent = "";
|
|
275826
|
+
elements.approvalReason.textContent = "";
|
|
275827
|
+
elements.approvalPreview.textContent = "";
|
|
275769
275828
|
elements.approvalPreview.hidden = true;
|
|
275770
275829
|
state.approvalSubmitting = false;
|
|
275771
275830
|
return;
|
|
275772
275831
|
}
|
|
275773
275832
|
elements.approvalTitle.textContent = state.pendingApproval.title || copy.approvalRequired;
|
|
275774
|
-
const approvalOwner = state.pendingApproval.agentRole || state.pendingApproval.agentId ||
|
|
275833
|
+
const approvalOwner = state.pendingApproval.agentRole || state.pendingApproval.agentId || "";
|
|
275775
275834
|
elements.approvalReason.textContent = [
|
|
275776
|
-
approvalOwner ? copy.approvalOwner
|
|
275777
|
-
state.pendingApproval.reason ||
|
|
275778
|
-
].filter(Boolean).join(
|
|
275779
|
-
const preview = String(state.pendingApproval.preview ||
|
|
275835
|
+
approvalOwner ? `${copy.approvalOwner} ${approvalOwner}` : "",
|
|
275836
|
+
state.pendingApproval.reason || ""
|
|
275837
|
+
].filter(Boolean).join(" \xB7 ");
|
|
275838
|
+
const preview = String(state.pendingApproval.preview || "");
|
|
275780
275839
|
elements.approvalPreview.replaceChildren();
|
|
275781
275840
|
if (preview) {
|
|
275782
|
-
for (const line of preview.split(
|
|
275783
|
-
const row = document.createElement(
|
|
275784
|
-
row.className =
|
|
275785
|
-
if (line.startsWith(
|
|
275786
|
-
|
|
275787
|
-
else if (line.startsWith(
|
|
275788
|
-
|
|
275841
|
+
for (const line of preview.split("\n")) {
|
|
275842
|
+
const row = document.createElement("span");
|
|
275843
|
+
row.className = "approval-preview-line";
|
|
275844
|
+
if (line.startsWith("+") && !line.startsWith("+++")) {
|
|
275845
|
+
row.classList.add("is-added");
|
|
275846
|
+
} else if (line.startsWith("-") && !line.startsWith("---")) {
|
|
275847
|
+
row.classList.add("is-deleted");
|
|
275848
|
+
} else if (line.startsWith("@@")) {
|
|
275849
|
+
row.classList.add("is-hunk");
|
|
275850
|
+
}
|
|
275851
|
+
row.textContent = line || " ";
|
|
275789
275852
|
elements.approvalPreview.append(row);
|
|
275790
275853
|
}
|
|
275791
275854
|
}
|
|
@@ -275793,129 +275856,173 @@ var WEB_UI_CLIENT_APPROVAL_SCRIPT = String.raw` function renderPendingApproval(
|
|
|
275793
275856
|
elements.denyApprovalButton.disabled = state.approvalSubmitting;
|
|
275794
275857
|
elements.approveApprovalButton.disabled = state.approvalSubmitting;
|
|
275795
275858
|
}
|
|
275796
|
-
|
|
275797
275859
|
async function respondToApproval(approved) {
|
|
275798
275860
|
const approval = state.pendingApproval;
|
|
275799
275861
|
if (!approval || state.approvalSubmitting) return;
|
|
275800
275862
|
state.approvalSubmitting = true;
|
|
275801
275863
|
renderPendingApproval(approval);
|
|
275802
275864
|
try {
|
|
275803
|
-
await api(
|
|
275804
|
-
method:
|
|
275805
|
-
headers: {
|
|
275806
|
-
body: JSON.stringify({ id: approval.id, approved: Boolean(approved) })
|
|
275865
|
+
await api("/api/approval", {
|
|
275866
|
+
method: "POST",
|
|
275867
|
+
headers: { "Content-Type": "application/json" },
|
|
275868
|
+
body: JSON.stringify({ id: approval.id, approved: Boolean(approved) })
|
|
275807
275869
|
});
|
|
275808
|
-
showToast(
|
|
275870
|
+
showToast(
|
|
275871
|
+
approved ? copy.approvalApproved : copy.approvalDenied,
|
|
275872
|
+
approved ? "success" : "warning"
|
|
275873
|
+
);
|
|
275809
275874
|
renderPendingApproval(null);
|
|
275810
275875
|
void reconcileStatus();
|
|
275811
275876
|
} catch (error) {
|
|
275812
275877
|
state.approvalSubmitting = false;
|
|
275813
275878
|
renderPendingApproval(approval);
|
|
275814
|
-
showToast(
|
|
275879
|
+
showToast(
|
|
275880
|
+
error instanceof Error ? error.message : String(error),
|
|
275881
|
+
"error"
|
|
275882
|
+
);
|
|
275815
275883
|
}
|
|
275816
275884
|
}
|
|
275885
|
+
return { renderPendingApproval, respondToApproval };
|
|
275886
|
+
}
|
|
275887
|
+
var WEB_UI_CLIENT_APPROVAL_SCRIPT = ` const { renderPendingApproval, respondToApproval } = (${createApprovalController.toString()})({ copy, elements, state, api, showToast, reconcileStatus });
|
|
275817
275888
|
|
|
275818
275889
|
`;
|
|
275819
275890
|
|
|
275820
275891
|
// src/runtime/webui/WebUiClientAttachments.ts
|
|
275821
|
-
|
|
275892
|
+
function createAttachmentController(runtime) {
|
|
275893
|
+
const { copy, elements, state, api, showToast, updateSendButtonState } = runtime;
|
|
275894
|
+
function renderAttachments() {
|
|
275822
275895
|
elements.attachmentList.replaceChildren();
|
|
275823
275896
|
elements.attachmentShelf.hidden = state.attachments.length === 0;
|
|
275824
275897
|
elements.attachmentCount.textContent = String(state.attachments.length);
|
|
275825
275898
|
elements.attachmentCount.hidden = state.attachments.length === 0;
|
|
275826
|
-
elements.attachmentCount.setAttribute(
|
|
275899
|
+
elements.attachmentCount.setAttribute(
|
|
275900
|
+
"aria-label",
|
|
275901
|
+
String(state.attachments.length)
|
|
275902
|
+
);
|
|
275827
275903
|
elements.attachmentButton.disabled = state.attachments.length >= 4;
|
|
275828
275904
|
for (const attachment of state.attachments) {
|
|
275829
|
-
const card = document.createElement(
|
|
275830
|
-
card.className =
|
|
275831
|
-
const image = document.createElement(
|
|
275905
|
+
const card = document.createElement("div");
|
|
275906
|
+
card.className = "attachment-card";
|
|
275907
|
+
const image = document.createElement("img");
|
|
275832
275908
|
image.src = attachment.previewUrl;
|
|
275833
|
-
image.alt =
|
|
275834
|
-
const copyBlock = document.createElement(
|
|
275835
|
-
const name = document.createElement(
|
|
275909
|
+
image.alt = "";
|
|
275910
|
+
const copyBlock = document.createElement("span");
|
|
275911
|
+
const name = document.createElement("strong");
|
|
275836
275912
|
name.textContent = attachment.name;
|
|
275837
275913
|
name.title = attachment.name;
|
|
275838
|
-
const size = document.createElement(
|
|
275839
|
-
size.textContent = Math.max(1, Math.round(attachment.size / 1024))
|
|
275914
|
+
const size = document.createElement("small");
|
|
275915
|
+
size.textContent = `${Math.max(1, Math.round(attachment.size / 1024))} KB`;
|
|
275840
275916
|
copyBlock.append(name, size);
|
|
275841
|
-
const remove = document.createElement(
|
|
275842
|
-
remove.type =
|
|
275917
|
+
const remove = document.createElement("button");
|
|
275918
|
+
remove.type = "button";
|
|
275843
275919
|
remove.dataset.attachmentRemove = attachment.id;
|
|
275844
|
-
remove.textContent =
|
|
275845
|
-
remove.setAttribute(
|
|
275920
|
+
remove.textContent = "\xD7";
|
|
275921
|
+
remove.setAttribute("aria-label", copy.removeAttachment);
|
|
275846
275922
|
card.append(image, copyBlock, remove);
|
|
275847
275923
|
elements.attachmentList.append(card);
|
|
275848
275924
|
}
|
|
275849
275925
|
updateSendButtonState();
|
|
275850
275926
|
}
|
|
275851
|
-
|
|
275852
275927
|
async function uploadAttachment(file) {
|
|
275853
|
-
if (!file || ![
|
|
275854
|
-
|
|
275928
|
+
if (!file || !["image/png", "image/jpeg", "image/gif", "image/webp"].includes(
|
|
275929
|
+
file.type
|
|
275930
|
+
)) {
|
|
275931
|
+
showToast(copy.attachmentLimit, "warning");
|
|
275855
275932
|
return;
|
|
275856
275933
|
}
|
|
275857
275934
|
if (file.size <= 0 || file.size > 5 * 1024 * 1024 || state.attachments.length >= 4) {
|
|
275858
|
-
showToast(copy.attachmentLimit,
|
|
275935
|
+
showToast(copy.attachmentLimit, "warning");
|
|
275859
275936
|
return;
|
|
275860
275937
|
}
|
|
275861
275938
|
elements.attachmentButton.disabled = true;
|
|
275862
275939
|
try {
|
|
275863
|
-
const result = await api(
|
|
275864
|
-
|
|
275865
|
-
|
|
275866
|
-
|
|
275867
|
-
|
|
275940
|
+
const result = await api(
|
|
275941
|
+
`/api/attachment?name=${encodeURIComponent(file.name || "image")}`,
|
|
275942
|
+
{
|
|
275943
|
+
method: "POST",
|
|
275944
|
+
headers: { "Content-Type": file.type },
|
|
275945
|
+
body: file
|
|
275946
|
+
}
|
|
275947
|
+
);
|
|
275868
275948
|
const attachment = result.attachment || {};
|
|
275869
275949
|
state.attachments.push({
|
|
275870
|
-
id: attachment.id,
|
|
275871
|
-
name: attachment.name || file.name ||
|
|
275950
|
+
id: String(attachment.id || ""),
|
|
275951
|
+
name: attachment.name || file.name || "image",
|
|
275872
275952
|
mediaType: attachment.mediaType || file.type,
|
|
275873
275953
|
size: Number(attachment.size || file.size),
|
|
275874
|
-
previewUrl: URL.createObjectURL(file)
|
|
275954
|
+
previewUrl: URL.createObjectURL(file)
|
|
275875
275955
|
});
|
|
275876
275956
|
renderAttachments();
|
|
275877
|
-
showToast(copy.attachmentAdded,
|
|
275957
|
+
showToast(copy.attachmentAdded, "success");
|
|
275878
275958
|
} catch (error) {
|
|
275879
|
-
showToast(
|
|
275959
|
+
showToast(
|
|
275960
|
+
error instanceof Error ? error.message : String(error),
|
|
275961
|
+
"error"
|
|
275962
|
+
);
|
|
275880
275963
|
} finally {
|
|
275881
275964
|
elements.attachmentButton.disabled = state.attachments.length >= 4;
|
|
275882
|
-
elements.attachmentInput.value =
|
|
275965
|
+
elements.attachmentInput.value = "";
|
|
275883
275966
|
}
|
|
275884
275967
|
}
|
|
275885
|
-
|
|
275886
275968
|
async function addAttachmentFiles(files) {
|
|
275887
|
-
for (const file of Array.from(files || []).slice(
|
|
275969
|
+
for (const file of Array.from(files || []).slice(
|
|
275970
|
+
0,
|
|
275971
|
+
4 - state.attachments.length
|
|
275972
|
+
)) {
|
|
275888
275973
|
await uploadAttachment(file);
|
|
275889
275974
|
}
|
|
275890
275975
|
}
|
|
275891
|
-
|
|
275892
275976
|
async function removeAttachment(id, notify) {
|
|
275893
|
-
const index = state.attachments.findIndex(
|
|
275977
|
+
const index = state.attachments.findIndex(
|
|
275978
|
+
(attachment2) => attachment2.id === id
|
|
275979
|
+
);
|
|
275894
275980
|
if (index === -1) return;
|
|
275895
275981
|
const attachment = state.attachments[index];
|
|
275896
|
-
const removeButton = elements.attachmentList.querySelector(
|
|
275982
|
+
const removeButton = elements.attachmentList.querySelector(
|
|
275983
|
+
`[data-attachment-remove="${CSS.escape(id)}"]`
|
|
275984
|
+
);
|
|
275897
275985
|
if (removeButton) removeButton.disabled = true;
|
|
275898
275986
|
try {
|
|
275899
|
-
await api(
|
|
275900
|
-
|
|
275987
|
+
await api(`/api/attachment?id=${encodeURIComponent(id)}`, {
|
|
275988
|
+
method: "DELETE"
|
|
275989
|
+
});
|
|
275990
|
+
const currentIndex = state.attachments.findIndex(
|
|
275991
|
+
(item) => item.id === id
|
|
275992
|
+
);
|
|
275901
275993
|
if (currentIndex !== -1) state.attachments.splice(currentIndex, 1);
|
|
275902
275994
|
if (attachment.previewUrl) URL.revokeObjectURL(attachment.previewUrl);
|
|
275903
275995
|
renderAttachments();
|
|
275904
275996
|
if (notify) showToast(copy.attachmentRemoved);
|
|
275905
275997
|
} catch (error) {
|
|
275906
275998
|
if (removeButton) removeButton.disabled = false;
|
|
275907
|
-
showToast(
|
|
275999
|
+
showToast(
|
|
276000
|
+
error instanceof Error ? error.message : String(error),
|
|
276001
|
+
"error"
|
|
276002
|
+
);
|
|
275908
276003
|
}
|
|
275909
276004
|
}
|
|
275910
|
-
|
|
275911
276005
|
function consumeAttachments(ids) {
|
|
275912
276006
|
const consumed = new Set(ids || []);
|
|
275913
276007
|
for (const attachment of state.attachments) {
|
|
275914
|
-
if (consumed.has(attachment.id) && attachment.previewUrl)
|
|
276008
|
+
if (consumed.has(attachment.id) && attachment.previewUrl) {
|
|
276009
|
+
URL.revokeObjectURL(attachment.previewUrl);
|
|
276010
|
+
}
|
|
275915
276011
|
}
|
|
275916
|
-
state.attachments = state.attachments.filter(
|
|
276012
|
+
state.attachments = state.attachments.filter(
|
|
276013
|
+
(attachment) => !consumed.has(attachment.id)
|
|
276014
|
+
);
|
|
275917
276015
|
renderAttachments();
|
|
275918
276016
|
}
|
|
276017
|
+
return {
|
|
276018
|
+
renderAttachments,
|
|
276019
|
+
uploadAttachment,
|
|
276020
|
+
addAttachmentFiles,
|
|
276021
|
+
removeAttachment,
|
|
276022
|
+
consumeAttachments
|
|
276023
|
+
};
|
|
276024
|
+
}
|
|
276025
|
+
var WEB_UI_CLIENT_ATTACHMENTS_SCRIPT = ` const { renderAttachments, uploadAttachment, addAttachmentFiles, removeAttachment, consumeAttachments } = (${createAttachmentController.toString()})({ copy, elements, state, api, showToast, updateSendButtonState });
|
|
275919
276026
|
|
|
275920
276027
|
`;
|
|
275921
276028
|
|
|
@@ -276679,6 +276786,7 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
276679
276786
|
connectionLabel: byId('connectionLabel'),
|
|
276680
276787
|
providerSelect: byId('providerSelect'),
|
|
276681
276788
|
modelSelect: byId('modelSelect'),
|
|
276789
|
+
settingsModelSelect: byId('settingsModelSelect'),
|
|
276682
276790
|
customModel: byId('customModel'),
|
|
276683
276791
|
applyModel: byId('applyModel'),
|
|
276684
276792
|
permissionSelect: byId('permissionSelect'),
|
|
@@ -279162,20 +279270,22 @@ var WEB_UI_CLIENT_SESSION_SCRIPT = String.raw` const controlCommands = ${WEB_UI
|
|
|
279162
279270
|
|
|
279163
279271
|
function syncModelOptions(data) {
|
|
279164
279272
|
const current = data.modelSelection || data.activeModel || '';
|
|
279165
|
-
elements.modelSelect.
|
|
279166
|
-
|
|
279167
|
-
const
|
|
279168
|
-
|
|
279169
|
-
|
|
279170
|
-
|
|
279171
|
-
|
|
279172
|
-
|
|
279173
|
-
|
|
279174
|
-
|
|
279175
|
-
|
|
279176
|
-
|
|
279273
|
+
for (const select of [elements.modelSelect, elements.settingsModelSelect]) {
|
|
279274
|
+
select.replaceChildren();
|
|
279275
|
+
for (const option of data.modelOptions || []) {
|
|
279276
|
+
const node = document.createElement('option');
|
|
279277
|
+
node.value = option.id;
|
|
279278
|
+
node.textContent = option.label;
|
|
279279
|
+
select.append(node);
|
|
279280
|
+
}
|
|
279281
|
+
if (![...select.options].some((option) => option.value === current)) {
|
|
279282
|
+
const custom = document.createElement('option');
|
|
279283
|
+
custom.value = current;
|
|
279284
|
+
custom.textContent = current || 'custom';
|
|
279285
|
+
select.prepend(custom);
|
|
279286
|
+
}
|
|
279287
|
+
select.value = current;
|
|
279177
279288
|
}
|
|
279178
|
-
elements.modelSelect.value = current;
|
|
279179
279289
|
syncSelectControl(elements.modelSelect);
|
|
279180
279290
|
}
|
|
279181
279291
|
|
|
@@ -279610,6 +279720,14 @@ var WEB_UI_CLIENT_SESSION_SCRIPT = String.raw` const controlCommands = ${WEB_UI
|
|
|
279610
279720
|
}
|
|
279611
279721
|
|
|
279612
279722
|
function renderPromptQueue() {
|
|
279723
|
+
const activeEditor = document.activeElement && document.activeElement.closest
|
|
279724
|
+
? document.activeElement.closest('[data-queue-editor]')
|
|
279725
|
+
: null;
|
|
279726
|
+
const restoreEditorFocus = Boolean(
|
|
279727
|
+
activeEditor && activeEditor.dataset.queueEditor === state.queueEditingId,
|
|
279728
|
+
);
|
|
279729
|
+
const selectionStart = restoreEditorFocus ? activeEditor.selectionStart : null;
|
|
279730
|
+
const selectionEnd = restoreEditorFocus ? activeEditor.selectionEnd : null;
|
|
279613
279731
|
elements.promptQueueList.replaceChildren();
|
|
279614
279732
|
elements.promptQueue.hidden = state.promptQueue.length === 0;
|
|
279615
279733
|
if (!state.promptQueue.some((item) => item.id === state.queueEditingId)) {
|
|
@@ -279676,6 +279794,17 @@ var WEB_UI_CLIENT_SESSION_SCRIPT = String.raw` const controlCommands = ${WEB_UI
|
|
|
279676
279794
|
row.append(number, text, actions);
|
|
279677
279795
|
elements.promptQueueList.append(row);
|
|
279678
279796
|
}
|
|
279797
|
+
if (restoreEditorFocus && state.queueEditingId) {
|
|
279798
|
+
const editor = elements.promptQueueList.querySelector(
|
|
279799
|
+
'[data-queue-editor="' + CSS.escape(state.queueEditingId) + '"]',
|
|
279800
|
+
);
|
|
279801
|
+
if (editor) {
|
|
279802
|
+
editor.focus();
|
|
279803
|
+
if (selectionStart !== null && selectionEnd !== null) {
|
|
279804
|
+
editor.setSelectionRange(selectionStart, selectionEnd);
|
|
279805
|
+
}
|
|
279806
|
+
}
|
|
279807
|
+
}
|
|
279679
279808
|
}
|
|
279680
279809
|
|
|
279681
279810
|
async function queuePrompt(prompt, mode) {
|
|
@@ -281348,19 +281477,15 @@ function getActiveModel(options) {
|
|
|
281348
281477
|
function buildModelOptions(options, activeModel2) {
|
|
281349
281478
|
const { config } = options;
|
|
281350
281479
|
const providerId = config.provider.default;
|
|
281480
|
+
const providerModels = getProviderModelCandidates(config, providerId);
|
|
281481
|
+
const includeActiveModel = !isOfficialDeepSeekProvider(config, providerId) || providerModels.includes(activeModel2);
|
|
281351
281482
|
const discovered = Array.from(
|
|
281352
|
-
/* @__PURE__ */ new Set([
|
|
281353
|
-
activeModel2,
|
|
281354
|
-
config.models.default,
|
|
281355
|
-
config.models.fast,
|
|
281356
|
-
config.models.planner,
|
|
281357
|
-
config.models.coder,
|
|
281358
|
-
config.models.reviewer,
|
|
281359
|
-
config.models.summarizer,
|
|
281360
|
-
...getProviderModelCandidates(config, providerId)
|
|
281361
|
-
])
|
|
281483
|
+
/* @__PURE__ */ new Set([...includeActiveModel ? [activeModel2] : [], ...providerModels])
|
|
281362
281484
|
).map((model) => model?.trim()).filter((model) => Boolean(model)).map((model) => ({ id: model, label: formatModelOptionLabel(model) }));
|
|
281363
|
-
const automatic = {
|
|
281485
|
+
const automatic = {
|
|
281486
|
+
id: "__auto__",
|
|
281487
|
+
label: isOfficialDeepSeekProvider(config, providerId) ? "Auto \xB7 deepseek-v4-flash / deepseek-v4-pro" : "Auto"
|
|
281488
|
+
};
|
|
281364
281489
|
return safeCall(() => options.loop?.getModelOverride?.()) ? [discovered[0], automatic, ...discovered.slice(1)] : [automatic, ...discovered];
|
|
281365
281490
|
}
|
|
281366
281491
|
function normalizeMessage(message2, index) {
|
|
@@ -282704,6 +282829,8 @@ function renderWebUiPage(language) {
|
|
|
282704
282829
|
</section>
|
|
282705
282830
|
<section class="settings-group">
|
|
282706
282831
|
<h3>${copy.model}</h3>
|
|
282832
|
+
<label class="field-label" for="settingsModelSelect">${copy.model}</label>
|
|
282833
|
+
<select class="field-control" id="settingsModelSelect" aria-label="${copy.model}"></select>
|
|
282707
282834
|
<label class="field-label" for="customModel">${copy.customModel}</label>
|
|
282708
282835
|
<div class="inline-field">
|
|
282709
282836
|
<input id="customModel" type="text" maxlength="200" placeholder="deepseek-v4-pro" />
|
|
@@ -289816,7 +289943,7 @@ var OrbitWebUiRuntime = class {
|
|
|
289816
289943
|
});
|
|
289817
289944
|
return;
|
|
289818
289945
|
}
|
|
289819
|
-
const id = `att_${
|
|
289946
|
+
const id = `att_${randomUUID9().replace(/-/g, "")}`;
|
|
289820
289947
|
const rawName = url.searchParams.get("name") || "image";
|
|
289821
289948
|
const name = rawName.replace(/[\u0000-\u001f\u007f\\/]/g, "_").trim().slice(0, 255) || "image";
|
|
289822
289949
|
const attachment = {
|
|
@@ -289996,7 +290123,7 @@ var OrbitWebUiRuntime = class {
|
|
|
289996
290123
|
return;
|
|
289997
290124
|
}
|
|
289998
290125
|
const turn = {
|
|
289999
|
-
id: body.turnId ||
|
|
290126
|
+
id: body.turnId || randomUUID9(),
|
|
290000
290127
|
sessionId: safeCall2(() => options.loop?.getSessionId?.()) || "",
|
|
290001
290128
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
290002
290129
|
cancelRequested: false
|
|
@@ -290092,7 +290219,7 @@ var OrbitWebUiRuntime = class {
|
|
|
290092
290219
|
return;
|
|
290093
290220
|
}
|
|
290094
290221
|
const turn = {
|
|
290095
|
-
id: body.turnId ||
|
|
290222
|
+
id: body.turnId || randomUUID9(),
|
|
290096
290223
|
sessionId: safeCall2(() => options.loop?.getSessionId?.()) || "",
|
|
290097
290224
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
290098
290225
|
cancelRequested: false
|
|
@@ -290367,7 +290494,7 @@ async function stopOrbitWebUi() {
|
|
|
290367
290494
|
}
|
|
290368
290495
|
|
|
290369
290496
|
// src/runtime/webui/WebUiApprovalBroker.ts
|
|
290370
|
-
import { randomUUID as
|
|
290497
|
+
import { randomUUID as randomUUID10 } from "crypto";
|
|
290371
290498
|
var WEB_APPROVAL_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
290372
290499
|
var MAX_QUEUED_APPROVALS = 16;
|
|
290373
290500
|
var WebUiApprovalBroker = class {
|
|
@@ -290434,7 +290561,7 @@ var WebUiApprovalBroker = class {
|
|
|
290434
290561
|
};
|
|
290435
290562
|
function sanitizeApprovalRequest(request) {
|
|
290436
290563
|
return {
|
|
290437
|
-
id:
|
|
290564
|
+
id: randomUUID10(),
|
|
290438
290565
|
kind: request.kind,
|
|
290439
290566
|
title: safeApprovalText2(request.title, 200, false),
|
|
290440
290567
|
reason: safeApprovalText2(request.reason, 1500, false),
|
|
@@ -290861,7 +290988,7 @@ async function handleWorkspaceConfigCommand(configArgument, dependencies) {
|
|
|
290861
290988
|
|
|
290862
290989
|
// src/runtime/commands/ContextCommandHandler.ts
|
|
290863
290990
|
import glob5 from "fast-glob";
|
|
290864
|
-
import { existsSync as existsSync18, statSync as
|
|
290991
|
+
import { existsSync as existsSync18, statSync as statSync4 } from "fs";
|
|
290865
290992
|
import { isAbsolute as isAbsolute6, relative as relative8, resolve as resolve12 } from "path";
|
|
290866
290993
|
import picocolors12 from "picocolors";
|
|
290867
290994
|
function parseAddArgument(argument) {
|
|
@@ -291049,7 +291176,7 @@ ${matched.map((file) => ` \u2022 ${file}`).join("\n")}`
|
|
|
291049
291176
|
}
|
|
291050
291177
|
const relativePath = toWorkspaceRelative(cwd, absolutePath);
|
|
291051
291178
|
try {
|
|
291052
|
-
if (
|
|
291179
|
+
if (statSync4(absolutePath).isDirectory()) {
|
|
291053
291180
|
const files = await glob5("**/*", {
|
|
291054
291181
|
cwd: absolutePath,
|
|
291055
291182
|
onlyFiles: true,
|
|
@@ -292321,7 +292448,7 @@ function copyBooleanCapability(source, sourceKey, target, targetKey) {
|
|
|
292321
292448
|
|
|
292322
292449
|
// src/runtime/ProjectLauncher.ts
|
|
292323
292450
|
import { spawn as spawn4 } from "child_process";
|
|
292324
|
-
import { existsSync as existsSync20, mkdirSync as mkdirSync7, realpathSync as realpathSync3, statSync as
|
|
292451
|
+
import { existsSync as existsSync20, mkdirSync as mkdirSync7, realpathSync as realpathSync3, statSync as statSync5 } from "fs";
|
|
292325
292452
|
import { dirname as dirname12, isAbsolute as isAbsolute7, parse as parse4, resolve as resolve13 } from "path";
|
|
292326
292453
|
var PROJECT_WEB_UI_READY_MESSAGE = "orbit-webui-ready";
|
|
292327
292454
|
async function launchOrbitProject(request, options = {}) {
|
|
@@ -292421,7 +292548,7 @@ function createProjectDirectory(projectPath) {
|
|
|
292421
292548
|
"The parent folder does not exist. Choose an existing location first."
|
|
292422
292549
|
);
|
|
292423
292550
|
}
|
|
292424
|
-
if (!
|
|
292551
|
+
if (!statSync5(parentPath).isDirectory()) {
|
|
292425
292552
|
throw new Error("The project parent path must be a directory.");
|
|
292426
292553
|
}
|
|
292427
292554
|
try {
|
|
@@ -292441,7 +292568,7 @@ function requireProjectDirectory(projectPath) {
|
|
|
292441
292568
|
if (!existsSync20(projectPath)) {
|
|
292442
292569
|
throw new Error("Project folder does not exist.");
|
|
292443
292570
|
}
|
|
292444
|
-
if (!
|
|
292571
|
+
if (!statSync5(projectPath).isDirectory()) {
|
|
292445
292572
|
throw new Error("Project path must point to a directory.");
|
|
292446
292573
|
}
|
|
292447
292574
|
}
|
|
@@ -293240,7 +293367,7 @@ ${request.customInstructions}` : "";
|
|
|
293240
293367
|
}
|
|
293241
293368
|
|
|
293242
293369
|
// src/runtime/CommandRouter.ts
|
|
293243
|
-
import { randomUUID as
|
|
293370
|
+
import { randomUUID as randomUUID11 } from "crypto";
|
|
293244
293371
|
var require2 = createRequire2(import.meta.url);
|
|
293245
293372
|
function stripAnsi4(value) {
|
|
293246
293373
|
return value.replace(/\u001b\[[0-9;]*m/g, "");
|
|
@@ -293871,7 +293998,7 @@ var CommandRouter = class {
|
|
|
293871
293998
|
const createModelOptions = () => [
|
|
293872
293999
|
{
|
|
293873
294000
|
value: "auto",
|
|
293874
|
-
label: isZh ? "\u81EA\u52A8\u8DEF\u7531\
|
|
294001
|
+
label: isOfficialDeepSeekProvider(activeConfig, providerId) ? isZh ? "\u81EA\u52A8\u8DEF\u7531\uFF08\u6309\u4EFB\u52A1\u9009\u62E9 deepseek-v4-flash / deepseek-v4-pro\uFF09" : "Auto routing (deepseek-v4-flash / deepseek-v4-pro by task)" : isZh ? "\u81EA\u52A8\u8DEF\u7531\uFF08\u6309\u4EFB\u52A1\u9009\u62E9\u6A21\u578B\uFF09" : "Auto routing (choose model by task)"
|
|
293875
294002
|
},
|
|
293876
294003
|
...getProviderModelCandidates(activeConfig, providerId).map(
|
|
293877
294004
|
(model) => ({
|
|
@@ -294380,7 +294507,7 @@ ${picocolors18.green("\u2714")} Switched security mode to: ${picocolors18.green(
|
|
|
294380
294507
|
queuedInput.text,
|
|
294381
294508
|
queuedInteraction
|
|
294382
294509
|
) : this.loop;
|
|
294383
|
-
const turnId =
|
|
294510
|
+
const turnId = randomUUID11();
|
|
294384
294511
|
eventBus.emitEvent("ui_turn_started", {
|
|
294385
294512
|
turnId,
|
|
294386
294513
|
source: "web",
|
|
@@ -294755,6 +294882,22 @@ ${picocolors18.green("\u2714")} Switched security mode to: ${picocolors18.green(
|
|
|
294755
294882
|
message: "Wait for the active task to finish before changing settings."
|
|
294756
294883
|
};
|
|
294757
294884
|
}
|
|
294885
|
+
const changesProvider = Boolean(patch.provider) && patch.provider !== this.providerInstance.id;
|
|
294886
|
+
if (patch.model && patch.model !== "__auto__" && !changesProvider) {
|
|
294887
|
+
const providerId = this.config.provider.default;
|
|
294888
|
+
const availableModels = getProviderModelCandidates(
|
|
294889
|
+
this.config,
|
|
294890
|
+
providerId
|
|
294891
|
+
);
|
|
294892
|
+
const currentOverride = this.loop.getModelOverride();
|
|
294893
|
+
const allowExistingUnlisted = !isOfficialDeepSeekProvider(this.config, providerId) && patch.model === currentOverride;
|
|
294894
|
+
if (!availableModels.includes(patch.model) && !allowExistingUnlisted) {
|
|
294895
|
+
return {
|
|
294896
|
+
ok: false,
|
|
294897
|
+
message: `Model is not available for provider ${providerId}: ${patch.model}`
|
|
294898
|
+
};
|
|
294899
|
+
}
|
|
294900
|
+
}
|
|
294758
294901
|
const violation = validateManagedRuntimeChange(this.config, patch);
|
|
294759
294902
|
if (violation) return { ok: false, message: violation };
|
|
294760
294903
|
const draft = JSON.parse(JSON.stringify(this.config));
|
|
@@ -295666,7 +295809,7 @@ Risk Warning: ${reason}`);
|
|
|
295666
295809
|
}
|
|
295667
295810
|
const routedInput = routeResult.input ?? trimmed;
|
|
295668
295811
|
loop.prepareUserTurn(routedInput);
|
|
295669
|
-
const terminalTurnId =
|
|
295812
|
+
const terminalTurnId = randomUUID12();
|
|
295670
295813
|
eventBus.emitEvent("ui_turn_started", {
|
|
295671
295814
|
turnId: terminalTurnId,
|
|
295672
295815
|
source: "terminal",
|
|
@@ -295725,7 +295868,7 @@ Risk Warning: ${reason}`);
|
|
|
295725
295868
|
\u25CF Guided instruction received. Replanning execution...`
|
|
295726
295869
|
);
|
|
295727
295870
|
loop.prepareQueuedUserTurn(queuedInput);
|
|
295728
|
-
const guidedTurnId =
|
|
295871
|
+
const guidedTurnId = randomUUID12();
|
|
295729
295872
|
eventBus.emitEvent("ui_turn_started", {
|
|
295730
295873
|
turnId: guidedTurnId,
|
|
295731
295874
|
source: "terminal",
|
|
@@ -296482,7 +296625,7 @@ var PROVIDER_TEMPLATES = [
|
|
|
296482
296625
|
envVar: "DEEPSEEK_API_KEY",
|
|
296483
296626
|
type: "openai-compatible",
|
|
296484
296627
|
baseUrl: "https://api.deepseek.com",
|
|
296485
|
-
discoverModels:
|
|
296628
|
+
discoverModels: true,
|
|
296486
296629
|
deepSeekApiFormat: "auto"
|
|
296487
296630
|
},
|
|
296488
296631
|
{
|
|
@@ -296958,7 +297101,7 @@ import {
|
|
|
296958
297101
|
writeFileSync as writeFileSync9
|
|
296959
297102
|
} from "fs";
|
|
296960
297103
|
import { dirname as dirname14, resolve as resolve15 } from "path";
|
|
296961
|
-
import { randomUUID as
|
|
297104
|
+
import { randomUUID as randomUUID13 } from "crypto";
|
|
296962
297105
|
import { z as z68 } from "zod";
|
|
296963
297106
|
var TraceOptionsSchema = z68.object({
|
|
296964
297107
|
full: z68.boolean().default(false),
|
|
@@ -296986,7 +297129,7 @@ function runTraceExport(cwd, sessionId, options = {}) {
|
|
|
296986
297129
|
} else {
|
|
296987
297130
|
mkdirSync8(directory, { recursive: true });
|
|
296988
297131
|
}
|
|
296989
|
-
const temporaryPath = `${outputPath}.${process.pid}.${
|
|
297132
|
+
const temporaryPath = `${outputPath}.${process.pid}.${randomUUID13()}.tmp`;
|
|
296990
297133
|
try {
|
|
296991
297134
|
writeFileSync9(temporaryPath, serialized, {
|
|
296992
297135
|
encoding: "utf8",
|
|
@@ -297013,7 +297156,7 @@ import {
|
|
|
297013
297156
|
writeFileSync as writeFileSync10
|
|
297014
297157
|
} from "fs";
|
|
297015
297158
|
import { basename as basename5, dirname as dirname15, join as join19 } from "path";
|
|
297016
|
-
import { randomUUID as
|
|
297159
|
+
import { randomUUID as randomUUID14 } from "crypto";
|
|
297017
297160
|
import { promisify as promisify5 } from "util";
|
|
297018
297161
|
import picocolors25 from "picocolors";
|
|
297019
297162
|
import { parse as parseYaml4 } from "yaml";
|
|
@@ -297352,7 +297495,7 @@ function writeJsonAtomically2(filePath, value) {
|
|
|
297352
297495
|
} else {
|
|
297353
297496
|
mkdirSync9(directory, { recursive: true });
|
|
297354
297497
|
}
|
|
297355
|
-
const temporaryPath = `${filePath}.${process.pid}.${
|
|
297498
|
+
const temporaryPath = `${filePath}.${process.pid}.${randomUUID14()}.tmp`;
|
|
297356
297499
|
try {
|
|
297357
297500
|
writeFileSync10(temporaryPath, JSON.stringify(value, null, 2), {
|
|
297358
297501
|
encoding: "utf8",
|
|
@@ -297679,7 +297822,7 @@ import {
|
|
|
297679
297822
|
rmSync as rmSync10,
|
|
297680
297823
|
writeFileSync as writeFileSync11
|
|
297681
297824
|
} from "fs";
|
|
297682
|
-
import { createHash as createHash9, randomUUID as
|
|
297825
|
+
import { createHash as createHash9, randomUUID as randomUUID15 } from "crypto";
|
|
297683
297826
|
import { dirname as dirname16, isAbsolute as isAbsolute8, join as join21, relative as relative9, resolve as resolve18, sep as sep2 } from "path";
|
|
297684
297827
|
import { z as z74 } from "zod";
|
|
297685
297828
|
var MAX_BACKUP_BYTES = 64 * 1024 * 1024;
|
|
@@ -297790,7 +297933,7 @@ function createProjectBackup(projectDirectory) {
|
|
|
297790
297933
|
function writeProjectBackup(outputPath, bundle) {
|
|
297791
297934
|
const destination = resolve18(outputPath);
|
|
297792
297935
|
mkdirSync10(dirname16(destination), { recursive: true });
|
|
297793
|
-
const temporaryPath = `${destination}.${process.pid}.${
|
|
297936
|
+
const temporaryPath = `${destination}.${process.pid}.${randomUUID15()}.tmp`;
|
|
297794
297937
|
try {
|
|
297795
297938
|
writeFileSync11(
|
|
297796
297939
|
temporaryPath,
|
|
@@ -297836,7 +297979,7 @@ function restoreProjectBackup(projectDirectory, bundle, options = {}) {
|
|
|
297836
297979
|
for (const { file, destination } of planned) {
|
|
297837
297980
|
assertDirectoryChainHasNoSymlink(orbitRoot, dirname16(destination));
|
|
297838
297981
|
mkdirSync10(dirname16(destination), { recursive: true });
|
|
297839
|
-
const temporaryPath = `${destination}.${process.pid}.${
|
|
297982
|
+
const temporaryPath = `${destination}.${process.pid}.${randomUUID15()}.tmp`;
|
|
297840
297983
|
try {
|
|
297841
297984
|
writeFileSync11(temporaryPath, Buffer.from(file.content, "base64"), {
|
|
297842
297985
|
mode: 384
|
|
@@ -297928,7 +298071,7 @@ function replaceFileAtomically2(temporaryPath, destination) {
|
|
|
297928
298071
|
renameSync8(temporaryPath, destination);
|
|
297929
298072
|
return;
|
|
297930
298073
|
}
|
|
297931
|
-
const previousPath = `${destination}.${process.pid}.${
|
|
298074
|
+
const previousPath = `${destination}.${process.pid}.${randomUUID15()}.bak`;
|
|
297932
298075
|
renameSync8(destination, previousPath);
|
|
297933
298076
|
try {
|
|
297934
298077
|
renameSync8(temporaryPath, destination);
|
|
@@ -298054,7 +298197,7 @@ import {
|
|
|
298054
298197
|
rmSync as rmSync11,
|
|
298055
298198
|
writeFileSync as writeFileSync12
|
|
298056
298199
|
} from "fs";
|
|
298057
|
-
import { randomUUID as
|
|
298200
|
+
import { randomUUID as randomUUID16 } from "crypto";
|
|
298058
298201
|
import { dirname as dirname17, isAbsolute as isAbsolute9, join as join26, relative as relative10, resolve as resolve20, sep as sep3 } from "path";
|
|
298059
298202
|
import { homedir as homedir12 } from "os";
|
|
298060
298203
|
import { z as z76 } from "zod";
|
|
@@ -298106,9 +298249,9 @@ var ExtensionManager = class {
|
|
|
298106
298249
|
const target = join26(this.extensionsDir, manifest.id);
|
|
298107
298250
|
const staging = join26(
|
|
298108
298251
|
this.extensionsDir,
|
|
298109
|
-
`.install-${manifest.id}-${
|
|
298252
|
+
`.install-${manifest.id}-${randomUUID16()}`
|
|
298110
298253
|
);
|
|
298111
|
-
const transactionId =
|
|
298254
|
+
const transactionId = randomUUID16();
|
|
298112
298255
|
const targetBackup = join26(
|
|
298113
298256
|
this.extensionsDir,
|
|
298114
298257
|
`.rollback-${manifest.id}-${transactionId}`
|
|
@@ -298219,7 +298362,7 @@ var ExtensionManager = class {
|
|
|
298219
298362
|
if (!installed) return false;
|
|
298220
298363
|
const rollbackRoot = join26(
|
|
298221
298364
|
this.orbitDir,
|
|
298222
|
-
`.extension-remove-rollback-${id}-${
|
|
298365
|
+
`.extension-remove-rollback-${id}-${randomUUID16()}`
|
|
298223
298366
|
);
|
|
298224
298367
|
const targets = [
|
|
298225
298368
|
{ target: installed.path, backup: join26(rollbackRoot, "package") },
|
|
@@ -298525,7 +298668,7 @@ function removeExtension(id) {
|
|
|
298525
298668
|
}
|
|
298526
298669
|
|
|
298527
298670
|
// src/index.ts
|
|
298528
|
-
import { existsSync as existsSync31, realpathSync as realpathSync5, statSync as
|
|
298671
|
+
import { existsSync as existsSync31, realpathSync as realpathSync5, statSync as statSync6 } from "fs";
|
|
298529
298672
|
import { resolve as resolve21 } from "path";
|
|
298530
298673
|
|
|
298531
298674
|
// src/runtime/CliRunOverrides.ts
|
|
@@ -298755,7 +298898,7 @@ program.command("webui").description("start Orbit as a browser-first local codin
|
|
|
298755
298898
|
fullAccess: !!options.yes
|
|
298756
298899
|
});
|
|
298757
298900
|
const requestedCwd = resolve21(localOptions.cwd || process.cwd());
|
|
298758
|
-
if (!existsSync31(requestedCwd) || !
|
|
298901
|
+
if (!existsSync31(requestedCwd) || !statSync6(requestedCwd).isDirectory()) {
|
|
298759
298902
|
throw new Error(
|
|
298760
298903
|
`Web UI project directory does not exist: ${requestedCwd}`
|
|
298761
298904
|
);
|