@orbit-build/cli 0.5.5 → 0.5.7
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 +4 -0
- package/commands/cumcm-draft.md +11 -0
- package/commands/math-draft.md +4 -8
- package/dist/index.js +671 -397
- 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 {
|
|
@@ -242916,10 +242916,7 @@ var DeepSeekAnthropicProvider = class {
|
|
|
242916
242916
|
}
|
|
242917
242917
|
}
|
|
242918
242918
|
const chatController = new AbortController();
|
|
242919
|
-
const chatSignal = chatController.signal;
|
|
242920
|
-
const onExternalAbort = () => {
|
|
242921
|
-
chatController.abort();
|
|
242922
|
-
};
|
|
242919
|
+
const chatSignal = input.abortSignal ? AbortSignal.any([chatController.signal, input.abortSignal]) : chatController.signal;
|
|
242923
242920
|
if (input.abortSignal) {
|
|
242924
242921
|
if (input.abortSignal.aborted) {
|
|
242925
242922
|
yield {
|
|
@@ -242931,7 +242928,6 @@ var DeepSeekAnthropicProvider = class {
|
|
|
242931
242928
|
};
|
|
242932
242929
|
return;
|
|
242933
242930
|
}
|
|
242934
|
-
input.abortSignal.addEventListener("abort", onExternalAbort);
|
|
242935
242931
|
}
|
|
242936
242932
|
let response;
|
|
242937
242933
|
try {
|
|
@@ -242947,9 +242943,6 @@ var DeepSeekAnthropicProvider = class {
|
|
|
242947
242943
|
this.options.maxRetries ?? 2
|
|
242948
242944
|
);
|
|
242949
242945
|
} catch (error) {
|
|
242950
|
-
if (input.abortSignal) {
|
|
242951
|
-
input.abortSignal.removeEventListener("abort", onExternalAbort);
|
|
242952
|
-
}
|
|
242953
242946
|
yield {
|
|
242954
242947
|
type: "error",
|
|
242955
242948
|
error: sanitizeProviderError(error, [key])
|
|
@@ -242967,9 +242960,6 @@ var DeepSeekAnthropicProvider = class {
|
|
|
242967
242960
|
[key]
|
|
242968
242961
|
)
|
|
242969
242962
|
};
|
|
242970
|
-
if (input.abortSignal) {
|
|
242971
|
-
input.abortSignal.removeEventListener("abort", onExternalAbort);
|
|
242972
|
-
}
|
|
242973
242963
|
return;
|
|
242974
242964
|
}
|
|
242975
242965
|
if (!body.stream) {
|
|
@@ -242985,9 +242975,6 @@ var DeepSeekAnthropicProvider = class {
|
|
|
242985
242975
|
`Invalid Anthropic-compatible response: ${sanitizeProviderErrorText(toError(error).message, [key])}`
|
|
242986
242976
|
)
|
|
242987
242977
|
};
|
|
242988
|
-
if (input.abortSignal) {
|
|
242989
|
-
input.abortSignal.removeEventListener("abort", onExternalAbort);
|
|
242990
|
-
}
|
|
242991
242978
|
return;
|
|
242992
242979
|
}
|
|
242993
242980
|
if (isDeepSeekV4) {
|
|
@@ -242998,9 +242985,6 @@ var DeepSeekAnthropicProvider = class {
|
|
|
242998
242985
|
);
|
|
242999
242986
|
} catch (error) {
|
|
243000
242987
|
yield { type: "error", error: toError(error) };
|
|
243001
|
-
if (input.abortSignal) {
|
|
243002
|
-
input.abortSignal.removeEventListener("abort", onExternalAbort);
|
|
243003
|
-
}
|
|
243004
242988
|
return;
|
|
243005
242989
|
}
|
|
243006
242990
|
}
|
|
@@ -243040,16 +243024,10 @@ var DeepSeekAnthropicProvider = class {
|
|
|
243040
243024
|
} else {
|
|
243041
243025
|
yield { type: "done" };
|
|
243042
243026
|
}
|
|
243043
|
-
if (input.abortSignal) {
|
|
243044
|
-
input.abortSignal.removeEventListener("abort", onExternalAbort);
|
|
243045
|
-
}
|
|
243046
243027
|
return;
|
|
243047
243028
|
}
|
|
243048
243029
|
const reader = response.body?.getReader();
|
|
243049
243030
|
if (!reader) {
|
|
243050
|
-
if (input.abortSignal) {
|
|
243051
|
-
input.abortSignal.removeEventListener("abort", onExternalAbort);
|
|
243052
|
-
}
|
|
243053
243031
|
yield {
|
|
243054
243032
|
type: "error",
|
|
243055
243033
|
error: new Error("Response body is not readable")
|
|
@@ -243277,9 +243255,6 @@ var DeepSeekAnthropicProvider = class {
|
|
|
243277
243255
|
};
|
|
243278
243256
|
} finally {
|
|
243279
243257
|
if (streamTimeoutId) clearTimeout(streamTimeoutId);
|
|
243280
|
-
if (input.abortSignal) {
|
|
243281
|
-
input.abortSignal.removeEventListener("abort", onExternalAbort);
|
|
243282
|
-
}
|
|
243283
243258
|
await reader.cancel().catch(() => {
|
|
243284
243259
|
});
|
|
243285
243260
|
reader.releaseLock();
|
|
@@ -244402,10 +244377,7 @@ var DeepSeekOpenAIProvider = class {
|
|
|
244402
244377
|
delete body.response_format;
|
|
244403
244378
|
}
|
|
244404
244379
|
const chatController = new AbortController();
|
|
244405
|
-
const chatSignal = chatController.signal;
|
|
244406
|
-
const onExternalAbort = () => {
|
|
244407
|
-
chatController.abort();
|
|
244408
|
-
};
|
|
244380
|
+
const chatSignal = input.abortSignal ? AbortSignal.any([chatController.signal, input.abortSignal]) : chatController.signal;
|
|
244409
244381
|
if (input.abortSignal) {
|
|
244410
244382
|
if (input.abortSignal.aborted) {
|
|
244411
244383
|
yield {
|
|
@@ -244417,7 +244389,6 @@ var DeepSeekOpenAIProvider = class {
|
|
|
244417
244389
|
};
|
|
244418
244390
|
return;
|
|
244419
244391
|
}
|
|
244420
|
-
input.abortSignal.addEventListener("abort", onExternalAbort);
|
|
244421
244392
|
}
|
|
244422
244393
|
let response;
|
|
244423
244394
|
try {
|
|
@@ -244433,9 +244404,6 @@ var DeepSeekOpenAIProvider = class {
|
|
|
244433
244404
|
this.options.maxRetries ?? 2
|
|
244434
244405
|
);
|
|
244435
244406
|
} catch (error) {
|
|
244436
|
-
if (input.abortSignal) {
|
|
244437
|
-
input.abortSignal.removeEventListener("abort", onExternalAbort);
|
|
244438
|
-
}
|
|
244439
244407
|
yield {
|
|
244440
244408
|
type: "error",
|
|
244441
244409
|
error: sanitizeProviderError(error, [key])
|
|
@@ -244448,9 +244416,6 @@ var DeepSeekOpenAIProvider = class {
|
|
|
244448
244416
|
type: "error",
|
|
244449
244417
|
error: providerHttpError("DeepSeek", response.status, errText, [key])
|
|
244450
244418
|
};
|
|
244451
|
-
if (input.abortSignal) {
|
|
244452
|
-
input.abortSignal.removeEventListener("abort", onExternalAbort);
|
|
244453
|
-
}
|
|
244454
244419
|
return;
|
|
244455
244420
|
}
|
|
244456
244421
|
if (!body.stream) {
|
|
@@ -244466,9 +244431,6 @@ var DeepSeekOpenAIProvider = class {
|
|
|
244466
244431
|
`Invalid OpenAI-compatible response: ${sanitizeProviderErrorText(toError(error).message, [key])}`
|
|
244467
244432
|
)
|
|
244468
244433
|
};
|
|
244469
|
-
if (input.abortSignal) {
|
|
244470
|
-
input.abortSignal.removeEventListener("abort", onExternalAbort);
|
|
244471
|
-
}
|
|
244472
244434
|
return;
|
|
244473
244435
|
}
|
|
244474
244436
|
if (data.error) {
|
|
@@ -244478,9 +244440,6 @@ var DeepSeekOpenAIProvider = class {
|
|
|
244478
244440
|
`DeepSeek API error: ${sanitizeProviderErrorText(data.error.message, [key])}`
|
|
244479
244441
|
)
|
|
244480
244442
|
};
|
|
244481
|
-
if (input.abortSignal) {
|
|
244482
|
-
input.abortSignal.removeEventListener("abort", onExternalAbort);
|
|
244483
|
-
}
|
|
244484
244443
|
return;
|
|
244485
244444
|
}
|
|
244486
244445
|
const choice = data.choices?.[0];
|
|
@@ -244489,9 +244448,6 @@ var DeepSeekOpenAIProvider = class {
|
|
|
244489
244448
|
type: "error",
|
|
244490
244449
|
error: new Error("DeepSeek returned no completion choice.")
|
|
244491
244450
|
};
|
|
244492
|
-
if (input.abortSignal) {
|
|
244493
|
-
input.abortSignal.removeEventListener("abort", onExternalAbort);
|
|
244494
|
-
}
|
|
244495
244451
|
return;
|
|
244496
244452
|
}
|
|
244497
244453
|
if (isDeepSeekV4) {
|
|
@@ -244502,9 +244458,6 @@ var DeepSeekOpenAIProvider = class {
|
|
|
244502
244458
|
);
|
|
244503
244459
|
} catch (error) {
|
|
244504
244460
|
yield { type: "error", error: toError(error) };
|
|
244505
|
-
if (input.abortSignal) {
|
|
244506
|
-
input.abortSignal.removeEventListener("abort", onExternalAbort);
|
|
244507
|
-
}
|
|
244508
244461
|
return;
|
|
244509
244462
|
}
|
|
244510
244463
|
}
|
|
@@ -244526,9 +244479,6 @@ var DeepSeekOpenAIProvider = class {
|
|
|
244526
244479
|
type: "error",
|
|
244527
244480
|
error: sanitizeProviderError(error, [key])
|
|
244528
244481
|
};
|
|
244529
|
-
if (input.abortSignal) {
|
|
244530
|
-
input.abortSignal.removeEventListener("abort", onExternalAbort);
|
|
244531
|
-
}
|
|
244532
244482
|
return;
|
|
244533
244483
|
}
|
|
244534
244484
|
yield {
|
|
@@ -244575,16 +244525,10 @@ var DeepSeekOpenAIProvider = class {
|
|
|
244575
244525
|
} else {
|
|
244576
244526
|
yield { type: "done" };
|
|
244577
244527
|
}
|
|
244578
|
-
if (input.abortSignal) {
|
|
244579
|
-
input.abortSignal.removeEventListener("abort", onExternalAbort);
|
|
244580
|
-
}
|
|
244581
244528
|
return;
|
|
244582
244529
|
}
|
|
244583
244530
|
const reader = response.body?.getReader();
|
|
244584
244531
|
if (!reader) {
|
|
244585
|
-
if (input.abortSignal) {
|
|
244586
|
-
input.abortSignal.removeEventListener("abort", onExternalAbort);
|
|
244587
|
-
}
|
|
244588
244532
|
yield {
|
|
244589
244533
|
type: "error",
|
|
244590
244534
|
error: new Error("Response body is not readable")
|
|
@@ -244829,9 +244773,6 @@ var DeepSeekOpenAIProvider = class {
|
|
|
244829
244773
|
};
|
|
244830
244774
|
} finally {
|
|
244831
244775
|
if (streamTimeoutId) clearTimeout(streamTimeoutId);
|
|
244832
|
-
if (input.abortSignal) {
|
|
244833
|
-
input.abortSignal.removeEventListener("abort", onExternalAbort);
|
|
244834
|
-
}
|
|
244835
244776
|
await reader.cancel().catch(() => {
|
|
244836
244777
|
});
|
|
244837
244778
|
reader.releaseLock();
|
|
@@ -248341,20 +248282,20 @@ function readProcessFailureMessage(result) {
|
|
|
248341
248282
|
const message2 = typeof record.shortMessage === "string" ? record.shortMessage : typeof record.message === "string" ? record.message : "The child process failed.";
|
|
248342
248283
|
return safeProcessFailureMessage(message2);
|
|
248343
248284
|
}
|
|
248344
|
-
function firstExistingPath(candidates,
|
|
248285
|
+
function firstExistingPath(candidates, pathExists = existsSync6) {
|
|
248345
248286
|
for (const candidate of candidates) {
|
|
248346
|
-
if (candidate &&
|
|
248287
|
+
if (candidate && pathExists(candidate)) return candidate;
|
|
248347
248288
|
}
|
|
248348
248289
|
return null;
|
|
248349
248290
|
}
|
|
248350
248291
|
function resolveCommandShellInvocation(command, options = {}) {
|
|
248351
248292
|
const platform = options.platform ?? process.platform;
|
|
248352
248293
|
const environment = options.environment ?? process.env;
|
|
248353
|
-
const
|
|
248294
|
+
const pathExists = options.pathExists ?? existsSync6;
|
|
248354
248295
|
if (platform !== "win32") {
|
|
248355
248296
|
const bash2 = firstExistingPath(
|
|
248356
248297
|
[environment.ORBIT_BASH_PATH, "/bin/bash", "/usr/bin/bash"],
|
|
248357
|
-
|
|
248298
|
+
pathExists
|
|
248358
248299
|
);
|
|
248359
248300
|
if (bash2) {
|
|
248360
248301
|
return {
|
|
@@ -248375,7 +248316,7 @@ function resolveCommandShellInvocation(command, options = {}) {
|
|
|
248375
248316
|
environment.LOCALAPPDATA ? join32(environment.LOCALAPPDATA, "Programs", "Git", "bin", "bash.exe") : void 0,
|
|
248376
248317
|
environment.LOCALAPPDATA ? join32(environment.LOCALAPPDATA, "hermes", "git", "bin", "bash.exe") : void 0
|
|
248377
248318
|
],
|
|
248378
|
-
|
|
248319
|
+
pathExists
|
|
248379
248320
|
);
|
|
248380
248321
|
if (bash) {
|
|
248381
248322
|
return {
|
|
@@ -253450,7 +253391,7 @@ var ContextPackBuilder = class {
|
|
|
253450
253391
|
};
|
|
253451
253392
|
|
|
253452
253393
|
// ../core/dist/index.js
|
|
253453
|
-
import { randomUUID as
|
|
253394
|
+
import { randomUUID as randomUUID7 } from "crypto";
|
|
253454
253395
|
import { EventEmitter } from "events";
|
|
253455
253396
|
import { z as z38 } from "zod";
|
|
253456
253397
|
import { z as z83 } from "zod";
|
|
@@ -255970,12 +255911,19 @@ import { createCipheriv, createDecipheriv, randomBytes as randomBytes2 } from "c
|
|
|
255970
255911
|
import { z as z28 } from "zod";
|
|
255971
255912
|
import { randomBytes as randomBytes22 } from "crypto";
|
|
255972
255913
|
import {
|
|
255914
|
+
closeSync as closeSync3,
|
|
255973
255915
|
existsSync as existsSync25,
|
|
255916
|
+
fsyncSync as fsyncSync3,
|
|
255974
255917
|
lstatSync as lstatSync22,
|
|
255975
255918
|
mkdirSync as mkdirSync22,
|
|
255919
|
+
openSync as openSync3,
|
|
255920
|
+
renameSync as renameSync22,
|
|
255921
|
+
rmSync as rmSync22,
|
|
255922
|
+
statSync,
|
|
255976
255923
|
unlinkSync as unlinkSync3,
|
|
255977
255924
|
writeFileSync as writeFileSync6
|
|
255978
255925
|
} from "fs";
|
|
255926
|
+
import { randomUUID as randomUUID5 } from "crypto";
|
|
255979
255927
|
import { dirname as dirname7 } from "path";
|
|
255980
255928
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
255981
255929
|
import fs4 from "fs";
|
|
@@ -256340,7 +256288,43 @@ var RollbackManager = class {
|
|
|
256340
256288
|
}
|
|
256341
256289
|
mkdirSync22(dirname7(safePath), { recursive: true });
|
|
256342
256290
|
safePath = resolveSafePath(this.cwd, path24);
|
|
256343
|
-
|
|
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
|
+
}
|
|
256344
256328
|
}
|
|
256345
256329
|
};
|
|
256346
256330
|
function isFileSystemError2(error, code) {
|
|
@@ -256620,16 +256604,16 @@ function toErrorMessage2(error) {
|
|
|
256620
256604
|
|
|
256621
256605
|
// ../session/dist/index.js
|
|
256622
256606
|
import { z as z29 } from "zod";
|
|
256623
|
-
import { createHash as createHash5, randomUUID as
|
|
256607
|
+
import { createHash as createHash5, randomUUID as randomUUID6 } from "crypto";
|
|
256624
256608
|
import { dirname as dirname8, isAbsolute as isAbsolute4, join as join9, relative as relative4, resolve as resolve7, sep } from "path";
|
|
256625
256609
|
import {
|
|
256626
256610
|
appendFileSync,
|
|
256627
|
-
closeSync as
|
|
256611
|
+
closeSync as closeSync4,
|
|
256628
256612
|
existsSync as existsSync10,
|
|
256629
|
-
fsyncSync as
|
|
256613
|
+
fsyncSync as fsyncSync4,
|
|
256630
256614
|
lstatSync as lstatSync5,
|
|
256631
256615
|
mkdirSync as mkdirSync5,
|
|
256632
|
-
openSync as
|
|
256616
|
+
openSync as openSync4,
|
|
256633
256617
|
readdirSync as readdirSync3,
|
|
256634
256618
|
renameSync as renameSync5,
|
|
256635
256619
|
rmSync as rmSync4,
|
|
@@ -256641,7 +256625,7 @@ import {
|
|
|
256641
256625
|
lstatSync as lstatSync23,
|
|
256642
256626
|
openSync as openSync22,
|
|
256643
256627
|
realpathSync as realpathSync2,
|
|
256644
|
-
statSync,
|
|
256628
|
+
statSync as statSync2,
|
|
256645
256629
|
unlinkSync as unlinkSync4
|
|
256646
256630
|
} from "fs";
|
|
256647
256631
|
import { homedir as homedir5 } from "os";
|
|
@@ -256991,13 +256975,13 @@ function writeJsonAtomically(filePath, value, schema) {
|
|
|
256991
256975
|
if (serialized === void 0) {
|
|
256992
256976
|
throw new Error(`Unable to serialize JSON for ${filePath}.`);
|
|
256993
256977
|
}
|
|
256994
|
-
const temporaryPath = `${filePath}.${process.pid}.${
|
|
256978
|
+
const temporaryPath = `${filePath}.${process.pid}.${randomUUID6()}.tmp`;
|
|
256995
256979
|
let temporaryFd;
|
|
256996
256980
|
try {
|
|
256997
|
-
temporaryFd =
|
|
256981
|
+
temporaryFd = openSync4(temporaryPath, "wx", PRIVATE_FILE_MODE2);
|
|
256998
256982
|
writeFileSync7(temporaryFd, serialized, { encoding: "utf8" });
|
|
256999
|
-
|
|
257000
|
-
|
|
256983
|
+
fsyncSync4(temporaryFd);
|
|
256984
|
+
closeSync4(temporaryFd);
|
|
257001
256985
|
temporaryFd = void 0;
|
|
257002
256986
|
preserveLastKnownGoodFile(filePath, schema);
|
|
257003
256987
|
replaceFileAtomically(temporaryPath, filePath);
|
|
@@ -257005,7 +256989,7 @@ function writeJsonAtomically(filePath, value, schema) {
|
|
|
257005
256989
|
} finally {
|
|
257006
256990
|
if (temporaryFd !== void 0) {
|
|
257007
256991
|
try {
|
|
257008
|
-
|
|
256992
|
+
closeSync4(temporaryFd);
|
|
257009
256993
|
} catch {
|
|
257010
256994
|
}
|
|
257011
256995
|
}
|
|
@@ -257019,13 +257003,13 @@ function syncParentDirectory(filePath) {
|
|
|
257019
257003
|
if (process.platform === "win32") return;
|
|
257020
257004
|
let directoryFd;
|
|
257021
257005
|
try {
|
|
257022
|
-
directoryFd =
|
|
257023
|
-
|
|
257006
|
+
directoryFd = openSync4(dirname8(filePath), "r");
|
|
257007
|
+
fsyncSync4(directoryFd);
|
|
257024
257008
|
} catch {
|
|
257025
257009
|
} finally {
|
|
257026
257010
|
if (directoryFd !== void 0) {
|
|
257027
257011
|
try {
|
|
257028
|
-
|
|
257012
|
+
closeSync4(directoryFd);
|
|
257029
257013
|
} catch {
|
|
257030
257014
|
}
|
|
257031
257015
|
}
|
|
@@ -257035,19 +257019,19 @@ function preserveLastKnownGoodFile(filePath, schema) {
|
|
|
257035
257019
|
const previous = readValidatedSnapshot(filePath, schema);
|
|
257036
257020
|
if (previous === void 0) return;
|
|
257037
257021
|
const backupPath = `${filePath}.bak`;
|
|
257038
|
-
const temporaryBackupPath = `${backupPath}.${process.pid}.${
|
|
257022
|
+
const temporaryBackupPath = `${backupPath}.${process.pid}.${randomUUID6()}.tmp`;
|
|
257039
257023
|
let descriptor;
|
|
257040
257024
|
try {
|
|
257041
|
-
descriptor =
|
|
257025
|
+
descriptor = openSync4(temporaryBackupPath, "wx", PRIVATE_FILE_MODE2);
|
|
257042
257026
|
writeFileSync7(descriptor, JSON.stringify(previous, null, 2), "utf8");
|
|
257043
|
-
|
|
257044
|
-
|
|
257027
|
+
fsyncSync4(descriptor);
|
|
257028
|
+
closeSync4(descriptor);
|
|
257045
257029
|
descriptor = void 0;
|
|
257046
257030
|
replaceFileAtomically(temporaryBackupPath, backupPath);
|
|
257047
257031
|
} finally {
|
|
257048
257032
|
if (descriptor !== void 0) {
|
|
257049
257033
|
try {
|
|
257050
|
-
|
|
257034
|
+
closeSync4(descriptor);
|
|
257051
257035
|
} catch {
|
|
257052
257036
|
}
|
|
257053
257037
|
}
|
|
@@ -257065,7 +257049,7 @@ function replaceFileAtomically(temporaryPath, destinationPath) {
|
|
|
257065
257049
|
const code = typeof error === "object" && error !== null && "code" in error && typeof error.code === "string" ? error.code : "";
|
|
257066
257050
|
if (!["EPERM", "EEXIST", "ENOTEMPTY"].includes(code)) throw error;
|
|
257067
257051
|
}
|
|
257068
|
-
const backupPath = `${destinationPath}.${process.pid}.${
|
|
257052
|
+
const backupPath = `${destinationPath}.${process.pid}.${randomUUID6()}.bak`;
|
|
257069
257053
|
let previousMoved = false;
|
|
257070
257054
|
try {
|
|
257071
257055
|
if (existsSync10(destinationPath)) {
|
|
@@ -257622,41 +257606,40 @@ var SessionManager = class {
|
|
|
257622
257606
|
resumeSession(id) {
|
|
257623
257607
|
const session = this.store.getSession(id);
|
|
257624
257608
|
this.recoveryReport = void 0;
|
|
257625
|
-
if (session)
|
|
257626
|
-
|
|
257627
|
-
|
|
257628
|
-
|
|
257629
|
-
|
|
257630
|
-
|
|
257631
|
-
|
|
257632
|
-
|
|
257633
|
-
|
|
257634
|
-
|
|
257635
|
-
|
|
257636
|
-
|
|
257637
|
-
|
|
257638
|
-
|
|
257639
|
-
|
|
257640
|
-
|
|
257641
|
-
|
|
257642
|
-
|
|
257643
|
-
|
|
257644
|
-
|
|
257645
|
-
|
|
257646
|
-
|
|
257647
|
-
|
|
257648
|
-
|
|
257649
|
-
|
|
257650
|
-
|
|
257651
|
-
|
|
257652
|
-
});
|
|
257653
|
-
}
|
|
257654
|
-
this.logEvent("session_resume", {
|
|
257655
|
-
id,
|
|
257656
|
-
recoverable,
|
|
257657
|
-
recovery: this.recoveryReport || null
|
|
257609
|
+
if (!session) return void 0;
|
|
257610
|
+
this.currentSession = { ...session, status: "active" };
|
|
257611
|
+
this.store.updateSession(this.currentSession);
|
|
257612
|
+
const previousRun = this.store.getRunJournal(id);
|
|
257613
|
+
const recoverable = previousRun?.state === "running" || previousRun?.state === "awaiting_approval" || previousRun?.state === "verifying";
|
|
257614
|
+
if (recoverable && previousRun) {
|
|
257615
|
+
const recoveredAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
257616
|
+
const repairedToolCalls = this.repairInterruptedToolCalls(recoveredAt);
|
|
257617
|
+
const resetPlanItems = this.resetInterruptedPlanItems(recoveredAt);
|
|
257618
|
+
const recoveryCount = previousRun.recoveryCount + 1;
|
|
257619
|
+
this.store.saveRunJournal(id, {
|
|
257620
|
+
...previousRun,
|
|
257621
|
+
state: "interrupted",
|
|
257622
|
+
phase: `Recovered after interruption during ${previousRun.phase}`,
|
|
257623
|
+
activeToolCallId: void 0,
|
|
257624
|
+
updatedAt: recoveredAt,
|
|
257625
|
+
recoveryCount
|
|
257626
|
+
});
|
|
257627
|
+
this.recoveryReport = SessionRecoveryReportSchema.parse({
|
|
257628
|
+
sessionId: id,
|
|
257629
|
+
previousState: previousRun.state,
|
|
257630
|
+
previousPhase: previousRun.phase,
|
|
257631
|
+
attempt: previousRun.attempt,
|
|
257632
|
+
recoveryCount,
|
|
257633
|
+
repairedToolCalls,
|
|
257634
|
+
resetPlanItems,
|
|
257635
|
+
recoveredAt
|
|
257658
257636
|
});
|
|
257659
257637
|
}
|
|
257638
|
+
this.logEvent("session_resume", {
|
|
257639
|
+
id,
|
|
257640
|
+
recoverable,
|
|
257641
|
+
recovery: this.recoveryReport || null
|
|
257642
|
+
});
|
|
257660
257643
|
return this.currentSession;
|
|
257661
257644
|
}
|
|
257662
257645
|
getActiveSession() {
|
|
@@ -257995,7 +257978,7 @@ var ProjectRecordSchema = z210.object({
|
|
|
257995
257978
|
name: z210.string().trim().min(1).max(200),
|
|
257996
257979
|
createdAt: z210.string().datetime(),
|
|
257997
257980
|
lastOpenedAt: z210.string().datetime(),
|
|
257998
|
-
lastSessionId: z210.string().min(1).optional(),
|
|
257981
|
+
lastSessionId: z210.string().min(1).max(1e3).optional(),
|
|
257999
257982
|
archivedAt: z210.string().datetime().optional()
|
|
258000
257983
|
});
|
|
258001
257984
|
var ProjectRegistrySnapshotSchema = z210.object({
|
|
@@ -258198,7 +258181,7 @@ function projectIdentity(projectPath) {
|
|
|
258198
258181
|
}
|
|
258199
258182
|
function isDirectory(targetPath) {
|
|
258200
258183
|
try {
|
|
258201
|
-
return
|
|
258184
|
+
return statSync2(targetPath).isDirectory();
|
|
258202
258185
|
} catch {
|
|
258203
258186
|
return false;
|
|
258204
258187
|
}
|
|
@@ -258299,6 +258282,7 @@ var AgentRunStore = class {
|
|
|
258299
258282
|
processAlive;
|
|
258300
258283
|
initialized = false;
|
|
258301
258284
|
initialize() {
|
|
258285
|
+
this.assertRunDirectoryWithinWorkspace();
|
|
258302
258286
|
mkdirSync23(this.directory, { recursive: true, mode: 448 });
|
|
258303
258287
|
this.assertRunDirectorySafe();
|
|
258304
258288
|
this.initialized = true;
|
|
@@ -258414,7 +258398,7 @@ var AgentRunStore = class {
|
|
|
258414
258398
|
this.assertInitialized();
|
|
258415
258399
|
let recovered = 0;
|
|
258416
258400
|
const now = this.now().toISOString();
|
|
258417
|
-
for (const snapshot of this.
|
|
258401
|
+
for (const snapshot of this.readRuns()) {
|
|
258418
258402
|
if (snapshot.status !== "running") continue;
|
|
258419
258403
|
const didRecover = this.withRunLock(snapshot.id, () => {
|
|
258420
258404
|
const run = this.requireRun(snapshot.id);
|
|
@@ -258538,6 +258522,9 @@ var AgentRunStore = class {
|
|
|
258538
258522
|
return this.read(file);
|
|
258539
258523
|
}
|
|
258540
258524
|
listRuns(limit = 20) {
|
|
258525
|
+
return this.readRuns().slice(0, Math.max(1, Math.min(100, limit)));
|
|
258526
|
+
}
|
|
258527
|
+
readRuns() {
|
|
258541
258528
|
if (!existsSync26(this.directory)) return [];
|
|
258542
258529
|
this.assertRunDirectorySafe();
|
|
258543
258530
|
return readdirSync22(this.directory).filter((name) => /^run_[a-z0-9-]+\.json$/.test(name)).flatMap((name) => {
|
|
@@ -258550,7 +258537,7 @@ var AgentRunStore = class {
|
|
|
258550
258537
|
} catch {
|
|
258551
258538
|
return [];
|
|
258552
258539
|
}
|
|
258553
|
-
}).sort((left, right) => right.updatedAt.localeCompare(left.updatedAt))
|
|
258540
|
+
}).sort((left, right) => right.updatedAt.localeCompare(left.updatedAt));
|
|
258554
258541
|
}
|
|
258555
258542
|
requireRun(runId) {
|
|
258556
258543
|
this.assertInitialized();
|
|
@@ -258594,11 +258581,21 @@ var AgentRunStore = class {
|
|
|
258594
258581
|
}
|
|
258595
258582
|
}
|
|
258596
258583
|
assertRunDirectorySafe() {
|
|
258584
|
+
this.assertRunDirectoryWithinWorkspace();
|
|
258597
258585
|
const stats = lstatSync32(this.directory);
|
|
258598
258586
|
if (stats.isSymbolicLink() || !stats.isDirectory()) {
|
|
258599
258587
|
throw new Error("Orbit agent-run directory must be a real directory.");
|
|
258600
258588
|
}
|
|
258601
258589
|
}
|
|
258590
|
+
assertRunDirectoryWithinWorkspace() {
|
|
258591
|
+
const safeDirectory = resolveSafePath(
|
|
258592
|
+
this.cwd,
|
|
258593
|
+
join34(".orbit", "agent-runs")
|
|
258594
|
+
);
|
|
258595
|
+
if (resolve32(safeDirectory) !== this.directory) {
|
|
258596
|
+
throw new Error("Orbit agent-run directory escaped the workspace.");
|
|
258597
|
+
}
|
|
258598
|
+
}
|
|
258602
258599
|
/** Serialize read-check-write mutations across Orbit processes. */
|
|
258603
258600
|
withRunLock(runId, operation) {
|
|
258604
258601
|
this.assertInitialized();
|
|
@@ -258692,7 +258689,7 @@ import { z as z73 } from "zod";
|
|
|
258692
258689
|
import { z as z103 } from "zod";
|
|
258693
258690
|
import { z as z93 } from "zod";
|
|
258694
258691
|
import path8 from "path";
|
|
258695
|
-
import { existsSync as existsSync34, statSync as
|
|
258692
|
+
import { existsSync as existsSync34, statSync as statSync3 } from "fs";
|
|
258696
258693
|
import { z as z112 } from "zod";
|
|
258697
258694
|
import { z as z122 } from "zod";
|
|
258698
258695
|
function createInitialState(sessionId, task, maxAttempts = 8) {
|
|
@@ -260041,7 +260038,7 @@ var AgentInputQueueController = class {
|
|
|
260041
260038
|
sessions;
|
|
260042
260039
|
enqueue(text2, options) {
|
|
260043
260040
|
const queued = this.sessions.enqueueAgentInput({
|
|
260044
|
-
id: `input_${
|
|
260041
|
+
id: `input_${randomUUID7().replace(/-/g, "")}`,
|
|
260045
260042
|
mode: options.mode,
|
|
260046
260043
|
source: options.source,
|
|
260047
260044
|
text: text2.trim(),
|
|
@@ -261482,15 +261479,81 @@ function workspaceUserId(cwd) {
|
|
|
261482
261479
|
process.platform === "win32" ? workspaceIdentity.toLowerCase() : workspaceIdentity
|
|
261483
261480
|
).digest("hex");
|
|
261484
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
|
+
}
|
|
261485
261553
|
var execPromise2 = promisify3(exec2);
|
|
261486
261554
|
var execFilePromise3 = promisify3(execFile3);
|
|
261487
261555
|
var DEEPSEEK_CACHE_DEGRADED_HIT_RATE = 0.85;
|
|
261488
261556
|
var DEEPSEEK_VERBOSE_CACHE_ENV = "ORBIT_DEEPSEEK_VERBOSE_CACHE";
|
|
261489
|
-
var NETWORK_TOOL_RESULT_MAX_RESULTS = 10;
|
|
261490
|
-
var NETWORK_TOOL_RESULT_SUMMARY_CHARS = 280;
|
|
261491
|
-
var NETWORK_TOOL_RESULT_MAX_CHARS = 6e3;
|
|
261492
|
-
var TOOL_RESULT_MAX_CHARS = 24e3;
|
|
261493
|
-
var TOOL_STATUS_MAX_CHARS = 2e3;
|
|
261494
261557
|
var AGENT_LOOP_ERROR_MESSAGE_MAX_CHARS = 2e3;
|
|
261495
261558
|
var AGENT_EDIT_FILE_MAX_BYTES = 16 * 1024 * 1024;
|
|
261496
261559
|
var AgentLoopExecutionError = class extends Error {
|
|
@@ -261800,75 +261863,6 @@ var AgentLoop = class _AgentLoop {
|
|
|
261800
261863
|
}
|
|
261801
261864
|
return null;
|
|
261802
261865
|
}
|
|
261803
|
-
buildToolResultContent(toolName, result) {
|
|
261804
|
-
const content = result.ok ? this.serializeToolResultData(result.data, result.display) : result.error || "Unknown error";
|
|
261805
|
-
if (!result.ok || toolName !== "web_search") {
|
|
261806
|
-
return this.truncatePlain(
|
|
261807
|
-
redactSecrets(content),
|
|
261808
|
-
result.ok ? TOOL_RESULT_MAX_CHARS : TOOL_STATUS_MAX_CHARS
|
|
261809
|
-
);
|
|
261810
|
-
}
|
|
261811
|
-
return this.compactNetworkToolResult(
|
|
261812
|
-
toolName,
|
|
261813
|
-
redactSecrets(content),
|
|
261814
|
-
redactSecrets(result.display || "")
|
|
261815
|
-
);
|
|
261816
|
-
}
|
|
261817
|
-
serializeToolResultData(data, display) {
|
|
261818
|
-
if (typeof data === "string") return data;
|
|
261819
|
-
if (data === void 0) return display?.trim() || "Done";
|
|
261820
|
-
try {
|
|
261821
|
-
return JSON.stringify(data) ?? String(data);
|
|
261822
|
-
} catch {
|
|
261823
|
-
return String(data);
|
|
261824
|
-
}
|
|
261825
|
-
}
|
|
261826
|
-
compactNetworkToolResult(toolName, content, display) {
|
|
261827
|
-
const normalized = content.replace(/\r\n/g, "\n").trim();
|
|
261828
|
-
const header = display ? `${toolName} result: ${display}` : `${toolName} result`;
|
|
261829
|
-
if (!normalized) {
|
|
261830
|
-
return header;
|
|
261831
|
-
}
|
|
261832
|
-
if (normalized.startsWith("Source: Open-Meteo weather API")) {
|
|
261833
|
-
return this.truncateToolResultText(`${header}
|
|
261834
|
-
${normalized}`);
|
|
261835
|
-
}
|
|
261836
|
-
const parsedResults = this.parseSearchResultBlocks(normalized);
|
|
261837
|
-
if (parsedResults.length === 0) {
|
|
261838
|
-
return this.truncateToolResultText(`${header}
|
|
261839
|
-
${normalized}`);
|
|
261840
|
-
}
|
|
261841
|
-
const keep = parsedResults.slice(0, NETWORK_TOOL_RESULT_MAX_RESULTS);
|
|
261842
|
-
const lines = [
|
|
261843
|
-
`${header}`,
|
|
261844
|
-
`Results kept for reasoning: ${keep.length}/${parsedResults.length}. Use another live lookup only if these results are insufficient or stale.`
|
|
261845
|
-
];
|
|
261846
|
-
for (const result of keep) {
|
|
261847
|
-
lines.push(
|
|
261848
|
-
`[${result.index}] ${result.title}`,
|
|
261849
|
-
`Link: ${result.link}`,
|
|
261850
|
-
`Summary: ${this.truncatePlain(result.summary, NETWORK_TOOL_RESULT_SUMMARY_CHARS)}`
|
|
261851
|
-
);
|
|
261852
|
-
}
|
|
261853
|
-
return this.truncateToolResultText(lines.join("\n"));
|
|
261854
|
-
}
|
|
261855
|
-
parseSearchResultBlocks(content) {
|
|
261856
|
-
const results = [];
|
|
261857
|
-
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;
|
|
261858
|
-
let match;
|
|
261859
|
-
while ((match = regex.exec(content)) !== null) {
|
|
261860
|
-
results.push({
|
|
261861
|
-
index: match[1],
|
|
261862
|
-
title: this.truncatePlain(match[2], 180),
|
|
261863
|
-
link: match[3].trim(),
|
|
261864
|
-
summary: match[4].replace(/\s+/g, " ").trim()
|
|
261865
|
-
});
|
|
261866
|
-
}
|
|
261867
|
-
return results;
|
|
261868
|
-
}
|
|
261869
|
-
truncateToolResultText(text2) {
|
|
261870
|
-
return this.truncatePlain(text2, NETWORK_TOOL_RESULT_MAX_CHARS);
|
|
261871
|
-
}
|
|
261872
261866
|
appendBackgroundTaskNotification(tasks, remainingRunning = 0) {
|
|
261873
261867
|
const message2 = {
|
|
261874
261868
|
id: `msg_background_tasks_${randomUUID52().replace(/-/g, "")}`,
|
|
@@ -261938,11 +261932,6 @@ ${normalized}`);
|
|
|
261938
261932
|
);
|
|
261939
261933
|
return true;
|
|
261940
261934
|
}
|
|
261941
|
-
truncatePlain(text2, maxChars) {
|
|
261942
|
-
if (text2.length <= maxChars) return text2;
|
|
261943
|
-
return `${text2.slice(0, Math.max(0, maxChars - 32)).trimEnd()}
|
|
261944
|
-
... [truncated for context budget]`;
|
|
261945
|
-
}
|
|
261946
261935
|
async run() {
|
|
261947
261936
|
let outcome;
|
|
261948
261937
|
try {
|
|
@@ -264003,7 +263992,7 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
264003
263992
|
}
|
|
264004
263993
|
}
|
|
264005
263994
|
if (finalResult.ok) {
|
|
264006
|
-
const statusText =
|
|
263995
|
+
const statusText = truncateToolText(
|
|
264007
263996
|
redactSecrets(finalResult.display || "Done"),
|
|
264008
263997
|
TOOL_STATUS_MAX_CHARS
|
|
264009
263998
|
);
|
|
@@ -264018,7 +264007,7 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
264018
264007
|
void this.contextBuilder.warmCodebaseRetrieval().catch(() => void 0);
|
|
264019
264008
|
}
|
|
264020
264009
|
} else {
|
|
264021
|
-
const statusError =
|
|
264010
|
+
const statusError = truncateToolText(
|
|
264022
264011
|
redactSecrets(finalResult.error || "Unknown error"),
|
|
264023
264012
|
TOOL_STATUS_MAX_CHARS
|
|
264024
264013
|
);
|
|
@@ -264055,7 +264044,7 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
264055
264044
|
toolResult: {
|
|
264056
264045
|
toolCallId: tc.id,
|
|
264057
264046
|
name: tc.name,
|
|
264058
|
-
content:
|
|
264047
|
+
content: buildToolResultContent(tc.name, finalResult) + (guardNudge ? `
|
|
264059
264048
|
|
|
264060
264049
|
${guardNudge.message}` : ""),
|
|
264061
264050
|
isError: !finalResult.ok
|
|
@@ -265627,7 +265616,7 @@ var Orchestrator = class {
|
|
|
265627
265616
|
worktree = worktrees.createWorktree(worktreeId, {
|
|
265628
265617
|
snapshotWorkingTree: true
|
|
265629
265618
|
});
|
|
265630
|
-
if (!existsSync34(worktree.path) || !
|
|
265619
|
+
if (!existsSync34(worktree.path) || !statSync3(worktree.path).isDirectory()) {
|
|
265631
265620
|
throw new Error(
|
|
265632
265621
|
`Worktree manager returned a missing directory: ${worktree.path}`
|
|
265633
265622
|
);
|
|
@@ -266764,7 +266753,7 @@ function compareProviderBenchmarkResults(results) {
|
|
|
266764
266753
|
}
|
|
266765
266754
|
|
|
266766
266755
|
// src/runtime/ModelCatalog.ts
|
|
266767
|
-
var DEEPSEEK_MODELS = [
|
|
266756
|
+
var DEEPSEEK_MODELS = [DEEPSEEK_V4_FLASH, DEEPSEEK_V4_PRO];
|
|
266768
266757
|
var DEEPSEEK_LEGACY_ALIAS_DEPRECATION = "2026-07-24T15:59:00Z";
|
|
266769
266758
|
var DEEPSEEK_LEGACY_ALIAS_MIGRATIONS = {
|
|
266770
266759
|
"deepseek-chat": { model: "deepseek-v4-flash", thinking: "disabled" },
|
|
@@ -266781,6 +266770,22 @@ var OLLAMA_MODELS = ["qwen2.5-coder:7b", "qwen2.5-coder:1.5b", "llama3"];
|
|
|
266781
266770
|
function uniqueModels(models) {
|
|
266782
266771
|
return Array.from(new Set(models.map((m2) => m2.trim()).filter(Boolean)));
|
|
266783
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
|
+
}
|
|
266784
266789
|
var NON_CHAT_MODEL_KINDS = /* @__PURE__ */ new Set([
|
|
266785
266790
|
"embedding",
|
|
266786
266791
|
"image",
|
|
@@ -266825,6 +266830,10 @@ function getProviderModelCandidates(config, providerId = config?.provider?.defau
|
|
|
266825
266830
|
(model) => isChatModelCandidate(config, providerId, model)
|
|
266826
266831
|
) : [];
|
|
266827
266832
|
if (configuredModels.length > 0) {
|
|
266833
|
+
if (isOfficialDeepSeekProvider(config, providerId)) {
|
|
266834
|
+
const officialModels = normalizeOfficialDeepSeekModels(configuredModels);
|
|
266835
|
+
if (officialModels.length > 0) return officialModels;
|
|
266836
|
+
}
|
|
266828
266837
|
return configuredModels;
|
|
266829
266838
|
}
|
|
266830
266839
|
const providerType = providerConfig?.type;
|
|
@@ -266875,11 +266884,9 @@ function formatModelOptionLabel(model) {
|
|
|
266875
266884
|
if (migration) {
|
|
266876
266885
|
return `${model} (deprecated -> ${migration.model}; thinking ${migration.thinking})`;
|
|
266877
266886
|
}
|
|
266878
|
-
|
|
266879
|
-
|
|
266880
|
-
|
|
266881
|
-
if (lower.includes("deepseek-v4-pro")) {
|
|
266882
|
-
return `${model} (quality / pro; thinking available)`;
|
|
266887
|
+
const deepSeekProfile = getDeepSeekV4ModelProfile(model);
|
|
266888
|
+
if (deepSeekProfile && !deepSeekProfile.legacyAlias) {
|
|
266889
|
+
return deepSeekProfile.lane === "flash" ? "Flash" : "Pro";
|
|
266883
266890
|
}
|
|
266884
266891
|
if (lower.includes("gpt-5.5") || lower.includes("gpt-5.4")) {
|
|
266885
266892
|
return `${model} (OpenAI)`;
|
|
@@ -267721,7 +267728,7 @@ async function runDoctor(cwd, options = {}) {
|
|
|
267721
267728
|
|
|
267722
267729
|
// src/commands/bench.ts
|
|
267723
267730
|
import picocolors7 from "picocolors";
|
|
267724
|
-
import { createHash as createHash8, randomUUID as
|
|
267731
|
+
import { createHash as createHash8, randomUUID as randomUUID8 } from "crypto";
|
|
267725
267732
|
import { resolve as resolve8 } from "path";
|
|
267726
267733
|
import { z as z46 } from "zod";
|
|
267727
267734
|
var BenchOptionsSchema = z46.object({
|
|
@@ -268044,7 +268051,7 @@ async function runBench(cwd, options = {}) {
|
|
|
268044
268051
|
if (models.length === 0) {
|
|
268045
268052
|
models.push(config.models.fast || config.models.default);
|
|
268046
268053
|
}
|
|
268047
|
-
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.";
|
|
268048
268055
|
const repeat = options.cacheProfile ? Math.max(3, clampRepeat(options.repeat)) : clampRepeat(options.repeat);
|
|
268049
268056
|
const minCacheHit = clampCacheHitThreshold(options.minCacheHit);
|
|
268050
268057
|
const benchmarkThresholds = {
|
|
@@ -274241,7 +274248,7 @@ import { rmSync as rmSync6, watch } from "fs";
|
|
|
274241
274248
|
import { dirname as dirname13, resolve as resolve14 } from "path";
|
|
274242
274249
|
import { homedir as homedir10 } from "os";
|
|
274243
274250
|
import http3 from "http";
|
|
274244
|
-
import { randomBytes as randomBytes4, randomUUID as
|
|
274251
|
+
import { randomBytes as randomBytes4, randomUUID as randomUUID12, timingSafeEqual as timingSafeEqual2 } from "crypto";
|
|
274245
274252
|
import { z as z66 } from "zod";
|
|
274246
274253
|
|
|
274247
274254
|
// src/runtime/CommandRouter.ts
|
|
@@ -274459,7 +274466,7 @@ import { createRequire as createRequire2 } from "module";
|
|
|
274459
274466
|
|
|
274460
274467
|
// src/runtime/webui/WebUiRuntime.ts
|
|
274461
274468
|
import http2 from "http";
|
|
274462
|
-
import { randomBytes as randomBytes3, randomUUID as
|
|
274469
|
+
import { randomBytes as randomBytes3, randomUUID as randomUUID9 } from "crypto";
|
|
274463
274470
|
import { isAbsolute as isAbsolute5, relative as relative7, resolve as resolve11 } from "path";
|
|
274464
274471
|
import { z as z55 } from "zod";
|
|
274465
274472
|
|
|
@@ -274777,7 +274784,7 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
|
|
|
274777
274784
|
elements.activityTab.addEventListener('keydown', handleInspectorTabKeydown);
|
|
274778
274785
|
elements.changesTab.addEventListener('keydown', handleInspectorTabKeydown);
|
|
274779
274786
|
elements.settingsTab.addEventListener('keydown', handleInspectorTabKeydown);
|
|
274780
|
-
|
|
274787
|
+
elements.clearActivity.addEventListener('click', clearActivity);
|
|
274781
274788
|
elements.memoryReview.addEventListener('click', (event) => {
|
|
274782
274789
|
const button = event.target.closest('[data-memory-remove]');
|
|
274783
274790
|
if (!button || state.busy) return;
|
|
@@ -275228,10 +275235,39 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
|
|
|
275228
275235
|
applySettings({ model: elements.modelSelect.value }, true).catch(() => {});
|
|
275229
275236
|
});
|
|
275230
275237
|
|
|
275231
|
-
|
|
275238
|
+
elements.settingsModelSelect.addEventListener('change', () => {
|
|
275239
|
+
applySettings({ model: elements.settingsModelSelect.value }, true).catch(() => {});
|
|
275240
|
+
});
|
|
275241
|
+
|
|
275242
|
+
async function submitCustomModel() {
|
|
275232
275243
|
const model = elements.customModel.value.trim();
|
|
275233
|
-
if (!model) return;
|
|
275234
|
-
|
|
275244
|
+
if (!model || state.busy || state.customModelPending) return;
|
|
275245
|
+
state.customModelPending = true;
|
|
275246
|
+
syncCustomModelAction();
|
|
275247
|
+
try {
|
|
275248
|
+
await applySettings({ model });
|
|
275249
|
+
elements.customModel.value = '';
|
|
275250
|
+
} catch {}
|
|
275251
|
+
finally {
|
|
275252
|
+
state.customModelPending = false;
|
|
275253
|
+
syncCustomModelAction();
|
|
275254
|
+
}
|
|
275255
|
+
}
|
|
275256
|
+
|
|
275257
|
+
elements.customModel.addEventListener('input', syncCustomModelAction);
|
|
275258
|
+
elements.customModel.addEventListener('keydown', (event) => {
|
|
275259
|
+
if (event.key !== 'Enter' || event.isComposing) return;
|
|
275260
|
+
event.preventDefault();
|
|
275261
|
+
void submitCustomModel();
|
|
275262
|
+
});
|
|
275263
|
+
elements.applyModel.addEventListener('click', () => void submitCustomModel());
|
|
275264
|
+
syncCustomModelAction();
|
|
275265
|
+
|
|
275266
|
+
elements.settingsPanel.addEventListener('click', (event) => {
|
|
275267
|
+
const button = event.target.closest('[data-settings-target]');
|
|
275268
|
+
if (!button) return;
|
|
275269
|
+
const target = byId(button.dataset.settingsTarget);
|
|
275270
|
+
if (target) target.scrollIntoView({ block: 'start' });
|
|
275235
275271
|
});
|
|
275236
275272
|
|
|
275237
275273
|
elements.permissionSelect.addEventListener('change', () => {
|
|
@@ -275779,34 +275815,40 @@ var WEB_UI_CLIENT_CAPABILITIES_SCRIPT = String.raw` function syncSkillControls(
|
|
|
275779
275815
|
`;
|
|
275780
275816
|
|
|
275781
275817
|
// src/runtime/webui/WebUiClientApproval.ts
|
|
275782
|
-
|
|
275783
|
-
|
|
275818
|
+
function createApprovalController(runtime) {
|
|
275819
|
+
const { copy, elements, state, api, showToast, reconcileStatus } = runtime;
|
|
275820
|
+
function renderPendingApproval(approval) {
|
|
275821
|
+
state.pendingApproval = approval?.id ? approval : null;
|
|
275784
275822
|
const visible = Boolean(state.pendingApproval);
|
|
275785
275823
|
elements.approvalPanel.hidden = !visible;
|
|
275786
|
-
if (!
|
|
275787
|
-
elements.approvalTitle.textContent =
|
|
275788
|
-
elements.approvalReason.textContent =
|
|
275789
|
-
elements.approvalPreview.textContent =
|
|
275824
|
+
if (!state.pendingApproval) {
|
|
275825
|
+
elements.approvalTitle.textContent = "";
|
|
275826
|
+
elements.approvalReason.textContent = "";
|
|
275827
|
+
elements.approvalPreview.textContent = "";
|
|
275790
275828
|
elements.approvalPreview.hidden = true;
|
|
275791
275829
|
state.approvalSubmitting = false;
|
|
275792
275830
|
return;
|
|
275793
275831
|
}
|
|
275794
275832
|
elements.approvalTitle.textContent = state.pendingApproval.title || copy.approvalRequired;
|
|
275795
|
-
const approvalOwner = state.pendingApproval.agentRole || state.pendingApproval.agentId ||
|
|
275833
|
+
const approvalOwner = state.pendingApproval.agentRole || state.pendingApproval.agentId || "";
|
|
275796
275834
|
elements.approvalReason.textContent = [
|
|
275797
|
-
approvalOwner ? copy.approvalOwner
|
|
275798
|
-
state.pendingApproval.reason ||
|
|
275799
|
-
].filter(Boolean).join(
|
|
275800
|
-
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 || "");
|
|
275801
275839
|
elements.approvalPreview.replaceChildren();
|
|
275802
275840
|
if (preview) {
|
|
275803
|
-
for (const line of preview.split(
|
|
275804
|
-
const row = document.createElement(
|
|
275805
|
-
row.className =
|
|
275806
|
-
if (line.startsWith(
|
|
275807
|
-
|
|
275808
|
-
else if (line.startsWith(
|
|
275809
|
-
|
|
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 || " ";
|
|
275810
275852
|
elements.approvalPreview.append(row);
|
|
275811
275853
|
}
|
|
275812
275854
|
}
|
|
@@ -275814,129 +275856,173 @@ var WEB_UI_CLIENT_APPROVAL_SCRIPT = String.raw` function renderPendingApproval(
|
|
|
275814
275856
|
elements.denyApprovalButton.disabled = state.approvalSubmitting;
|
|
275815
275857
|
elements.approveApprovalButton.disabled = state.approvalSubmitting;
|
|
275816
275858
|
}
|
|
275817
|
-
|
|
275818
275859
|
async function respondToApproval(approved) {
|
|
275819
275860
|
const approval = state.pendingApproval;
|
|
275820
275861
|
if (!approval || state.approvalSubmitting) return;
|
|
275821
275862
|
state.approvalSubmitting = true;
|
|
275822
275863
|
renderPendingApproval(approval);
|
|
275823
275864
|
try {
|
|
275824
|
-
await api(
|
|
275825
|
-
method:
|
|
275826
|
-
headers: {
|
|
275827
|
-
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) })
|
|
275828
275869
|
});
|
|
275829
|
-
showToast(
|
|
275870
|
+
showToast(
|
|
275871
|
+
approved ? copy.approvalApproved : copy.approvalDenied,
|
|
275872
|
+
approved ? "success" : "warning"
|
|
275873
|
+
);
|
|
275830
275874
|
renderPendingApproval(null);
|
|
275831
275875
|
void reconcileStatus();
|
|
275832
275876
|
} catch (error) {
|
|
275833
275877
|
state.approvalSubmitting = false;
|
|
275834
275878
|
renderPendingApproval(approval);
|
|
275835
|
-
showToast(
|
|
275879
|
+
showToast(
|
|
275880
|
+
error instanceof Error ? error.message : String(error),
|
|
275881
|
+
"error"
|
|
275882
|
+
);
|
|
275836
275883
|
}
|
|
275837
275884
|
}
|
|
275885
|
+
return { renderPendingApproval, respondToApproval };
|
|
275886
|
+
}
|
|
275887
|
+
var WEB_UI_CLIENT_APPROVAL_SCRIPT = ` const { renderPendingApproval, respondToApproval } = (${createApprovalController.toString()})({ copy, elements, state, api, showToast, reconcileStatus });
|
|
275838
275888
|
|
|
275839
275889
|
`;
|
|
275840
275890
|
|
|
275841
275891
|
// src/runtime/webui/WebUiClientAttachments.ts
|
|
275842
|
-
|
|
275892
|
+
function createAttachmentController(runtime) {
|
|
275893
|
+
const { copy, elements, state, api, showToast, updateSendButtonState } = runtime;
|
|
275894
|
+
function renderAttachments() {
|
|
275843
275895
|
elements.attachmentList.replaceChildren();
|
|
275844
275896
|
elements.attachmentShelf.hidden = state.attachments.length === 0;
|
|
275845
275897
|
elements.attachmentCount.textContent = String(state.attachments.length);
|
|
275846
275898
|
elements.attachmentCount.hidden = state.attachments.length === 0;
|
|
275847
|
-
elements.attachmentCount.setAttribute(
|
|
275899
|
+
elements.attachmentCount.setAttribute(
|
|
275900
|
+
"aria-label",
|
|
275901
|
+
String(state.attachments.length)
|
|
275902
|
+
);
|
|
275848
275903
|
elements.attachmentButton.disabled = state.attachments.length >= 4;
|
|
275849
275904
|
for (const attachment of state.attachments) {
|
|
275850
|
-
const card = document.createElement(
|
|
275851
|
-
card.className =
|
|
275852
|
-
const image = document.createElement(
|
|
275905
|
+
const card = document.createElement("div");
|
|
275906
|
+
card.className = "attachment-card";
|
|
275907
|
+
const image = document.createElement("img");
|
|
275853
275908
|
image.src = attachment.previewUrl;
|
|
275854
|
-
image.alt =
|
|
275855
|
-
const copyBlock = document.createElement(
|
|
275856
|
-
const name = document.createElement(
|
|
275909
|
+
image.alt = "";
|
|
275910
|
+
const copyBlock = document.createElement("span");
|
|
275911
|
+
const name = document.createElement("strong");
|
|
275857
275912
|
name.textContent = attachment.name;
|
|
275858
275913
|
name.title = attachment.name;
|
|
275859
|
-
const size = document.createElement(
|
|
275860
|
-
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`;
|
|
275861
275916
|
copyBlock.append(name, size);
|
|
275862
|
-
const remove = document.createElement(
|
|
275863
|
-
remove.type =
|
|
275917
|
+
const remove = document.createElement("button");
|
|
275918
|
+
remove.type = "button";
|
|
275864
275919
|
remove.dataset.attachmentRemove = attachment.id;
|
|
275865
|
-
remove.textContent =
|
|
275866
|
-
remove.setAttribute(
|
|
275920
|
+
remove.textContent = "\xD7";
|
|
275921
|
+
remove.setAttribute("aria-label", copy.removeAttachment);
|
|
275867
275922
|
card.append(image, copyBlock, remove);
|
|
275868
275923
|
elements.attachmentList.append(card);
|
|
275869
275924
|
}
|
|
275870
275925
|
updateSendButtonState();
|
|
275871
275926
|
}
|
|
275872
|
-
|
|
275873
275927
|
async function uploadAttachment(file) {
|
|
275874
|
-
if (!file || ![
|
|
275875
|
-
|
|
275928
|
+
if (!file || !["image/png", "image/jpeg", "image/gif", "image/webp"].includes(
|
|
275929
|
+
file.type
|
|
275930
|
+
)) {
|
|
275931
|
+
showToast(copy.attachmentLimit, "warning");
|
|
275876
275932
|
return;
|
|
275877
275933
|
}
|
|
275878
275934
|
if (file.size <= 0 || file.size > 5 * 1024 * 1024 || state.attachments.length >= 4) {
|
|
275879
|
-
showToast(copy.attachmentLimit,
|
|
275935
|
+
showToast(copy.attachmentLimit, "warning");
|
|
275880
275936
|
return;
|
|
275881
275937
|
}
|
|
275882
275938
|
elements.attachmentButton.disabled = true;
|
|
275883
275939
|
try {
|
|
275884
|
-
const result = await api(
|
|
275885
|
-
|
|
275886
|
-
|
|
275887
|
-
|
|
275888
|
-
|
|
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
|
+
);
|
|
275889
275948
|
const attachment = result.attachment || {};
|
|
275890
275949
|
state.attachments.push({
|
|
275891
|
-
id: attachment.id,
|
|
275892
|
-
name: attachment.name || file.name ||
|
|
275950
|
+
id: String(attachment.id || ""),
|
|
275951
|
+
name: attachment.name || file.name || "image",
|
|
275893
275952
|
mediaType: attachment.mediaType || file.type,
|
|
275894
275953
|
size: Number(attachment.size || file.size),
|
|
275895
|
-
previewUrl: URL.createObjectURL(file)
|
|
275954
|
+
previewUrl: URL.createObjectURL(file)
|
|
275896
275955
|
});
|
|
275897
275956
|
renderAttachments();
|
|
275898
|
-
showToast(copy.attachmentAdded,
|
|
275957
|
+
showToast(copy.attachmentAdded, "success");
|
|
275899
275958
|
} catch (error) {
|
|
275900
|
-
showToast(
|
|
275959
|
+
showToast(
|
|
275960
|
+
error instanceof Error ? error.message : String(error),
|
|
275961
|
+
"error"
|
|
275962
|
+
);
|
|
275901
275963
|
} finally {
|
|
275902
275964
|
elements.attachmentButton.disabled = state.attachments.length >= 4;
|
|
275903
|
-
elements.attachmentInput.value =
|
|
275965
|
+
elements.attachmentInput.value = "";
|
|
275904
275966
|
}
|
|
275905
275967
|
}
|
|
275906
|
-
|
|
275907
275968
|
async function addAttachmentFiles(files) {
|
|
275908
|
-
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
|
+
)) {
|
|
275909
275973
|
await uploadAttachment(file);
|
|
275910
275974
|
}
|
|
275911
275975
|
}
|
|
275912
|
-
|
|
275913
275976
|
async function removeAttachment(id, notify) {
|
|
275914
|
-
const index = state.attachments.findIndex(
|
|
275977
|
+
const index = state.attachments.findIndex(
|
|
275978
|
+
(attachment2) => attachment2.id === id
|
|
275979
|
+
);
|
|
275915
275980
|
if (index === -1) return;
|
|
275916
275981
|
const attachment = state.attachments[index];
|
|
275917
|
-
const removeButton = elements.attachmentList.querySelector(
|
|
275982
|
+
const removeButton = elements.attachmentList.querySelector(
|
|
275983
|
+
`[data-attachment-remove="${CSS.escape(id)}"]`
|
|
275984
|
+
);
|
|
275918
275985
|
if (removeButton) removeButton.disabled = true;
|
|
275919
275986
|
try {
|
|
275920
|
-
await api(
|
|
275921
|
-
|
|
275987
|
+
await api(`/api/attachment?id=${encodeURIComponent(id)}`, {
|
|
275988
|
+
method: "DELETE"
|
|
275989
|
+
});
|
|
275990
|
+
const currentIndex = state.attachments.findIndex(
|
|
275991
|
+
(item) => item.id === id
|
|
275992
|
+
);
|
|
275922
275993
|
if (currentIndex !== -1) state.attachments.splice(currentIndex, 1);
|
|
275923
275994
|
if (attachment.previewUrl) URL.revokeObjectURL(attachment.previewUrl);
|
|
275924
275995
|
renderAttachments();
|
|
275925
275996
|
if (notify) showToast(copy.attachmentRemoved);
|
|
275926
275997
|
} catch (error) {
|
|
275927
275998
|
if (removeButton) removeButton.disabled = false;
|
|
275928
|
-
showToast(
|
|
275999
|
+
showToast(
|
|
276000
|
+
error instanceof Error ? error.message : String(error),
|
|
276001
|
+
"error"
|
|
276002
|
+
);
|
|
275929
276003
|
}
|
|
275930
276004
|
}
|
|
275931
|
-
|
|
275932
276005
|
function consumeAttachments(ids) {
|
|
275933
276006
|
const consumed = new Set(ids || []);
|
|
275934
276007
|
for (const attachment of state.attachments) {
|
|
275935
|
-
if (consumed.has(attachment.id) && attachment.previewUrl)
|
|
276008
|
+
if (consumed.has(attachment.id) && attachment.previewUrl) {
|
|
276009
|
+
URL.revokeObjectURL(attachment.previewUrl);
|
|
276010
|
+
}
|
|
275936
276011
|
}
|
|
275937
|
-
state.attachments = state.attachments.filter(
|
|
276012
|
+
state.attachments = state.attachments.filter(
|
|
276013
|
+
(attachment) => !consumed.has(attachment.id)
|
|
276014
|
+
);
|
|
275938
276015
|
renderAttachments();
|
|
275939
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 });
|
|
275940
276026
|
|
|
275941
276027
|
`;
|
|
275942
276028
|
|
|
@@ -276299,6 +276385,10 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
276299
276385
|
restored: '已恢复工作区',
|
|
276300
276386
|
traceExported: '诊断包已导出',
|
|
276301
276387
|
noChanges: '当前对话还没有文件改动。',
|
|
276388
|
+
noActivity: 'Orbit 工作时,步骤和工具状态会显示在这里。',
|
|
276389
|
+
noToolCalls: '当前对话还没有工具调用。',
|
|
276390
|
+
noMatchingChats: '没有匹配的对话',
|
|
276391
|
+
noRecentTasks: '还没有对话',
|
|
276302
276392
|
noCheckpoints: '暂无可恢复检查点。',
|
|
276303
276393
|
noVerification: '暂无验证结果。',
|
|
276304
276394
|
noAgents: '当前工作区还没有委派智能体。',
|
|
@@ -276445,6 +276535,10 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
276445
276535
|
restored: 'Workspace restored',
|
|
276446
276536
|
traceExported: 'Diagnostics exported',
|
|
276447
276537
|
noChanges: 'No file changes in this chat.',
|
|
276538
|
+
noActivity: 'Activity will appear here while Orbit works.',
|
|
276539
|
+
noToolCalls: 'No tool calls in this chat.',
|
|
276540
|
+
noMatchingChats: 'No matching chats',
|
|
276541
|
+
noRecentTasks: 'No chats yet',
|
|
276448
276542
|
noCheckpoints: 'No restorable checkpoints.',
|
|
276449
276543
|
noVerification: 'No verification results.',
|
|
276450
276544
|
noAgents: 'No delegated agents for this workspace.',
|
|
@@ -276533,6 +276627,10 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
276533
276627
|
restoreFile: '復原檔案',
|
|
276534
276628
|
traceExported: '診斷包已匯出',
|
|
276535
276629
|
noChanges: '目前對話尚未有檔案變更。',
|
|
276630
|
+
noActivity: 'Orbit 工作時,步驟和工具狀態會顯示在這裡。',
|
|
276631
|
+
noToolCalls: '目前對話尚未有工具呼叫。',
|
|
276632
|
+
noMatchingChats: '沒有相符的對話',
|
|
276633
|
+
noRecentTasks: '尚未有對話',
|
|
276536
276634
|
queued: '已加入待傳送佇列',
|
|
276537
276635
|
queueMessage: '加入佇列',
|
|
276538
276636
|
removeQueued: '移除待傳送訊息',
|
|
@@ -276688,7 +276786,9 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
276688
276786
|
connectionLabel: byId('connectionLabel'),
|
|
276689
276787
|
providerSelect: byId('providerSelect'),
|
|
276690
276788
|
modelSelect: byId('modelSelect'),
|
|
276789
|
+
settingsModelSelect: byId('settingsModelSelect'),
|
|
276691
276790
|
customModel: byId('customModel'),
|
|
276791
|
+
applyModel: byId('applyModel'),
|
|
276692
276792
|
permissionSelect: byId('permissionSelect'),
|
|
276693
276793
|
permissionSegments: byId('permissionSegments'),
|
|
276694
276794
|
permissionSummary: byId('permissionSummary'),
|
|
@@ -276727,6 +276827,7 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
276727
276827
|
events: byId('events'),
|
|
276728
276828
|
activityEmpty: byId('activityEmpty'),
|
|
276729
276829
|
activityFilters: byId('activityFilters'),
|
|
276830
|
+
clearActivity: byId('clearActivity'),
|
|
276730
276831
|
runtime: byId('runtime'),
|
|
276731
276832
|
taskOverview: byId('taskOverview'),
|
|
276732
276833
|
buildPlanButton: byId('buildPlanButton'),
|
|
@@ -276782,6 +276883,7 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
276782
276883
|
streamingTools: new Map(),
|
|
276783
276884
|
statusRefresh: null,
|
|
276784
276885
|
settingsPromise: null,
|
|
276886
|
+
customModelPending: false,
|
|
276785
276887
|
skills: null,
|
|
276786
276888
|
skillsPromise: null,
|
|
276787
276889
|
skillRequestId: 0,
|
|
@@ -277161,12 +277263,22 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
277161
277263
|
? state.skills.enabled
|
|
277162
277264
|
: state.status && state.status.skills && state.status.skills.enabled
|
|
277163
277265
|
));
|
|
277266
|
+
syncCustomModelAction();
|
|
277164
277267
|
elements.turnStatus.classList.toggle('is-working', busy);
|
|
277165
277268
|
elements.turnStatus.textContent = label || (busy ? copy.thinking : '');
|
|
277166
277269
|
updateSendButtonState();
|
|
277167
277270
|
renderPromptQueue();
|
|
277168
277271
|
}
|
|
277169
277272
|
|
|
277273
|
+
function syncCustomModelAction() {
|
|
277274
|
+
const pending = state.customModelPending;
|
|
277275
|
+
elements.customModel.disabled = state.busy || pending;
|
|
277276
|
+
elements.applyModel.disabled = state.busy || pending || !elements.customModel.value.trim();
|
|
277277
|
+
elements.applyModel.setAttribute('aria-busy', pending ? 'true' : 'false');
|
|
277278
|
+
if (pending) elements.applyModel.setAttribute('aria-label', copy.settingsSaving);
|
|
277279
|
+
else elements.applyModel.removeAttribute('aria-label');
|
|
277280
|
+
}
|
|
277281
|
+
|
|
277170
277282
|
function updateSendButtonState() {
|
|
277171
277283
|
const hasPrompt = Boolean(elements.prompt.value.trim());
|
|
277172
277284
|
elements.buildPlanButton.disabled = state.busy || !state.ready;
|
|
@@ -278885,7 +278997,7 @@ var WEB_UI_CLIENT_SESSION_SCRIPT = String.raw` const controlCommands = ${WEB_UI
|
|
|
278885
278997
|
if (!tools.length) {
|
|
278886
278998
|
const empty = document.createElement('p');
|
|
278887
278999
|
empty.className = 'review-empty';
|
|
278888
|
-
empty.textContent = copy.
|
|
279000
|
+
empty.textContent = copy.noToolCalls;
|
|
278889
279001
|
elements.toolHistory.append(empty);
|
|
278890
279002
|
return;
|
|
278891
279003
|
}
|
|
@@ -279158,20 +279270,22 @@ var WEB_UI_CLIENT_SESSION_SCRIPT = String.raw` const controlCommands = ${WEB_UI
|
|
|
279158
279270
|
|
|
279159
279271
|
function syncModelOptions(data) {
|
|
279160
279272
|
const current = data.modelSelection || data.activeModel || '';
|
|
279161
|
-
elements.modelSelect.
|
|
279162
|
-
|
|
279163
|
-
const
|
|
279164
|
-
|
|
279165
|
-
|
|
279166
|
-
|
|
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;
|
|
279167
279288
|
}
|
|
279168
|
-
if (![...elements.modelSelect.options].some((option) => option.value === current)) {
|
|
279169
|
-
const custom = document.createElement('option');
|
|
279170
|
-
custom.value = current;
|
|
279171
|
-
custom.textContent = current || 'custom';
|
|
279172
|
-
elements.modelSelect.prepend(custom);
|
|
279173
|
-
}
|
|
279174
|
-
elements.modelSelect.value = current;
|
|
279175
279289
|
syncSelectControl(elements.modelSelect);
|
|
279176
279290
|
}
|
|
279177
279291
|
|
|
@@ -279502,6 +279616,10 @@ var WEB_UI_CLIENT_SESSION_SCRIPT = String.raw` const controlCommands = ${WEB_UI
|
|
|
279502
279616
|
return refresh;
|
|
279503
279617
|
}
|
|
279504
279618
|
|
|
279619
|
+
function syncActivityControls() {
|
|
279620
|
+
elements.clearActivity.disabled = state.activityRows === 0;
|
|
279621
|
+
}
|
|
279622
|
+
|
|
279505
279623
|
function addActivity(message, kind, key) {
|
|
279506
279624
|
elements.activityEmpty.hidden = true;
|
|
279507
279625
|
if (key) {
|
|
@@ -279537,6 +279655,7 @@ var WEB_UI_CLIENT_SESSION_SCRIPT = String.raw` const controlCommands = ${WEB_UI
|
|
|
279537
279655
|
first.remove();
|
|
279538
279656
|
state.activityRows -= 1;
|
|
279539
279657
|
}
|
|
279658
|
+
syncActivityControls();
|
|
279540
279659
|
applyActivityFilter();
|
|
279541
279660
|
return row;
|
|
279542
279661
|
}
|
|
@@ -279561,6 +279680,7 @@ var WEB_UI_CLIENT_SESSION_SCRIPT = String.raw` const controlCommands = ${WEB_UI
|
|
|
279561
279680
|
state.activityRows = 0;
|
|
279562
279681
|
state.currentThinkingRow = null;
|
|
279563
279682
|
state.toolRows.clear();
|
|
279683
|
+
syncActivityControls();
|
|
279564
279684
|
}
|
|
279565
279685
|
|
|
279566
279686
|
async function applySettings(patch, quiet) {
|
|
@@ -279600,6 +279720,14 @@ var WEB_UI_CLIENT_SESSION_SCRIPT = String.raw` const controlCommands = ${WEB_UI
|
|
|
279600
279720
|
}
|
|
279601
279721
|
|
|
279602
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;
|
|
279603
279731
|
elements.promptQueueList.replaceChildren();
|
|
279604
279732
|
elements.promptQueue.hidden = state.promptQueue.length === 0;
|
|
279605
279733
|
if (!state.promptQueue.some((item) => item.id === state.queueEditingId)) {
|
|
@@ -279666,6 +279794,17 @@ var WEB_UI_CLIENT_SESSION_SCRIPT = String.raw` const controlCommands = ${WEB_UI
|
|
|
279666
279794
|
row.append(number, text, actions);
|
|
279667
279795
|
elements.promptQueueList.append(row);
|
|
279668
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
|
+
}
|
|
279669
279808
|
}
|
|
279670
279809
|
|
|
279671
279810
|
async function queuePrompt(prompt, mode) {
|
|
@@ -281338,17 +281477,10 @@ function getActiveModel(options) {
|
|
|
281338
281477
|
function buildModelOptions(options, activeModel2) {
|
|
281339
281478
|
const { config } = options;
|
|
281340
281479
|
const providerId = config.provider.default;
|
|
281480
|
+
const providerModels = getProviderModelCandidates(config, providerId);
|
|
281481
|
+
const includeActiveModel = !isOfficialDeepSeekProvider(config, providerId) || providerModels.includes(activeModel2);
|
|
281341
281482
|
const discovered = Array.from(
|
|
281342
|
-
/* @__PURE__ */ new Set([
|
|
281343
|
-
activeModel2,
|
|
281344
|
-
config.models.default,
|
|
281345
|
-
config.models.fast,
|
|
281346
|
-
config.models.planner,
|
|
281347
|
-
config.models.coder,
|
|
281348
|
-
config.models.reviewer,
|
|
281349
|
-
config.models.summarizer,
|
|
281350
|
-
...getProviderModelCandidates(config, providerId)
|
|
281351
|
-
])
|
|
281483
|
+
/* @__PURE__ */ new Set([...includeActiveModel ? [activeModel2] : [], ...providerModels])
|
|
281352
281484
|
).map((model) => model?.trim()).filter((model) => Boolean(model)).map((model) => ({ id: model, label: formatModelOptionLabel(model) }));
|
|
281353
281485
|
const automatic = { id: "__auto__", label: "Auto \xB7 Flash / Pro" };
|
|
281354
281486
|
return safeCall(() => options.loop?.getModelOverride?.()) ? [discovered[0], automatic, ...discovered.slice(1)] : [automatic, ...discovered];
|
|
@@ -281841,6 +281973,10 @@ var BASE_COPY = {
|
|
|
281841
281973
|
parallelImprove: "Parallel improve",
|
|
281842
281974
|
parallelImproveBody: "Plan, implement, and review with Git worktree isolation when available.",
|
|
281843
281975
|
settings: "Settings",
|
|
281976
|
+
settingsSections: "Settings sections",
|
|
281977
|
+
settingsGeneral: "General",
|
|
281978
|
+
settingsCapabilities: "Capabilities",
|
|
281979
|
+
settingsAppearance: "Appearance",
|
|
281844
281980
|
language: "Language",
|
|
281845
281981
|
languageDescription: "Used by this project in both WebUI and terminal.",
|
|
281846
281982
|
languageEnglish: "English",
|
|
@@ -281871,6 +282007,7 @@ var BASE_COPY = {
|
|
|
281871
282007
|
noMemory: "No explicit project memory.",
|
|
281872
282008
|
noPlan: "No plan steps for this chat.",
|
|
281873
282009
|
noActivity: "Activity will appear here while Orbit works.",
|
|
282010
|
+
noToolCalls: "No tool calls in this chat.",
|
|
281874
282011
|
clearActivity: "Clear",
|
|
281875
282012
|
activityAll: "All",
|
|
281876
282013
|
activityRunning: "Running",
|
|
@@ -282017,6 +282154,10 @@ var BASE_COPY = {
|
|
|
282017
282154
|
parallelImprove: "\u5E76\u884C\u6539\u8FDB",
|
|
282018
282155
|
parallelImproveBody: "\u5B8C\u6210\u89C4\u5212\u3001\u5B9E\u73B0\u4E0E\u5BA1\u67E5\uFF0C\u5E76\u5728\u53EF\u7528\u65F6\u901A\u8FC7 Git \u5DE5\u4F5C\u6811\u9694\u79BB\u6539\u52A8\u3002",
|
|
282019
282156
|
settings: "\u8BBE\u7F6E",
|
|
282157
|
+
settingsSections: "\u8BBE\u7F6E\u5206\u533A",
|
|
282158
|
+
settingsGeneral: "\u5E38\u89C4",
|
|
282159
|
+
settingsCapabilities: "\u80FD\u529B",
|
|
282160
|
+
settingsAppearance: "\u5916\u89C2",
|
|
282020
282161
|
language: "\u8BED\u8A00",
|
|
282021
282162
|
languageDescription: "\u5F53\u524D\u5DE5\u7A0B\u7684 WebUI \u4E0E\u7EC8\u7AEF\u5C06\u4F7F\u7528\u540C\u4E00\u8BED\u8A00\u3002",
|
|
282022
282163
|
languageEnglish: "English",
|
|
@@ -282047,6 +282188,7 @@ var BASE_COPY = {
|
|
|
282047
282188
|
noMemory: "\u6682\u65E0\u663E\u5F0F\u9879\u76EE\u8BB0\u5FC6\u3002",
|
|
282048
282189
|
noPlan: "\u5F53\u524D\u5BF9\u8BDD\u6682\u65E0\u8BA1\u5212\u6B65\u9AA4\u3002",
|
|
282049
282190
|
noActivity: "Orbit \u5DE5\u4F5C\u65F6\uFF0C\u6B65\u9AA4\u548C\u5DE5\u5177\u72B6\u6001\u4F1A\u663E\u793A\u5728\u8FD9\u91CC\u3002",
|
|
282191
|
+
noToolCalls: "\u5F53\u524D\u5BF9\u8BDD\u8FD8\u6CA1\u6709\u5DE5\u5177\u8C03\u7528\u3002",
|
|
282050
282192
|
clearActivity: "\u6E05\u7A7A",
|
|
282051
282193
|
activityAll: "\u5168\u90E8",
|
|
282052
282194
|
activityRunning: "\u8FDB\u884C\u4E2D",
|
|
@@ -282187,6 +282329,10 @@ var COPY = {
|
|
|
282187
282329
|
parallelImprove: "\u5E73\u884C\u6539\u9032",
|
|
282188
282330
|
parallelImproveBody: "\u5B8C\u6210\u898F\u5283\u3001\u5BE6\u4F5C\u8207\u5BE9\u67E5\uFF0C\u4E26\u5728\u53EF\u7528\u6642\u900F\u904E Git \u5DE5\u4F5C\u6A39\u9694\u96E2\u8B8A\u66F4\u3002",
|
|
282189
282331
|
settings: "\u8A2D\u5B9A",
|
|
282332
|
+
settingsSections: "\u8A2D\u5B9A\u5206\u5340",
|
|
282333
|
+
settingsGeneral: "\u4E00\u822C",
|
|
282334
|
+
settingsCapabilities: "\u80FD\u529B",
|
|
282335
|
+
settingsAppearance: "\u5916\u89C0",
|
|
282190
282336
|
changedFiles: "\u6A94\u6848\u8B8A\u66F4",
|
|
282191
282337
|
toolCalls: "\u5DE5\u5177\u547C\u53EB",
|
|
282192
282338
|
verification: "\u9A57\u8B49\u7D50\u679C",
|
|
@@ -282197,6 +282343,7 @@ var COPY = {
|
|
|
282197
282343
|
projectMemory: "\u5C08\u6848\u8A18\u61B6",
|
|
282198
282344
|
taskPlan: "\u4EFB\u52D9\u8A08\u756B",
|
|
282199
282345
|
noActivity: "Orbit \u5DE5\u4F5C\u6642\uFF0C\u6B65\u9A5F\u548C\u5DE5\u5177\u72C0\u614B\u6703\u986F\u793A\u5728\u9019\u88E1\u3002",
|
|
282346
|
+
noToolCalls: "\u76EE\u524D\u5C0D\u8A71\u5C1A\u672A\u6709\u5DE5\u5177\u547C\u53EB\u3002",
|
|
282200
282347
|
clearActivity: "\u6E05\u9664",
|
|
282201
282348
|
activityAll: "\u5168\u90E8",
|
|
282202
282349
|
activityRunning: "\u9032\u884C\u4E2D",
|
|
@@ -282614,10 +282761,10 @@ function renderWebUiPage(language) {
|
|
|
282614
282761
|
</section>
|
|
282615
282762
|
<section class="detail-section">
|
|
282616
282763
|
<div class="section-heading"><h3>${copy.toolCalls}</h3><span id="toolHistoryCount">0</span></div>
|
|
282617
|
-
<div class="tool-history-list" id="toolHistory"><p class="review-empty">${copy.
|
|
282764
|
+
<div class="tool-history-list" id="toolHistory"><p class="review-empty">${copy.noToolCalls}</p></div>
|
|
282618
282765
|
</section>
|
|
282619
282766
|
<section class="detail-section activity-section">
|
|
282620
|
-
<div class="section-heading"><h3>${copy.activity}</h3><button class="text-button" id="clearActivity" type="button">${copy.clearActivity}</button></div>
|
|
282767
|
+
<div class="section-heading"><h3>${copy.activity}</h3><button class="text-button" id="clearActivity" type="button" disabled>${copy.clearActivity}</button></div>
|
|
282621
282768
|
<div class="compact-filter-bar segmented" id="activityFilters" aria-label="${copy.activity}">
|
|
282622
282769
|
<button type="button" data-activity-filter="all" aria-pressed="true">${copy.activityAll}</button>
|
|
282623
282770
|
<button type="button" data-activity-filter="running" aria-pressed="false">${copy.activityRunning}</button>
|
|
@@ -282662,7 +282809,12 @@ function renderWebUiPage(language) {
|
|
|
282662
282809
|
</section>
|
|
282663
282810
|
|
|
282664
282811
|
<section class="tab-panel" id="settingsPanel" role="tabpanel" aria-labelledby="settingsTab" hidden>
|
|
282665
|
-
<
|
|
282812
|
+
<nav class="settings-index" aria-label="${copy.settingsSections}">
|
|
282813
|
+
<button type="button" data-settings-target="settingsGeneral">${copy.settingsGeneral}</button>
|
|
282814
|
+
<button type="button" data-settings-target="settingsCapabilities">${copy.settingsCapabilities}</button>
|
|
282815
|
+
<button type="button" data-settings-target="settingsAppearance">${copy.settingsAppearance}</button>
|
|
282816
|
+
</nav>
|
|
282817
|
+
<section class="settings-group" id="settingsGeneral">
|
|
282666
282818
|
<div class="setting-row setting-row-stacked">
|
|
282667
282819
|
<div><h3>${copy.language}</h3><p>${copy.languageDescription}</p></div>
|
|
282668
282820
|
<div class="segmented language-options" id="languageOptions">
|
|
@@ -282674,10 +282826,12 @@ function renderWebUiPage(language) {
|
|
|
282674
282826
|
</section>
|
|
282675
282827
|
<section class="settings-group">
|
|
282676
282828
|
<h3>${copy.model}</h3>
|
|
282829
|
+
<label class="field-label" for="settingsModelSelect">${copy.model}</label>
|
|
282830
|
+
<select class="field-control" id="settingsModelSelect" aria-label="${copy.model}"></select>
|
|
282677
282831
|
<label class="field-label" for="customModel">${copy.customModel}</label>
|
|
282678
282832
|
<div class="inline-field">
|
|
282679
282833
|
<input id="customModel" type="text" maxlength="200" placeholder="deepseek-v4-pro" />
|
|
282680
|
-
<button class="secondary-button" id="applyModel" type="button">${copy.apply}</button>
|
|
282834
|
+
<button class="secondary-button" id="applyModel" type="button" disabled>${copy.apply}</button>
|
|
282681
282835
|
</div>
|
|
282682
282836
|
</section>
|
|
282683
282837
|
<section class="settings-group">
|
|
@@ -282716,7 +282870,7 @@ function renderWebUiPage(language) {
|
|
|
282716
282870
|
<input class="field-control" id="searchMax" type="number" min="1" max="20" />
|
|
282717
282871
|
</div>
|
|
282718
282872
|
</section>
|
|
282719
|
-
<section class="settings-group skill-settings">
|
|
282873
|
+
<section class="settings-group skill-settings" id="settingsCapabilities">
|
|
282720
282874
|
<div class="setting-row">
|
|
282721
282875
|
<div><h3>${copy.skills}</h3><p>${copy.skillsDescription}</p></div>
|
|
282722
282876
|
<label class="switch"><input id="skillsEnabled" type="checkbox" aria-label="${copy.skills}" /><span class="switch-track" aria-hidden="true"></span></label>
|
|
@@ -282786,7 +282940,7 @@ function renderWebUiPage(language) {
|
|
|
282786
282940
|
<div class="skill-diagnostics" id="skillDiagnostics"></div>
|
|
282787
282941
|
</div>
|
|
282788
282942
|
</section>
|
|
282789
|
-
<section class="settings-group">
|
|
282943
|
+
<section class="settings-group" id="settingsAppearance">
|
|
282790
282944
|
<h3>${copy.theme}</h3>
|
|
282791
282945
|
<div class="theme-options" id="themeOptions">
|
|
282792
282946
|
<button type="button" data-theme-value="system" aria-pressed="false">${copy.system}</button>
|
|
@@ -285480,7 +285634,7 @@ var WEB_UI_FOUNDATION_STYLES = String.raw`
|
|
|
285480
285634
|
--sidebar: #eef0ed;
|
|
285481
285635
|
--sidebar-ink: #202824;
|
|
285482
285636
|
--sidebar-muted: #59645f;
|
|
285483
|
-
--sidebar-faint: #
|
|
285637
|
+
--sidebar-faint: #64706a;
|
|
285484
285638
|
--sidebar-border: rgba(29, 43, 37, 0.11);
|
|
285485
285639
|
--sidebar-surface: rgba(255, 255, 255, 0.5);
|
|
285486
285640
|
--sidebar-active: rgba(255, 255, 255, 0.78);
|
|
@@ -285492,7 +285646,7 @@ var WEB_UI_FOUNDATION_STYLES = String.raw`
|
|
|
285492
285646
|
--ink: #2c3834;
|
|
285493
285647
|
--ink-strong: #111d19;
|
|
285494
285648
|
--muted: #596761;
|
|
285495
|
-
--faint: #
|
|
285649
|
+
--faint: #64716c;
|
|
285496
285650
|
--border: rgba(28, 49, 42, 0.105);
|
|
285497
285651
|
--border-strong: rgba(28, 49, 42, 0.18);
|
|
285498
285652
|
--accent: #4f857b;
|
|
@@ -285543,7 +285697,7 @@ var WEB_UI_FOUNDATION_STYLES = String.raw`
|
|
|
285543
285697
|
--ink: #d8e0e4;
|
|
285544
285698
|
--ink-strong: #f1f5f6;
|
|
285545
285699
|
--muted: #a5b1b8;
|
|
285546
|
-
--faint: #
|
|
285700
|
+
--faint: #81919b;
|
|
285547
285701
|
--border: rgba(220, 231, 236, 0.1);
|
|
285548
285702
|
--border-strong: rgba(220, 231, 236, 0.18);
|
|
285549
285703
|
--accent: #83aca4;
|
|
@@ -285586,7 +285740,7 @@ var WEB_UI_FOUNDATION_STYLES = String.raw`
|
|
|
285586
285740
|
--ink: #d8e0e4;
|
|
285587
285741
|
--ink-strong: #f1f5f6;
|
|
285588
285742
|
--muted: #a5b1b8;
|
|
285589
|
-
--faint: #
|
|
285743
|
+
--faint: #81919b;
|
|
285590
285744
|
--border: rgba(220, 231, 236, 0.1);
|
|
285591
285745
|
--border-strong: rgba(220, 231, 236, 0.18);
|
|
285592
285746
|
--accent: #83aca4;
|
|
@@ -286715,6 +286869,45 @@ var WEB_UI_INSPECTOR_STYLES = String.raw`
|
|
|
286715
286869
|
gap: 10px;
|
|
286716
286870
|
}
|
|
286717
286871
|
|
|
286872
|
+
.settings-index {
|
|
286873
|
+
position: sticky;
|
|
286874
|
+
top: -4px;
|
|
286875
|
+
z-index: 2;
|
|
286876
|
+
display: grid;
|
|
286877
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
286878
|
+
gap: 4px;
|
|
286879
|
+
margin: 0 -4px;
|
|
286880
|
+
padding: 8px 4px 7px;
|
|
286881
|
+
background: color-mix(in srgb, var(--surface) 92%, transparent);
|
|
286882
|
+
border-bottom: 1px solid var(--border);
|
|
286883
|
+
backdrop-filter: blur(12px);
|
|
286884
|
+
}
|
|
286885
|
+
|
|
286886
|
+
.settings-index button {
|
|
286887
|
+
min-width: 0;
|
|
286888
|
+
height: 32px;
|
|
286889
|
+
padding: 0 6px;
|
|
286890
|
+
overflow: hidden;
|
|
286891
|
+
color: var(--muted);
|
|
286892
|
+
background: var(--surface-subtle);
|
|
286893
|
+
border: 1px solid transparent;
|
|
286894
|
+
border-radius: 8px;
|
|
286895
|
+
font-size: 10px;
|
|
286896
|
+
font-weight: 600;
|
|
286897
|
+
text-overflow: ellipsis;
|
|
286898
|
+
white-space: nowrap;
|
|
286899
|
+
}
|
|
286900
|
+
|
|
286901
|
+
.settings-index button:hover {
|
|
286902
|
+
color: var(--ink-strong);
|
|
286903
|
+
background: var(--surface-hover);
|
|
286904
|
+
border-color: var(--border);
|
|
286905
|
+
}
|
|
286906
|
+
|
|
286907
|
+
.settings-group[id] {
|
|
286908
|
+
scroll-margin-top: 52px;
|
|
286909
|
+
}
|
|
286910
|
+
|
|
286718
286911
|
.settings-group > h3 {
|
|
286719
286912
|
margin-bottom: 2px;
|
|
286720
286913
|
}
|
|
@@ -286734,7 +286927,7 @@ var WEB_UI_INSPECTOR_STYLES = String.raw`
|
|
|
286734
286927
|
gap: 10px;
|
|
286735
286928
|
}
|
|
286736
286929
|
|
|
286737
|
-
.language-options {
|
|
286930
|
+
.segmented.language-options {
|
|
286738
286931
|
width: 100%;
|
|
286739
286932
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
286740
286933
|
}
|
|
@@ -286786,6 +286979,27 @@ var WEB_UI_INSPECTOR_STYLES = String.raw`
|
|
|
286786
286979
|
background: var(--surface-hover);
|
|
286787
286980
|
}
|
|
286788
286981
|
|
|
286982
|
+
#applyModel[aria-busy="true"] {
|
|
286983
|
+
position: relative;
|
|
286984
|
+
color: transparent;
|
|
286985
|
+
cursor: progress;
|
|
286986
|
+
opacity: 1;
|
|
286987
|
+
}
|
|
286988
|
+
|
|
286989
|
+
#applyModel[aria-busy="true"]::after {
|
|
286990
|
+
position: absolute;
|
|
286991
|
+
top: 50%;
|
|
286992
|
+
left: 50%;
|
|
286993
|
+
width: 14px;
|
|
286994
|
+
height: 14px;
|
|
286995
|
+
border: 2px solid color-mix(in srgb, var(--accent) 34%, transparent);
|
|
286996
|
+
border-top-color: var(--accent-strong);
|
|
286997
|
+
border-radius: 50%;
|
|
286998
|
+
content: "";
|
|
286999
|
+
animation: spin 0.72s linear infinite;
|
|
287000
|
+
translate: -50% -50%;
|
|
287001
|
+
}
|
|
287002
|
+
|
|
286789
287003
|
.segmented,
|
|
286790
287004
|
.theme-options {
|
|
286791
287005
|
display: grid;
|
|
@@ -287670,6 +287884,11 @@ var WEB_UI_RESPONSIVE_STYLES = String.raw`
|
|
|
287670
287884
|
padding: 0 6px;
|
|
287671
287885
|
}
|
|
287672
287886
|
|
|
287887
|
+
.composer-chip,
|
|
287888
|
+
.composer-select-trigger {
|
|
287889
|
+
height: 36px;
|
|
287890
|
+
}
|
|
287891
|
+
|
|
287673
287892
|
.context-shelf {
|
|
287674
287893
|
padding: 7px;
|
|
287675
287894
|
}
|
|
@@ -287761,18 +287980,6 @@ var WEB_UI_RESPONSIVE_STYLES = String.raw`
|
|
|
287761
287980
|
gap: 8px;
|
|
287762
287981
|
}
|
|
287763
287982
|
|
|
287764
|
-
#contextPickerButton,
|
|
287765
|
-
#attachmentButton {
|
|
287766
|
-
min-width: 29px;
|
|
287767
|
-
justify-content: center;
|
|
287768
|
-
padding-inline: 6px;
|
|
287769
|
-
}
|
|
287770
|
-
|
|
287771
|
-
#contextPickerButton > span:not(.context-chip-count),
|
|
287772
|
-
#attachmentButton > span:not(.context-chip-count) {
|
|
287773
|
-
display: none;
|
|
287774
|
-
}
|
|
287775
|
-
|
|
287776
287983
|
.task-overview-stats {
|
|
287777
287984
|
grid-template-columns: minmax(0, 1fr);
|
|
287778
287985
|
}
|
|
@@ -287793,9 +288000,6 @@ var WEB_UI_RESPONSIVE_STYLES = String.raw`
|
|
|
287793
288000
|
max-width: 34ch;
|
|
287794
288001
|
}
|
|
287795
288002
|
|
|
287796
|
-
.language-options {
|
|
287797
|
-
grid-template-columns: minmax(0, 1fr);
|
|
287798
|
-
}
|
|
287799
288003
|
}
|
|
287800
288004
|
|
|
287801
288005
|
@media (prefers-reduced-motion: reduce) {
|
|
@@ -289248,6 +289452,9 @@ function normalizePath4(path9) {
|
|
|
289248
289452
|
|
|
289249
289453
|
// src/runtime/webui/WebUiRuntime.ts
|
|
289250
289454
|
var WebTurnIdSchema = z55.string().trim().min(8).max(100).regex(/^[a-zA-Z0-9_-]+$/);
|
|
289455
|
+
var AttachmentIdsSchema = z55.array(WebTurnIdSchema).max(4).refine((ids) => new Set(ids).size === ids.length, {
|
|
289456
|
+
message: "Attachment IDs must be unique."
|
|
289457
|
+
});
|
|
289251
289458
|
var MessagePageQuerySchema = z55.object({
|
|
289252
289459
|
before: z55.coerce.number().int().min(1).max(1e7).optional(),
|
|
289253
289460
|
limit: z55.coerce.number().int().min(20).max(100).optional()
|
|
@@ -289255,7 +289462,7 @@ var MessagePageQuerySchema = z55.object({
|
|
|
289255
289462
|
var ChatRequestSchema = z55.object({
|
|
289256
289463
|
prompt: z55.string().trim().min(1).max(1e5),
|
|
289257
289464
|
turnId: WebTurnIdSchema.optional(),
|
|
289258
|
-
attachmentIds:
|
|
289465
|
+
attachmentIds: AttachmentIdsSchema.optional()
|
|
289259
289466
|
}).strict();
|
|
289260
289467
|
var InputQueueIdSchema = z55.string().trim().regex(/^input_[a-zA-Z0-9_-]+$/).max(200);
|
|
289261
289468
|
var InputQueueActionSchema = z55.discriminatedUnion("action", [
|
|
@@ -289263,7 +289470,7 @@ var InputQueueActionSchema = z55.discriminatedUnion("action", [
|
|
|
289263
289470
|
action: z55.literal("enqueue"),
|
|
289264
289471
|
prompt: z55.string().trim().min(1).max(1e5),
|
|
289265
289472
|
mode: z55.enum(["follow_up", "steer"]).default("follow_up"),
|
|
289266
|
-
attachmentIds:
|
|
289473
|
+
attachmentIds: AttachmentIdsSchema.optional()
|
|
289267
289474
|
}).strict(),
|
|
289268
289475
|
z55.object({
|
|
289269
289476
|
action: z55.literal("update"),
|
|
@@ -289422,6 +289629,7 @@ var OrbitWebUiRuntime = class {
|
|
|
289422
289629
|
completionCandidatesPromise;
|
|
289423
289630
|
completionCandidatesCachedAt = 0;
|
|
289424
289631
|
attachments = /* @__PURE__ */ new Map();
|
|
289632
|
+
pendingAttachmentUploads = 0;
|
|
289425
289633
|
constructor(options) {
|
|
289426
289634
|
this.options = options;
|
|
289427
289635
|
this.events = new WebUiEventStream(() => this.activeTurn);
|
|
@@ -289511,7 +289719,6 @@ var OrbitWebUiRuntime = class {
|
|
|
289511
289719
|
this.state = "stopping";
|
|
289512
289720
|
this.events.stop();
|
|
289513
289721
|
this.activeTurn = void 0;
|
|
289514
|
-
this.attachments.clear();
|
|
289515
289722
|
this.token = void 0;
|
|
289516
289723
|
this.handle = void 0;
|
|
289517
289724
|
const server2 = this.server;
|
|
@@ -289521,6 +289728,8 @@ var OrbitWebUiRuntime = class {
|
|
|
289521
289728
|
server2.close(() => resolveClose());
|
|
289522
289729
|
});
|
|
289523
289730
|
}
|
|
289731
|
+
this.attachments.clear();
|
|
289732
|
+
this.pendingAttachmentUploads = 0;
|
|
289524
289733
|
this.state = "stopped";
|
|
289525
289734
|
}
|
|
289526
289735
|
async handleRequest(req, res) {
|
|
@@ -289700,6 +289909,7 @@ var OrbitWebUiRuntime = class {
|
|
|
289700
289909
|
sendJson(res, 404, { error: "Not found" });
|
|
289701
289910
|
}
|
|
289702
289911
|
async handleAttachmentUpload(req, res, url) {
|
|
289912
|
+
let slotReserved = false;
|
|
289703
289913
|
try {
|
|
289704
289914
|
const mediaType = String(req.headers["content-type"] || "").split(";", 1)[0].trim().toLowerCase();
|
|
289705
289915
|
if (!ALLOWED_IMAGE_TYPES.has(mediaType)) {
|
|
@@ -289709,13 +289919,15 @@ var OrbitWebUiRuntime = class {
|
|
|
289709
289919
|
});
|
|
289710
289920
|
return;
|
|
289711
289921
|
}
|
|
289712
|
-
if (this.attachments.size >= IMAGE_ATTACHMENT_STORE_LIMIT) {
|
|
289922
|
+
if (this.attachments.size + this.pendingAttachmentUploads >= IMAGE_ATTACHMENT_STORE_LIMIT) {
|
|
289713
289923
|
sendJson(res, 429, {
|
|
289714
289924
|
ok: false,
|
|
289715
289925
|
message: "Too many pending attachments. Remove an image or retry later."
|
|
289716
289926
|
});
|
|
289717
289927
|
return;
|
|
289718
289928
|
}
|
|
289929
|
+
this.pendingAttachmentUploads += 1;
|
|
289930
|
+
slotReserved = true;
|
|
289719
289931
|
const body = await readBinaryBody(req, IMAGE_ATTACHMENT_LIMIT_BYTES);
|
|
289720
289932
|
if (body.length === 0) {
|
|
289721
289933
|
sendJson(res, 400, { ok: false, message: "Attachment is empty." });
|
|
@@ -289728,7 +289940,7 @@ var OrbitWebUiRuntime = class {
|
|
|
289728
289940
|
});
|
|
289729
289941
|
return;
|
|
289730
289942
|
}
|
|
289731
|
-
const id = `att_${
|
|
289943
|
+
const id = `att_${randomUUID9().replace(/-/g, "")}`;
|
|
289732
289944
|
const rawName = url.searchParams.get("name") || "image";
|
|
289733
289945
|
const name = rawName.replace(/[\u0000-\u001f\u007f\\/]/g, "_").trim().slice(0, 255) || "image";
|
|
289734
289946
|
const attachment = {
|
|
@@ -289748,6 +289960,8 @@ var OrbitWebUiRuntime = class {
|
|
|
289748
289960
|
ok: false,
|
|
289749
289961
|
message: safeWebMessage(error)
|
|
289750
289962
|
});
|
|
289963
|
+
} finally {
|
|
289964
|
+
if (slotReserved) this.pendingAttachmentUploads -= 1;
|
|
289751
289965
|
}
|
|
289752
289966
|
}
|
|
289753
289967
|
async handleReview(req, res, options) {
|
|
@@ -289906,7 +290120,7 @@ var OrbitWebUiRuntime = class {
|
|
|
289906
290120
|
return;
|
|
289907
290121
|
}
|
|
289908
290122
|
const turn = {
|
|
289909
|
-
id: body.turnId ||
|
|
290123
|
+
id: body.turnId || randomUUID9(),
|
|
289910
290124
|
sessionId: safeCall2(() => options.loop?.getSessionId?.()) || "",
|
|
289911
290125
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
289912
290126
|
cancelRequested: false
|
|
@@ -290002,7 +290216,7 @@ var OrbitWebUiRuntime = class {
|
|
|
290002
290216
|
return;
|
|
290003
290217
|
}
|
|
290004
290218
|
const turn = {
|
|
290005
|
-
id: body.turnId ||
|
|
290219
|
+
id: body.turnId || randomUUID9(),
|
|
290006
290220
|
sessionId: safeCall2(() => options.loop?.getSessionId?.()) || "",
|
|
290007
290221
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
290008
290222
|
cancelRequested: false
|
|
@@ -290277,7 +290491,7 @@ async function stopOrbitWebUi() {
|
|
|
290277
290491
|
}
|
|
290278
290492
|
|
|
290279
290493
|
// src/runtime/webui/WebUiApprovalBroker.ts
|
|
290280
|
-
import { randomUUID as
|
|
290494
|
+
import { randomUUID as randomUUID10 } from "crypto";
|
|
290281
290495
|
var WEB_APPROVAL_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
290282
290496
|
var MAX_QUEUED_APPROVALS = 16;
|
|
290283
290497
|
var WebUiApprovalBroker = class {
|
|
@@ -290344,7 +290558,7 @@ var WebUiApprovalBroker = class {
|
|
|
290344
290558
|
};
|
|
290345
290559
|
function sanitizeApprovalRequest(request) {
|
|
290346
290560
|
return {
|
|
290347
|
-
id:
|
|
290561
|
+
id: randomUUID10(),
|
|
290348
290562
|
kind: request.kind,
|
|
290349
290563
|
title: safeApprovalText2(request.title, 200, false),
|
|
290350
290564
|
reason: safeApprovalText2(request.reason, 1500, false),
|
|
@@ -290771,7 +290985,7 @@ async function handleWorkspaceConfigCommand(configArgument, dependencies) {
|
|
|
290771
290985
|
|
|
290772
290986
|
// src/runtime/commands/ContextCommandHandler.ts
|
|
290773
290987
|
import glob5 from "fast-glob";
|
|
290774
|
-
import { existsSync as existsSync18, statSync as
|
|
290988
|
+
import { existsSync as existsSync18, statSync as statSync4 } from "fs";
|
|
290775
290989
|
import { isAbsolute as isAbsolute6, relative as relative8, resolve as resolve12 } from "path";
|
|
290776
290990
|
import picocolors12 from "picocolors";
|
|
290777
290991
|
function parseAddArgument(argument) {
|
|
@@ -290959,7 +291173,7 @@ ${matched.map((file) => ` \u2022 ${file}`).join("\n")}`
|
|
|
290959
291173
|
}
|
|
290960
291174
|
const relativePath = toWorkspaceRelative(cwd, absolutePath);
|
|
290961
291175
|
try {
|
|
290962
|
-
if (
|
|
291176
|
+
if (statSync4(absolutePath).isDirectory()) {
|
|
290963
291177
|
const files = await glob5("**/*", {
|
|
290964
291178
|
cwd: absolutePath,
|
|
290965
291179
|
onlyFiles: true,
|
|
@@ -292231,7 +292445,7 @@ function copyBooleanCapability(source, sourceKey, target, targetKey) {
|
|
|
292231
292445
|
|
|
292232
292446
|
// src/runtime/ProjectLauncher.ts
|
|
292233
292447
|
import { spawn as spawn4 } from "child_process";
|
|
292234
|
-
import { existsSync as existsSync20, mkdirSync as mkdirSync7, realpathSync as realpathSync3, statSync as
|
|
292448
|
+
import { existsSync as existsSync20, mkdirSync as mkdirSync7, realpathSync as realpathSync3, statSync as statSync5 } from "fs";
|
|
292235
292449
|
import { dirname as dirname12, isAbsolute as isAbsolute7, parse as parse4, resolve as resolve13 } from "path";
|
|
292236
292450
|
var PROJECT_WEB_UI_READY_MESSAGE = "orbit-webui-ready";
|
|
292237
292451
|
async function launchOrbitProject(request, options = {}) {
|
|
@@ -292331,7 +292545,7 @@ function createProjectDirectory(projectPath) {
|
|
|
292331
292545
|
"The parent folder does not exist. Choose an existing location first."
|
|
292332
292546
|
);
|
|
292333
292547
|
}
|
|
292334
|
-
if (!
|
|
292548
|
+
if (!statSync5(parentPath).isDirectory()) {
|
|
292335
292549
|
throw new Error("The project parent path must be a directory.");
|
|
292336
292550
|
}
|
|
292337
292551
|
try {
|
|
@@ -292351,7 +292565,7 @@ function requireProjectDirectory(projectPath) {
|
|
|
292351
292565
|
if (!existsSync20(projectPath)) {
|
|
292352
292566
|
throw new Error("Project folder does not exist.");
|
|
292353
292567
|
}
|
|
292354
|
-
if (!
|
|
292568
|
+
if (!statSync5(projectPath).isDirectory()) {
|
|
292355
292569
|
throw new Error("Project path must point to a directory.");
|
|
292356
292570
|
}
|
|
292357
292571
|
}
|
|
@@ -293086,6 +293300,9 @@ function parseReviewCommand(rawArguments) {
|
|
|
293086
293300
|
const [first = "", ...rest] = input.split(/\s+/);
|
|
293087
293301
|
const preset = ReviewPresetSchema.safeParse(first);
|
|
293088
293302
|
if (preset.success) {
|
|
293303
|
+
if (rest.length > 0) {
|
|
293304
|
+
throw new Error("Too many /review arguments.");
|
|
293305
|
+
}
|
|
293089
293306
|
return {
|
|
293090
293307
|
preset: preset.data,
|
|
293091
293308
|
scope: { kind: "working-tree" }
|
|
@@ -293147,7 +293364,7 @@ ${request.customInstructions}` : "";
|
|
|
293147
293364
|
}
|
|
293148
293365
|
|
|
293149
293366
|
// src/runtime/CommandRouter.ts
|
|
293150
|
-
import { randomUUID as
|
|
293367
|
+
import { randomUUID as randomUUID11 } from "crypto";
|
|
293151
293368
|
var require2 = createRequire2(import.meta.url);
|
|
293152
293369
|
function stripAnsi4(value) {
|
|
293153
293370
|
return value.replace(/\u001b\[[0-9;]*m/g, "");
|
|
@@ -294287,7 +294504,7 @@ ${picocolors18.green("\u2714")} Switched security mode to: ${picocolors18.green(
|
|
|
294287
294504
|
queuedInput.text,
|
|
294288
294505
|
queuedInteraction
|
|
294289
294506
|
) : this.loop;
|
|
294290
|
-
const turnId =
|
|
294507
|
+
const turnId = randomUUID11();
|
|
294291
294508
|
eventBus.emitEvent("ui_turn_started", {
|
|
294292
294509
|
turnId,
|
|
294293
294510
|
source: "web",
|
|
@@ -294662,6 +294879,22 @@ ${picocolors18.green("\u2714")} Switched security mode to: ${picocolors18.green(
|
|
|
294662
294879
|
message: "Wait for the active task to finish before changing settings."
|
|
294663
294880
|
};
|
|
294664
294881
|
}
|
|
294882
|
+
const changesProvider = Boolean(patch.provider) && patch.provider !== this.providerInstance.id;
|
|
294883
|
+
if (patch.model && patch.model !== "__auto__" && !changesProvider) {
|
|
294884
|
+
const providerId = this.config.provider.default;
|
|
294885
|
+
const availableModels = getProviderModelCandidates(
|
|
294886
|
+
this.config,
|
|
294887
|
+
providerId
|
|
294888
|
+
);
|
|
294889
|
+
const currentOverride = this.loop.getModelOverride();
|
|
294890
|
+
const allowExistingUnlisted = !isOfficialDeepSeekProvider(this.config, providerId) && patch.model === currentOverride;
|
|
294891
|
+
if (!availableModels.includes(patch.model) && !allowExistingUnlisted) {
|
|
294892
|
+
return {
|
|
294893
|
+
ok: false,
|
|
294894
|
+
message: `Model is not available for provider ${providerId}: ${patch.model}`
|
|
294895
|
+
};
|
|
294896
|
+
}
|
|
294897
|
+
}
|
|
294665
294898
|
const violation = validateManagedRuntimeChange(this.config, patch);
|
|
294666
294899
|
if (violation) return { ok: false, message: violation };
|
|
294667
294900
|
const draft = JSON.parse(JSON.stringify(this.config));
|
|
@@ -295573,7 +295806,7 @@ Risk Warning: ${reason}`);
|
|
|
295573
295806
|
}
|
|
295574
295807
|
const routedInput = routeResult.input ?? trimmed;
|
|
295575
295808
|
loop.prepareUserTurn(routedInput);
|
|
295576
|
-
const terminalTurnId =
|
|
295809
|
+
const terminalTurnId = randomUUID12();
|
|
295577
295810
|
eventBus.emitEvent("ui_turn_started", {
|
|
295578
295811
|
turnId: terminalTurnId,
|
|
295579
295812
|
source: "terminal",
|
|
@@ -295632,7 +295865,7 @@ Risk Warning: ${reason}`);
|
|
|
295632
295865
|
\u25CF Guided instruction received. Replanning execution...`
|
|
295633
295866
|
);
|
|
295634
295867
|
loop.prepareQueuedUserTurn(queuedInput);
|
|
295635
|
-
const guidedTurnId =
|
|
295868
|
+
const guidedTurnId = randomUUID12();
|
|
295636
295869
|
eventBus.emitEvent("ui_turn_started", {
|
|
295637
295870
|
turnId: guidedTurnId,
|
|
295638
295871
|
source: "terminal",
|
|
@@ -296389,7 +296622,7 @@ var PROVIDER_TEMPLATES = [
|
|
|
296389
296622
|
envVar: "DEEPSEEK_API_KEY",
|
|
296390
296623
|
type: "openai-compatible",
|
|
296391
296624
|
baseUrl: "https://api.deepseek.com",
|
|
296392
|
-
discoverModels:
|
|
296625
|
+
discoverModels: true,
|
|
296393
296626
|
deepSeekApiFormat: "auto"
|
|
296394
296627
|
},
|
|
296395
296628
|
{
|
|
@@ -296865,7 +297098,7 @@ import {
|
|
|
296865
297098
|
writeFileSync as writeFileSync9
|
|
296866
297099
|
} from "fs";
|
|
296867
297100
|
import { dirname as dirname14, resolve as resolve15 } from "path";
|
|
296868
|
-
import { randomUUID as
|
|
297101
|
+
import { randomUUID as randomUUID13 } from "crypto";
|
|
296869
297102
|
import { z as z68 } from "zod";
|
|
296870
297103
|
var TraceOptionsSchema = z68.object({
|
|
296871
297104
|
full: z68.boolean().default(false),
|
|
@@ -296893,7 +297126,7 @@ function runTraceExport(cwd, sessionId, options = {}) {
|
|
|
296893
297126
|
} else {
|
|
296894
297127
|
mkdirSync8(directory, { recursive: true });
|
|
296895
297128
|
}
|
|
296896
|
-
const temporaryPath = `${outputPath}.${process.pid}.${
|
|
297129
|
+
const temporaryPath = `${outputPath}.${process.pid}.${randomUUID13()}.tmp`;
|
|
296897
297130
|
try {
|
|
296898
297131
|
writeFileSync9(temporaryPath, serialized, {
|
|
296899
297132
|
encoding: "utf8",
|
|
@@ -296920,7 +297153,7 @@ import {
|
|
|
296920
297153
|
writeFileSync as writeFileSync10
|
|
296921
297154
|
} from "fs";
|
|
296922
297155
|
import { basename as basename5, dirname as dirname15, join as join19 } from "path";
|
|
296923
|
-
import { randomUUID as
|
|
297156
|
+
import { randomUUID as randomUUID14 } from "crypto";
|
|
296924
297157
|
import { promisify as promisify5 } from "util";
|
|
296925
297158
|
import picocolors25 from "picocolors";
|
|
296926
297159
|
import { parse as parseYaml4 } from "yaml";
|
|
@@ -297259,7 +297492,7 @@ function writeJsonAtomically2(filePath, value) {
|
|
|
297259
297492
|
} else {
|
|
297260
297493
|
mkdirSync9(directory, { recursive: true });
|
|
297261
297494
|
}
|
|
297262
|
-
const temporaryPath = `${filePath}.${process.pid}.${
|
|
297495
|
+
const temporaryPath = `${filePath}.${process.pid}.${randomUUID14()}.tmp`;
|
|
297263
297496
|
try {
|
|
297264
297497
|
writeFileSync10(temporaryPath, JSON.stringify(value, null, 2), {
|
|
297265
297498
|
encoding: "utf8",
|
|
@@ -297284,7 +297517,13 @@ import { resolve as resolve17 } from "path";
|
|
|
297284
297517
|
import { z as z71 } from "zod";
|
|
297285
297518
|
|
|
297286
297519
|
// src/runtime/CleanupManager.ts
|
|
297287
|
-
import {
|
|
297520
|
+
import {
|
|
297521
|
+
lstatSync as lstatSync10,
|
|
297522
|
+
readdirSync as readdirSync9,
|
|
297523
|
+
realpathSync as realpathSync4,
|
|
297524
|
+
rmSync as rmSync9,
|
|
297525
|
+
unlinkSync as unlinkSync6
|
|
297526
|
+
} from "fs";
|
|
297288
297527
|
import { homedir as homedir11 } from "os";
|
|
297289
297528
|
import { basename as basename6, join as join20, parse as parse5, resolve as resolve16 } from "path";
|
|
297290
297529
|
import { z as z70 } from "zod";
|
|
@@ -297330,17 +297569,42 @@ function executeCleanupPlan(plan) {
|
|
|
297330
297569
|
const result = { removed: [], skipped: [] };
|
|
297331
297570
|
for (const target of plan.targets) {
|
|
297332
297571
|
assertSafeOrbitDataPath(target.path);
|
|
297333
|
-
|
|
297572
|
+
let stat;
|
|
297573
|
+
try {
|
|
297574
|
+
stat = lstatSync10(target.path);
|
|
297575
|
+
} catch (error) {
|
|
297576
|
+
if (!isMissingPathError(error)) {
|
|
297577
|
+
throw new Error(
|
|
297578
|
+
`Unable to verify cleanup target (${safeInventoryWarning(target.path, error)}).`,
|
|
297579
|
+
{ cause: error }
|
|
297580
|
+
);
|
|
297581
|
+
}
|
|
297334
297582
|
result.skipped.push(target.path);
|
|
297335
297583
|
continue;
|
|
297336
297584
|
}
|
|
297337
|
-
|
|
297585
|
+
if (stat.isSymbolicLink()) {
|
|
297586
|
+
unlinkSync6(target.path);
|
|
297587
|
+
} else {
|
|
297588
|
+
rmSync9(target.path, { recursive: true, force: true, maxRetries: 3 });
|
|
297589
|
+
}
|
|
297338
297590
|
result.removed.push(target.path);
|
|
297339
297591
|
}
|
|
297340
297592
|
return result;
|
|
297341
297593
|
}
|
|
297342
297594
|
function inspectPath(targetPath) {
|
|
297343
|
-
|
|
297595
|
+
let targetStat;
|
|
297596
|
+
try {
|
|
297597
|
+
targetStat = lstatSync10(targetPath);
|
|
297598
|
+
} catch (error) {
|
|
297599
|
+
if (!isMissingPathError(error)) {
|
|
297600
|
+
return {
|
|
297601
|
+
exists: true,
|
|
297602
|
+
files: 0,
|
|
297603
|
+
directories: 0,
|
|
297604
|
+
bytes: 0,
|
|
297605
|
+
warnings: [safeInventoryWarning(targetPath, error)]
|
|
297606
|
+
};
|
|
297607
|
+
}
|
|
297344
297608
|
return {
|
|
297345
297609
|
exists: false,
|
|
297346
297610
|
files: 0,
|
|
@@ -297351,13 +297615,17 @@ function inspectPath(targetPath) {
|
|
|
297351
297615
|
}
|
|
297352
297616
|
const totals = { files: 0, directories: 0, bytes: 0 };
|
|
297353
297617
|
const warnings = [];
|
|
297354
|
-
const visit = (currentPath) => {
|
|
297618
|
+
const visit = (currentPath, knownStat) => {
|
|
297355
297619
|
let stat;
|
|
297356
|
-
|
|
297357
|
-
stat =
|
|
297358
|
-
}
|
|
297359
|
-
|
|
297360
|
-
|
|
297620
|
+
if (knownStat) {
|
|
297621
|
+
stat = knownStat;
|
|
297622
|
+
} else {
|
|
297623
|
+
try {
|
|
297624
|
+
stat = lstatSync10(currentPath);
|
|
297625
|
+
} catch (error) {
|
|
297626
|
+
warnings.push(safeInventoryWarning(currentPath, error));
|
|
297627
|
+
return;
|
|
297628
|
+
}
|
|
297361
297629
|
}
|
|
297362
297630
|
if (stat.isSymbolicLink()) {
|
|
297363
297631
|
totals.files++;
|
|
@@ -297378,7 +297646,7 @@ function inspectPath(targetPath) {
|
|
|
297378
297646
|
warnings.push(safeInventoryWarning(currentPath, error));
|
|
297379
297647
|
}
|
|
297380
297648
|
};
|
|
297381
|
-
visit(targetPath);
|
|
297649
|
+
visit(targetPath, targetStat);
|
|
297382
297650
|
return { exists: true, ...totals, warnings };
|
|
297383
297651
|
}
|
|
297384
297652
|
function assertSafeOrbitDataPath(targetPath) {
|
|
@@ -297389,23 +297657,29 @@ function assertSafeOrbitDataPath(targetPath) {
|
|
|
297389
297657
|
if (basename6(absolutePath).toLowerCase() !== ".orbit") {
|
|
297390
297658
|
throw new Error("Cleanup targets must be an Orbit data directory.");
|
|
297391
297659
|
}
|
|
297392
|
-
|
|
297660
|
+
const parentPath = resolve16(absolutePath, "..");
|
|
297661
|
+
if (parentPath === parse5(absolutePath).root) {
|
|
297393
297662
|
throw new Error(
|
|
297394
297663
|
"Refusing to clean an Orbit directory directly under a filesystem root."
|
|
297395
297664
|
);
|
|
297396
297665
|
}
|
|
297666
|
+
try {
|
|
297667
|
+
const canonicalParent = realpathSync4.native(parentPath);
|
|
297668
|
+
if (canonicalParent === parse5(canonicalParent).root) {
|
|
297669
|
+
throw new Error(
|
|
297670
|
+
"Refusing to clean an Orbit directory through a filesystem-root link."
|
|
297671
|
+
);
|
|
297672
|
+
}
|
|
297673
|
+
} catch (error) {
|
|
297674
|
+
if (!isMissingPathError(error)) throw error;
|
|
297675
|
+
}
|
|
297397
297676
|
}
|
|
297398
297677
|
function pathIdentity(targetPath) {
|
|
297399
297678
|
const normalized = resolve16(targetPath).replace(/\\/g, "/");
|
|
297400
297679
|
return process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
297401
297680
|
}
|
|
297402
|
-
function
|
|
297403
|
-
|
|
297404
|
-
lstatSync10(targetPath);
|
|
297405
|
-
return true;
|
|
297406
|
-
} catch {
|
|
297407
|
-
return false;
|
|
297408
|
-
}
|
|
297681
|
+
function isMissingPathError(error) {
|
|
297682
|
+
return typeof error === "object" && error !== null && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR");
|
|
297409
297683
|
}
|
|
297410
297684
|
function safeInventoryWarning(targetPath, error) {
|
|
297411
297685
|
const code = typeof error === "object" && error !== null && "code" in error && typeof error.code === "string" ? error.code : "unreadable";
|
|
@@ -297545,7 +297819,7 @@ import {
|
|
|
297545
297819
|
rmSync as rmSync10,
|
|
297546
297820
|
writeFileSync as writeFileSync11
|
|
297547
297821
|
} from "fs";
|
|
297548
|
-
import { createHash as createHash9, randomUUID as
|
|
297822
|
+
import { createHash as createHash9, randomUUID as randomUUID15 } from "crypto";
|
|
297549
297823
|
import { dirname as dirname16, isAbsolute as isAbsolute8, join as join21, relative as relative9, resolve as resolve18, sep as sep2 } from "path";
|
|
297550
297824
|
import { z as z74 } from "zod";
|
|
297551
297825
|
var MAX_BACKUP_BYTES = 64 * 1024 * 1024;
|
|
@@ -297656,7 +297930,7 @@ function createProjectBackup(projectDirectory) {
|
|
|
297656
297930
|
function writeProjectBackup(outputPath, bundle) {
|
|
297657
297931
|
const destination = resolve18(outputPath);
|
|
297658
297932
|
mkdirSync10(dirname16(destination), { recursive: true });
|
|
297659
|
-
const temporaryPath = `${destination}.${process.pid}.${
|
|
297933
|
+
const temporaryPath = `${destination}.${process.pid}.${randomUUID15()}.tmp`;
|
|
297660
297934
|
try {
|
|
297661
297935
|
writeFileSync11(
|
|
297662
297936
|
temporaryPath,
|
|
@@ -297702,7 +297976,7 @@ function restoreProjectBackup(projectDirectory, bundle, options = {}) {
|
|
|
297702
297976
|
for (const { file, destination } of planned) {
|
|
297703
297977
|
assertDirectoryChainHasNoSymlink(orbitRoot, dirname16(destination));
|
|
297704
297978
|
mkdirSync10(dirname16(destination), { recursive: true });
|
|
297705
|
-
const temporaryPath = `${destination}.${process.pid}.${
|
|
297979
|
+
const temporaryPath = `${destination}.${process.pid}.${randomUUID15()}.tmp`;
|
|
297706
297980
|
try {
|
|
297707
297981
|
writeFileSync11(temporaryPath, Buffer.from(file.content, "base64"), {
|
|
297708
297982
|
mode: 384
|
|
@@ -297794,7 +298068,7 @@ function replaceFileAtomically2(temporaryPath, destination) {
|
|
|
297794
298068
|
renameSync8(temporaryPath, destination);
|
|
297795
298069
|
return;
|
|
297796
298070
|
}
|
|
297797
|
-
const previousPath = `${destination}.${process.pid}.${
|
|
298071
|
+
const previousPath = `${destination}.${process.pid}.${randomUUID15()}.bak`;
|
|
297798
298072
|
renameSync8(destination, previousPath);
|
|
297799
298073
|
try {
|
|
297800
298074
|
renameSync8(temporaryPath, destination);
|
|
@@ -297920,7 +298194,7 @@ import {
|
|
|
297920
298194
|
rmSync as rmSync11,
|
|
297921
298195
|
writeFileSync as writeFileSync12
|
|
297922
298196
|
} from "fs";
|
|
297923
|
-
import { randomUUID as
|
|
298197
|
+
import { randomUUID as randomUUID16 } from "crypto";
|
|
297924
298198
|
import { dirname as dirname17, isAbsolute as isAbsolute9, join as join26, relative as relative10, resolve as resolve20, sep as sep3 } from "path";
|
|
297925
298199
|
import { homedir as homedir12 } from "os";
|
|
297926
298200
|
import { z as z76 } from "zod";
|
|
@@ -297972,9 +298246,9 @@ var ExtensionManager = class {
|
|
|
297972
298246
|
const target = join26(this.extensionsDir, manifest.id);
|
|
297973
298247
|
const staging = join26(
|
|
297974
298248
|
this.extensionsDir,
|
|
297975
|
-
`.install-${manifest.id}-${
|
|
298249
|
+
`.install-${manifest.id}-${randomUUID16()}`
|
|
297976
298250
|
);
|
|
297977
|
-
const transactionId =
|
|
298251
|
+
const transactionId = randomUUID16();
|
|
297978
298252
|
const targetBackup = join26(
|
|
297979
298253
|
this.extensionsDir,
|
|
297980
298254
|
`.rollback-${manifest.id}-${transactionId}`
|
|
@@ -298085,7 +298359,7 @@ var ExtensionManager = class {
|
|
|
298085
298359
|
if (!installed) return false;
|
|
298086
298360
|
const rollbackRoot = join26(
|
|
298087
298361
|
this.orbitDir,
|
|
298088
|
-
`.extension-remove-rollback-${id}-${
|
|
298362
|
+
`.extension-remove-rollback-${id}-${randomUUID16()}`
|
|
298089
298363
|
);
|
|
298090
298364
|
const targets = [
|
|
298091
298365
|
{ target: installed.path, backup: join26(rollbackRoot, "package") },
|
|
@@ -298391,7 +298665,7 @@ function removeExtension(id) {
|
|
|
298391
298665
|
}
|
|
298392
298666
|
|
|
298393
298667
|
// src/index.ts
|
|
298394
|
-
import { existsSync as existsSync31, realpathSync as
|
|
298668
|
+
import { existsSync as existsSync31, realpathSync as realpathSync5, statSync as statSync6 } from "fs";
|
|
298395
298669
|
import { resolve as resolve21 } from "path";
|
|
298396
298670
|
|
|
298397
298671
|
// src/runtime/CliRunOverrides.ts
|
|
@@ -298621,12 +298895,12 @@ program.command("webui").description("start Orbit as a browser-first local codin
|
|
|
298621
298895
|
fullAccess: !!options.yes
|
|
298622
298896
|
});
|
|
298623
298897
|
const requestedCwd = resolve21(localOptions.cwd || process.cwd());
|
|
298624
|
-
if (!existsSync31(requestedCwd) || !
|
|
298898
|
+
if (!existsSync31(requestedCwd) || !statSync6(requestedCwd).isDirectory()) {
|
|
298625
298899
|
throw new Error(
|
|
298626
298900
|
`Web UI project directory does not exist: ${requestedCwd}`
|
|
298627
298901
|
);
|
|
298628
298902
|
}
|
|
298629
|
-
const cwd =
|
|
298903
|
+
const cwd = realpathSync5.native(requestedCwd);
|
|
298630
298904
|
const outcome = await runAgent(cwd, void 0, overrides, false, {
|
|
298631
298905
|
webUi: { port }
|
|
298632
298906
|
});
|