@orbit-build/cli 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/index.js +1190 -536
- package/package.json +1 -1
- package/skills/cumcm-draft/SKILL.md +3 -1
- package/skills/cumcm-draft/assets/project-template/paper/ai-use-log.md +2 -2
- package/skills/cumcm-draft/assets/project-template/paper/contest-profile.json +1 -0
- package/skills/cumcm-draft/references/code-and-output-style.md +4 -1
- package/skills/cumcm-draft/scripts/evidence_freeze.py +11 -0
- package/skills/cumcm-draft/scripts/validate_project.py +146 -6
package/dist/index.js
CHANGED
|
@@ -238208,6 +238208,81 @@ function generateId(prefix) {
|
|
|
238208
238208
|
var HIDDEN_CHILD_PROCESS_OPTIONS = Object.freeze({
|
|
238209
238209
|
windowsHide: true
|
|
238210
238210
|
});
|
|
238211
|
+
var SAFE_CHILD_ENV_NAMES = new Set(
|
|
238212
|
+
[
|
|
238213
|
+
"ALLUSERSPROFILE",
|
|
238214
|
+
"APPDATA",
|
|
238215
|
+
"CI",
|
|
238216
|
+
"COLORTERM",
|
|
238217
|
+
"COMSPEC",
|
|
238218
|
+
"HOME",
|
|
238219
|
+
"HOMEDRIVE",
|
|
238220
|
+
"HOMEPATH",
|
|
238221
|
+
"LANG",
|
|
238222
|
+
"LOCALAPPDATA",
|
|
238223
|
+
"LOGNAME",
|
|
238224
|
+
"NUMBER_OF_PROCESSORS",
|
|
238225
|
+
"OS",
|
|
238226
|
+
"PATH",
|
|
238227
|
+
"PATHEXT",
|
|
238228
|
+
"PROCESSOR_ARCHITECTURE",
|
|
238229
|
+
"PROGRAMDATA",
|
|
238230
|
+
"PROGRAMFILES",
|
|
238231
|
+
"PROGRAMFILES(X86)",
|
|
238232
|
+
"PROGRAMW6432",
|
|
238233
|
+
"PUBLIC",
|
|
238234
|
+
"SYSTEMDRIVE",
|
|
238235
|
+
"SYSTEMROOT",
|
|
238236
|
+
"TEMP",
|
|
238237
|
+
"TERM",
|
|
238238
|
+
"TMP",
|
|
238239
|
+
"TMPDIR",
|
|
238240
|
+
"USER",
|
|
238241
|
+
"USERDOMAIN",
|
|
238242
|
+
"USERNAME",
|
|
238243
|
+
"USERPROFILE",
|
|
238244
|
+
"WINDIR",
|
|
238245
|
+
"XDG_CACHE_HOME",
|
|
238246
|
+
"XDG_CONFIG_HOME",
|
|
238247
|
+
"XDG_DATA_HOME"
|
|
238248
|
+
].map((name) => name.toUpperCase())
|
|
238249
|
+
);
|
|
238250
|
+
var SENSITIVE_CHILD_ENV_NAME = /(?:^|_)(?:API_?KEY|TOKEN|SECRET|PASSWORD|PASSWD|CREDENTIALS?|PRIVATE_?KEY|ACCESS_?KEY|AUTH(?:ORIZATION)?|COOKIE|SESSION_?ID)(?:$|_)/i;
|
|
238251
|
+
var SENSITIVE_CHILD_ENV_EXACT = /* @__PURE__ */ new Set([
|
|
238252
|
+
"AWS_WEB_IDENTITY_TOKEN_FILE",
|
|
238253
|
+
"AZURE_CONFIG_DIR",
|
|
238254
|
+
"GOOGLE_APPLICATION_CREDENTIALS",
|
|
238255
|
+
"GIT_ASKPASS",
|
|
238256
|
+
"GIT_SSH",
|
|
238257
|
+
"GIT_SSH_COMMAND",
|
|
238258
|
+
"KUBECONFIG",
|
|
238259
|
+
"SSH_AGENT_PID",
|
|
238260
|
+
"SSH_AUTH_SOCK"
|
|
238261
|
+
]);
|
|
238262
|
+
function containsUrlCredential(name, value) {
|
|
238263
|
+
if (!/(?:^|_)(?:HTTP|HTTPS|ALL)_PROXY$/i.test(name)) return false;
|
|
238264
|
+
try {
|
|
238265
|
+
const url = new URL(value);
|
|
238266
|
+
return Boolean(url.username || url.password);
|
|
238267
|
+
} catch {
|
|
238268
|
+
return true;
|
|
238269
|
+
}
|
|
238270
|
+
}
|
|
238271
|
+
function buildSanitizedChildEnvironment(options = {}) {
|
|
238272
|
+
const source = options.source ?? process.env;
|
|
238273
|
+
const environment = {};
|
|
238274
|
+
for (const [name, value] of Object.entries(source)) {
|
|
238275
|
+
const upperName = name.toUpperCase();
|
|
238276
|
+
if (value !== void 0 && !upperName.startsWith("ORBIT_") && !SENSITIVE_CHILD_ENV_NAME.test(upperName) && !SENSITIVE_CHILD_ENV_EXACT.has(upperName) && !containsUrlCredential(upperName, value) && (options.mode !== "minimal" || SAFE_CHILD_ENV_NAMES.has(upperName) || upperName.startsWith("LC_"))) {
|
|
238277
|
+
environment[name] = value;
|
|
238278
|
+
}
|
|
238279
|
+
}
|
|
238280
|
+
for (const [name, value] of Object.entries(options.extra ?? {})) {
|
|
238281
|
+
if (value !== void 0) environment[name] = value;
|
|
238282
|
+
}
|
|
238283
|
+
environment.ORBIT_CHILD_PROCESS = "1";
|
|
238284
|
+
return environment;
|
|
238285
|
+
}
|
|
238211
238286
|
function normalizePath(p) {
|
|
238212
238287
|
return normalize(p).replace(/\\/g, "/");
|
|
238213
238288
|
}
|
|
@@ -238388,14 +238463,59 @@ var SECRET_PATTERNS = [
|
|
|
238388
238463
|
replacement: "$1$2$3***REDACTED***$3"
|
|
238389
238464
|
}
|
|
238390
238465
|
];
|
|
238466
|
+
var REGISTERED_SECRET_LIMIT = 256;
|
|
238467
|
+
var registeredSecrets = /* @__PURE__ */ new Map();
|
|
238468
|
+
function registerSecretForRedaction(secret) {
|
|
238469
|
+
const normalized = secret.trim();
|
|
238470
|
+
if (normalized.length < 6) return;
|
|
238471
|
+
const references = registeredSecrets.get(normalized);
|
|
238472
|
+
if (references !== void 0) {
|
|
238473
|
+
registeredSecrets.set(normalized, references + 1);
|
|
238474
|
+
return;
|
|
238475
|
+
}
|
|
238476
|
+
if (registeredSecrets.size >= REGISTERED_SECRET_LIMIT) {
|
|
238477
|
+
const oldest = registeredSecrets.keys().next().value;
|
|
238478
|
+
if (typeof oldest === "string") registeredSecrets.delete(oldest);
|
|
238479
|
+
}
|
|
238480
|
+
registeredSecrets.set(normalized, 1);
|
|
238481
|
+
}
|
|
238482
|
+
function unregisterSecretForRedaction(secret) {
|
|
238483
|
+
const normalized = secret.trim();
|
|
238484
|
+
const references = registeredSecrets.get(normalized);
|
|
238485
|
+
if (references === void 0) return;
|
|
238486
|
+
if (references <= 1) registeredSecrets.delete(normalized);
|
|
238487
|
+
else registeredSecrets.set(normalized, references - 1);
|
|
238488
|
+
}
|
|
238391
238489
|
function redactSecrets(text2) {
|
|
238392
238490
|
if (!text2) return text2;
|
|
238393
238491
|
let redacted = text2;
|
|
238492
|
+
for (const secret of [...registeredSecrets.keys()].sort(
|
|
238493
|
+
(left, right) => right.length - left.length
|
|
238494
|
+
)) {
|
|
238495
|
+
redacted = redacted.split(secret).join("***REDACTED***");
|
|
238496
|
+
}
|
|
238394
238497
|
for (const { pattern, replacement } of SECRET_PATTERNS) {
|
|
238395
238498
|
redacted = redacted.replace(pattern, replacement);
|
|
238396
238499
|
}
|
|
238397
238500
|
return redacted;
|
|
238398
238501
|
}
|
|
238502
|
+
function redactSensitiveValue(value) {
|
|
238503
|
+
return redactUnknown(value, /* @__PURE__ */ new WeakSet());
|
|
238504
|
+
}
|
|
238505
|
+
function redactUnknown(value, seen) {
|
|
238506
|
+
if (typeof value === "string") return redactSecrets(value);
|
|
238507
|
+
if (Array.isArray(value))
|
|
238508
|
+
return value.map((item) => redactUnknown(item, seen));
|
|
238509
|
+
if (!value || typeof value !== "object") return value;
|
|
238510
|
+
if (seen.has(value)) return "[Circular]";
|
|
238511
|
+
seen.add(value);
|
|
238512
|
+
const redacted = {};
|
|
238513
|
+
for (const [key, item] of Object.entries(value)) {
|
|
238514
|
+
redacted[key] = redactUnknown(item, seen);
|
|
238515
|
+
}
|
|
238516
|
+
seen.delete(value);
|
|
238517
|
+
return redacted;
|
|
238518
|
+
}
|
|
238399
238519
|
var ANSI_ESCAPE_PATTERN = /\u001b\[[0-?]*[ -/]*[@-~]/g;
|
|
238400
238520
|
var CONTROL_CHARACTER_PATTERN = /[\u0000-\u0009\u000b\u000c\u000e-\u001f\u007f]+/g;
|
|
238401
238521
|
function sanitizeExternalErrorMessage(value, options = {}) {
|
|
@@ -238808,7 +238928,7 @@ import { join as join4 } from "path";
|
|
|
238808
238928
|
import { existsSync as existsSync22 } from "fs";
|
|
238809
238929
|
import { parse } from "yaml";
|
|
238810
238930
|
import { execFileSync as execFileSync2 } from "child_process";
|
|
238811
|
-
import { chmodSync as chmodSync2, unlinkSync, writeFileSync as writeFileSync3 } from "fs";
|
|
238931
|
+
import { chmodSync as chmodSync2, closeSync as closeSync2, openSync as openSync2, unlinkSync, writeFileSync as writeFileSync3 } from "fs";
|
|
238812
238932
|
import { join as join2 } from "path";
|
|
238813
238933
|
import { homedir } from "os";
|
|
238814
238934
|
import crypto from "crypto";
|
|
@@ -239074,9 +239194,20 @@ var ConfigSchema = z2.object({
|
|
|
239074
239194
|
protectedPaths: z2.array(z2.string().min(1).max(4096)).max(1e3).default([
|
|
239075
239195
|
".env",
|
|
239076
239196
|
".env.*",
|
|
239197
|
+
".git/**",
|
|
239198
|
+
".orbit/**",
|
|
239199
|
+
".npmrc",
|
|
239200
|
+
".pypirc",
|
|
239201
|
+
".netrc",
|
|
239077
239202
|
"id_rsa",
|
|
239078
239203
|
"id_ed25519",
|
|
239079
239204
|
".ssh/**",
|
|
239205
|
+
".gnupg/**",
|
|
239206
|
+
".aws/**",
|
|
239207
|
+
".azure/**",
|
|
239208
|
+
".config/gcloud/**",
|
|
239209
|
+
".kube/**",
|
|
239210
|
+
"**/*.{key,pem,p12,pfx}",
|
|
239080
239211
|
"**/*secret*",
|
|
239081
239212
|
"**/*token*",
|
|
239082
239213
|
"**/*credential*"
|
|
@@ -239277,9 +239408,20 @@ var DEFAULT_CONFIG = {
|
|
|
239277
239408
|
protectedPaths: [
|
|
239278
239409
|
".env",
|
|
239279
239410
|
".env.*",
|
|
239411
|
+
".git/**",
|
|
239412
|
+
".orbit/**",
|
|
239413
|
+
".npmrc",
|
|
239414
|
+
".pypirc",
|
|
239415
|
+
".netrc",
|
|
239280
239416
|
"id_rsa",
|
|
239281
239417
|
"id_ed25519",
|
|
239282
239418
|
".ssh/**",
|
|
239419
|
+
".gnupg/**",
|
|
239420
|
+
".aws/**",
|
|
239421
|
+
".azure/**",
|
|
239422
|
+
".config/gcloud/**",
|
|
239423
|
+
".kube/**",
|
|
239424
|
+
"**/*.{key,pem,p12,pfx}",
|
|
239283
239425
|
"**/*secret*",
|
|
239284
239426
|
"**/*token*",
|
|
239285
239427
|
"**/*credential*"
|
|
@@ -239568,25 +239710,22 @@ var EncryptedSecretSchema = z4.object({
|
|
|
239568
239710
|
var MAX_SECRETS_FILE_BYTES = 2 * 1024 * 1024;
|
|
239569
239711
|
var MAX_MASTER_KEY_FILE_BYTES = 1024;
|
|
239570
239712
|
function windowsPowerShellEnvironment() {
|
|
239571
|
-
|
|
239572
|
-
for (const key of Object.keys(environment)) {
|
|
239573
|
-
if (key.toLowerCase() === "psmodulepath") {
|
|
239574
|
-
delete environment[key];
|
|
239575
|
-
}
|
|
239576
|
-
}
|
|
239577
|
-
return environment;
|
|
239713
|
+
return buildSanitizedChildEnvironment({ mode: "minimal" });
|
|
239578
239714
|
}
|
|
239579
239715
|
var CredentialsManager = class {
|
|
239580
239716
|
orbitDir;
|
|
239581
239717
|
secretsPath;
|
|
239582
239718
|
masterKeyPath;
|
|
239719
|
+
mutationLockPath;
|
|
239583
239720
|
isWindows;
|
|
239584
239721
|
keyStore;
|
|
239585
239722
|
fallbackKey;
|
|
239723
|
+
registeredSecrets = /* @__PURE__ */ new Set();
|
|
239586
239724
|
constructor(options = {}) {
|
|
239587
239725
|
this.orbitDir = options.orbitDir ?? join2(homedir(), ".orbit");
|
|
239588
239726
|
this.secretsPath = join2(this.orbitDir, "secrets.json");
|
|
239589
239727
|
this.masterKeyPath = join2(this.orbitDir, "master.key");
|
|
239728
|
+
this.mutationLockPath = join2(this.orbitDir, "secrets.lock");
|
|
239590
239729
|
const platform = options.platform ?? process.platform;
|
|
239591
239730
|
this.isWindows = platform === "win32";
|
|
239592
239731
|
this.keyStore = options.keyStore === void 0 ? platform === "darwin" ? new MacOSKeychainKeyStore() : platform === "linux" ? new LinuxSecretServiceKeyStore() : null : options.keyStore;
|
|
@@ -239598,10 +239737,16 @@ var CredentialsManager = class {
|
|
|
239598
239737
|
storeSecret(key, value) {
|
|
239599
239738
|
const validatedKey = CredentialKeySchema.parse(key);
|
|
239600
239739
|
const validatedValue = CredentialValueSchema.parse(value);
|
|
239601
|
-
const
|
|
239602
|
-
|
|
239603
|
-
|
|
239604
|
-
|
|
239740
|
+
const previous = this.withMutationLock(() => {
|
|
239741
|
+
const secrets = this.loadSecretsFile();
|
|
239742
|
+
const previousValue = secrets[validatedKey] ? this.decryptStoredSecret(secrets[validatedKey]) : null;
|
|
239743
|
+
const encrypted = this.isWindows ? this.encryptWindows(validatedValue) : this.encryptFallback(validatedValue);
|
|
239744
|
+
secrets[validatedKey] = encrypted;
|
|
239745
|
+
this.saveSecretsFile(secrets);
|
|
239746
|
+
return previousValue;
|
|
239747
|
+
});
|
|
239748
|
+
if (previous && previous !== validatedValue) this.forgetSecret(previous);
|
|
239749
|
+
this.rememberSecret(validatedValue);
|
|
239605
239750
|
}
|
|
239606
239751
|
/**
|
|
239607
239752
|
* Retrieve a securely stored secret value.
|
|
@@ -239613,7 +239758,9 @@ var CredentialsManager = class {
|
|
|
239613
239758
|
const encrypted = secrets[validatedKey.data];
|
|
239614
239759
|
if (!encrypted) return null;
|
|
239615
239760
|
try {
|
|
239616
|
-
|
|
239761
|
+
const value = this.isWindows ? this.decryptWindows(encrypted) : this.decryptFallback(encrypted);
|
|
239762
|
+
this.rememberSecret(value);
|
|
239763
|
+
return value;
|
|
239617
239764
|
} catch {
|
|
239618
239765
|
return null;
|
|
239619
239766
|
}
|
|
@@ -239622,13 +239769,17 @@ var CredentialsManager = class {
|
|
|
239622
239769
|
deleteSecret(key) {
|
|
239623
239770
|
const validatedKey = CredentialKeySchema.safeParse(key);
|
|
239624
239771
|
if (!validatedKey.success) return false;
|
|
239625
|
-
|
|
239626
|
-
|
|
239627
|
-
|
|
239628
|
-
|
|
239629
|
-
|
|
239630
|
-
|
|
239631
|
-
|
|
239772
|
+
return this.withMutationLock(() => {
|
|
239773
|
+
const secrets = this.loadSecretsFile();
|
|
239774
|
+
if (!Object.prototype.hasOwnProperty.call(secrets, validatedKey.data)) {
|
|
239775
|
+
return false;
|
|
239776
|
+
}
|
|
239777
|
+
const previous = this.decryptStoredSecret(secrets[validatedKey.data]);
|
|
239778
|
+
delete secrets[validatedKey.data];
|
|
239779
|
+
this.saveSecretsFile(secrets);
|
|
239780
|
+
if (previous) this.forgetSecret(previous);
|
|
239781
|
+
return true;
|
|
239782
|
+
});
|
|
239632
239783
|
}
|
|
239633
239784
|
/** Report whether a named secret exists without decrypting it. */
|
|
239634
239785
|
hasSecret(key) {
|
|
@@ -239641,9 +239792,16 @@ var CredentialsManager = class {
|
|
|
239641
239792
|
}
|
|
239642
239793
|
/** Remove encrypted credentials and their platform key without revealing data. */
|
|
239643
239794
|
purge() {
|
|
239644
|
-
this.
|
|
239645
|
-
|
|
239646
|
-
|
|
239795
|
+
this.withMutationLock(() => {
|
|
239796
|
+
this.keyStore?.delete();
|
|
239797
|
+
this.removeFileIfPresent(this.secretsPath);
|
|
239798
|
+
this.removeFileIfPresent(this.masterKeyPath);
|
|
239799
|
+
});
|
|
239800
|
+
for (const secret of this.registeredSecrets) {
|
|
239801
|
+
unregisterSecretForRedaction(secret);
|
|
239802
|
+
}
|
|
239803
|
+
this.registeredSecrets.clear();
|
|
239804
|
+
this.fallbackKey?.fill(0);
|
|
239647
239805
|
this.fallbackKey = void 0;
|
|
239648
239806
|
}
|
|
239649
239807
|
loadSecretsFile() {
|
|
@@ -239654,9 +239812,16 @@ var CredentialsManager = class {
|
|
|
239654
239812
|
);
|
|
239655
239813
|
if (raw === void 0) return {};
|
|
239656
239814
|
const parsed = SecretsFileSchema.safeParse(JSON.parse(raw));
|
|
239657
|
-
|
|
239658
|
-
|
|
239659
|
-
|
|
239815
|
+
if (!parsed.success) {
|
|
239816
|
+
throw new Error("Credential store has an invalid schema.");
|
|
239817
|
+
}
|
|
239818
|
+
return parsed.data;
|
|
239819
|
+
} catch (error) {
|
|
239820
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
239821
|
+
throw new Error(
|
|
239822
|
+
`Orbit credential store is unreadable; it was preserved and will not be overwritten. Repair or restore ${this.secretsPath}. ${detail}`,
|
|
239823
|
+
{ cause: error }
|
|
239824
|
+
);
|
|
239660
239825
|
}
|
|
239661
239826
|
}
|
|
239662
239827
|
saveSecretsFile(secrets) {
|
|
@@ -239668,6 +239833,77 @@ var CredentialsManager = class {
|
|
|
239668
239833
|
);
|
|
239669
239834
|
this.restrictFilePermissions(this.secretsPath);
|
|
239670
239835
|
}
|
|
239836
|
+
withMutationLock(operation, retried = false) {
|
|
239837
|
+
this.ensureOrbitDir();
|
|
239838
|
+
let descriptor;
|
|
239839
|
+
try {
|
|
239840
|
+
descriptor = openSync2(this.mutationLockPath, "wx", 384);
|
|
239841
|
+
} catch (error) {
|
|
239842
|
+
if (typeof error === "object" && error !== null && "code" in error && error.code === "EEXIST") {
|
|
239843
|
+
if (!retried && this.removeStaleMutationLock()) {
|
|
239844
|
+
return this.withMutationLock(operation, true);
|
|
239845
|
+
}
|
|
239846
|
+
throw new Error(
|
|
239847
|
+
"Orbit credential store is busy in another process. Retry after that credential operation completes.",
|
|
239848
|
+
{ cause: error }
|
|
239849
|
+
);
|
|
239850
|
+
}
|
|
239851
|
+
throw error;
|
|
239852
|
+
}
|
|
239853
|
+
try {
|
|
239854
|
+
writeFileSync3(
|
|
239855
|
+
descriptor,
|
|
239856
|
+
`${JSON.stringify({ pid: process.pid, createdAt: (/* @__PURE__ */ new Date()).toISOString() })}
|
|
239857
|
+
`,
|
|
239858
|
+
"utf8"
|
|
239859
|
+
);
|
|
239860
|
+
return operation();
|
|
239861
|
+
} finally {
|
|
239862
|
+
try {
|
|
239863
|
+
closeSync2(descriptor);
|
|
239864
|
+
} finally {
|
|
239865
|
+
this.removeFileIfPresent(this.mutationLockPath);
|
|
239866
|
+
}
|
|
239867
|
+
}
|
|
239868
|
+
}
|
|
239869
|
+
removeStaleMutationLock() {
|
|
239870
|
+
try {
|
|
239871
|
+
const raw = readBoundedRegularFile(this.mutationLockPath, 4096);
|
|
239872
|
+
if (raw === void 0) return true;
|
|
239873
|
+
const payload = z4.object({
|
|
239874
|
+
pid: z4.number().int().positive(),
|
|
239875
|
+
createdAt: z4.string().datetime()
|
|
239876
|
+
}).parse(JSON.parse(raw));
|
|
239877
|
+
let processAlive = true;
|
|
239878
|
+
try {
|
|
239879
|
+
process.kill(payload.pid, 0);
|
|
239880
|
+
} catch (error) {
|
|
239881
|
+
processAlive = !(typeof error === "object" && error !== null && "code" in error && error.code === "ESRCH");
|
|
239882
|
+
}
|
|
239883
|
+
if (processAlive) return false;
|
|
239884
|
+
this.removeFileIfPresent(this.mutationLockPath);
|
|
239885
|
+
return true;
|
|
239886
|
+
} catch {
|
|
239887
|
+
return false;
|
|
239888
|
+
}
|
|
239889
|
+
}
|
|
239890
|
+
decryptStoredSecret(encrypted) {
|
|
239891
|
+
try {
|
|
239892
|
+
return this.isWindows ? this.decryptWindows(encrypted) : this.decryptFallback(encrypted);
|
|
239893
|
+
} catch {
|
|
239894
|
+
return null;
|
|
239895
|
+
}
|
|
239896
|
+
}
|
|
239897
|
+
rememberSecret(secret) {
|
|
239898
|
+
const normalized = secret.trim();
|
|
239899
|
+
if (normalized.length < 6 || this.registeredSecrets.has(normalized)) return;
|
|
239900
|
+
registerSecretForRedaction(normalized);
|
|
239901
|
+
this.registeredSecrets.add(normalized);
|
|
239902
|
+
}
|
|
239903
|
+
forgetSecret(secret) {
|
|
239904
|
+
unregisterSecretForRedaction(secret);
|
|
239905
|
+
this.registeredSecrets.delete(secret.trim());
|
|
239906
|
+
}
|
|
239671
239907
|
// Windows DPAPI Encryption using PowerShell over stdin
|
|
239672
239908
|
encryptWindows(plainText) {
|
|
239673
239909
|
try {
|
|
@@ -239781,11 +240017,24 @@ var CredentialsManager = class {
|
|
|
239781
240017
|
}
|
|
239782
240018
|
}
|
|
239783
240019
|
this.ensureOrbitDir();
|
|
239784
|
-
|
|
239785
|
-
|
|
239786
|
-
|
|
239787
|
-
|
|
239788
|
-
|
|
240020
|
+
try {
|
|
240021
|
+
writeFileSync3(this.masterKeyPath, generated.toString("base64"), {
|
|
240022
|
+
encoding: "utf8",
|
|
240023
|
+
mode: 384,
|
|
240024
|
+
flag: "wx"
|
|
240025
|
+
});
|
|
240026
|
+
} catch (error) {
|
|
240027
|
+
if (typeof error === "object" && error !== null && "code" in error && error.code === "EEXIST") {
|
|
240028
|
+
generated.fill(0);
|
|
240029
|
+
const concurrentKey = this.readMasterKeyFile();
|
|
240030
|
+
if (concurrentKey) {
|
|
240031
|
+
this.fallbackKey = concurrentKey;
|
|
240032
|
+
return concurrentKey;
|
|
240033
|
+
}
|
|
240034
|
+
}
|
|
240035
|
+
generated.fill(0);
|
|
240036
|
+
throw error;
|
|
240037
|
+
}
|
|
239789
240038
|
this.restrictFilePermissions(this.masterKeyPath);
|
|
239790
240039
|
this.fallbackKey = generated;
|
|
239791
240040
|
return generated;
|
|
@@ -242122,11 +242371,11 @@ import { z as z33 } from "zod";
|
|
|
242122
242371
|
var DEEPSEEK_V4_FLASH = "deepseek-v4-flash";
|
|
242123
242372
|
var DEEPSEEK_V4_PRO = "deepseek-v4-pro";
|
|
242124
242373
|
var DEEPSEEK_V4_FLASH_VERSION = "DeepSeek-V4-Flash-0731";
|
|
242125
|
-
var DEEPSEEK_V4_PRO_VERSION = "DeepSeek-V4-Pro";
|
|
242374
|
+
var DEEPSEEK_V4_PRO_VERSION = "DeepSeek-V4-Pro-0813";
|
|
242126
242375
|
var DEEPSEEK_V4_CONTEXT_TOKENS = 1048576;
|
|
242127
242376
|
var DEEPSEEK_V4_MAX_OUTPUT_TOKENS = 384e3;
|
|
242128
242377
|
var DEEPSEEK_V4_EFFECTIVE_CONTEXT_PERCENT = 0.95;
|
|
242129
|
-
var DEEPSEEK_REASONING_EFFORTS = ["high", "max"];
|
|
242378
|
+
var DEEPSEEK_REASONING_EFFORTS = ["low", "high", "max"];
|
|
242130
242379
|
function isOfficialDeepSeekApi(baseUrl) {
|
|
242131
242380
|
try {
|
|
242132
242381
|
const url = new URL(baseUrl);
|
|
@@ -242147,24 +242396,22 @@ function getDeepSeekV4ModelProfile(model) {
|
|
|
242147
242396
|
canonicalModel: DEEPSEEK_V4_FLASH,
|
|
242148
242397
|
modelVersion: DEEPSEEK_V4_FLASH_VERSION,
|
|
242149
242398
|
supportsResponses: true,
|
|
242150
|
-
defaultReasoningEffort: "high",
|
|
242151
242399
|
reasoningEfforts: DEEPSEEK_REASONING_EFFORTS,
|
|
242152
242400
|
parallelToolCalls: true,
|
|
242153
242401
|
officialRequestModel: officialRequestModel && leaf === DEEPSEEK_V4_FLASH
|
|
242154
242402
|
};
|
|
242155
242403
|
}
|
|
242156
|
-
if (leaf === DEEPSEEK_V4_PRO) {
|
|
242404
|
+
if (leaf === DEEPSEEK_V4_PRO || leaf === `${DEEPSEEK_V4_PRO}-0813`) {
|
|
242157
242405
|
return {
|
|
242158
242406
|
lane: "pro",
|
|
242159
242407
|
legacyAlias: false,
|
|
242160
242408
|
optimizedThinkingDefault: true,
|
|
242161
242409
|
canonicalModel: DEEPSEEK_V4_PRO,
|
|
242162
242410
|
modelVersion: DEEPSEEK_V4_PRO_VERSION,
|
|
242163
|
-
supportsResponses:
|
|
242164
|
-
defaultReasoningEffort: "high",
|
|
242411
|
+
supportsResponses: true,
|
|
242165
242412
|
reasoningEfforts: DEEPSEEK_REASONING_EFFORTS,
|
|
242166
242413
|
parallelToolCalls: true,
|
|
242167
|
-
officialRequestModel
|
|
242414
|
+
officialRequestModel: officialRequestModel && leaf === DEEPSEEK_V4_PRO
|
|
242168
242415
|
};
|
|
242169
242416
|
}
|
|
242170
242417
|
if (leaf === "deepseek-chat") {
|
|
@@ -242175,7 +242422,6 @@ function getDeepSeekV4ModelProfile(model) {
|
|
|
242175
242422
|
canonicalModel: DEEPSEEK_V4_FLASH,
|
|
242176
242423
|
modelVersion: DEEPSEEK_V4_FLASH_VERSION,
|
|
242177
242424
|
supportsResponses: true,
|
|
242178
|
-
defaultReasoningEffort: "high",
|
|
242179
242425
|
reasoningEfforts: DEEPSEEK_REASONING_EFFORTS,
|
|
242180
242426
|
parallelToolCalls: true,
|
|
242181
242427
|
officialRequestModel
|
|
@@ -242189,7 +242435,6 @@ function getDeepSeekV4ModelProfile(model) {
|
|
|
242189
242435
|
canonicalModel: DEEPSEEK_V4_FLASH,
|
|
242190
242436
|
modelVersion: DEEPSEEK_V4_FLASH_VERSION,
|
|
242191
242437
|
supportsResponses: true,
|
|
242192
|
-
defaultReasoningEffort: "high",
|
|
242193
242438
|
reasoningEfforts: DEEPSEEK_REASONING_EFFORTS,
|
|
242194
242439
|
parallelToolCalls: true,
|
|
242195
242440
|
officialRequestModel
|
|
@@ -242198,8 +242443,7 @@ function getDeepSeekV4ModelProfile(model) {
|
|
|
242198
242443
|
return void 0;
|
|
242199
242444
|
}
|
|
242200
242445
|
function getDeepSeekReasoningEffort(budgetTokens = 4096, explicitEffort) {
|
|
242201
|
-
if (explicitEffort
|
|
242202
|
-
if (explicitEffort) return "high";
|
|
242446
|
+
if (explicitEffort) return explicitEffort;
|
|
242203
242447
|
if (budgetTokens >= 8192) return "max";
|
|
242204
242448
|
return "high";
|
|
242205
242449
|
}
|
|
@@ -242215,8 +242459,8 @@ function getDeepSeekThinkingPolicy(profile, input) {
|
|
|
242215
242459
|
}
|
|
242216
242460
|
return {
|
|
242217
242461
|
enabled: true,
|
|
242218
|
-
effort:
|
|
242219
|
-
budgetTokens:
|
|
242462
|
+
effort: "low",
|
|
242463
|
+
budgetTokens: 2048
|
|
242220
242464
|
};
|
|
242221
242465
|
}
|
|
242222
242466
|
function resolveModelAdaptation(model) {
|
|
@@ -243063,10 +243307,10 @@ var DeepSeekAnthropicProvider = class {
|
|
|
243063
243307
|
readLoop: while (true) {
|
|
243064
243308
|
const { done, value } = await reader.read();
|
|
243065
243309
|
resetStreamTimeout();
|
|
243066
|
-
if (done) break;
|
|
243067
243310
|
let accumulatedText = "";
|
|
243068
243311
|
let accumulatedThinking = "";
|
|
243069
|
-
const decoded = decoder.decode(value, { stream: true });
|
|
243312
|
+
const decoded = done ? `${decoder.decode()}${buffer.trim() ? "\n" : ""}` : decoder.decode(value, { stream: true });
|
|
243313
|
+
if (done && !decoded) break;
|
|
243070
243314
|
totalStreamChars += decoded.length;
|
|
243071
243315
|
if (totalStreamChars > MAX_STREAM_TOTAL_CHARS) {
|
|
243072
243316
|
throw new Error(
|
|
@@ -243218,6 +243462,7 @@ var DeepSeekAnthropicProvider = class {
|
|
|
243218
243462
|
if (accumulatedThinking) {
|
|
243219
243463
|
yield { type: "thinking_delta", text: accumulatedThinking };
|
|
243220
243464
|
}
|
|
243465
|
+
if (done) break;
|
|
243221
243466
|
}
|
|
243222
243467
|
if (isDeepSeekV4 && stopReason === null) {
|
|
243223
243468
|
throw new Error(
|
|
@@ -243595,6 +243840,9 @@ async function* parseStreamingResponse(input, options, response, controller) {
|
|
|
243595
243840
|
const { done, value } = await reader.read();
|
|
243596
243841
|
resetTimeout();
|
|
243597
243842
|
if (done) {
|
|
243843
|
+
const tail = decoder.decode().replace(/\r\n/g, "\n");
|
|
243844
|
+
totalChars += tail.length;
|
|
243845
|
+
buffer += tail;
|
|
243598
243846
|
if (buffer.trim()) buffer += "\n\n";
|
|
243599
243847
|
} else {
|
|
243600
243848
|
const decoded = decoder.decode(value, { stream: true }).replace(/\r\n/g, "\n");
|
|
@@ -244084,7 +244332,7 @@ var StreamingThinkParser = class {
|
|
|
244084
244332
|
return events;
|
|
244085
244333
|
}
|
|
244086
244334
|
};
|
|
244087
|
-
var DeepSeekOpenAIProvider = class {
|
|
244335
|
+
var DeepSeekOpenAIProvider = class _DeepSeekOpenAIProvider {
|
|
244088
244336
|
constructor(apiKey, baseUrl = "https://api.deepseek.com", options = {}) {
|
|
244089
244337
|
this.apiKey = apiKey;
|
|
244090
244338
|
this.baseUrl = baseUrl;
|
|
@@ -244096,6 +244344,8 @@ var DeepSeekOpenAIProvider = class {
|
|
|
244096
244344
|
apiKey;
|
|
244097
244345
|
baseUrl;
|
|
244098
244346
|
options;
|
|
244347
|
+
static RESPONSES_CIRCUIT_TTL_MS = 5 * 60 * 1e3;
|
|
244348
|
+
responsesEndpointCircuit;
|
|
244099
244349
|
id = "deepseek-openai";
|
|
244100
244350
|
type = "openai-compatible";
|
|
244101
244351
|
capabilities = {
|
|
@@ -244243,17 +244493,9 @@ var DeepSeekOpenAIProvider = class {
|
|
|
244243
244493
|
return;
|
|
244244
244494
|
}
|
|
244245
244495
|
const requestedApiFormat = this.options.deepSeekApiFormat ?? "chat-completions";
|
|
244246
|
-
|
|
244247
|
-
|
|
244248
|
-
|
|
244249
|
-
error: new Error(
|
|
244250
|
-
`${deepSeekV4Profile.canonicalModel} does not yet support the DeepSeek Responses API. Use deepSeekApiFormat: chat-completions until official support is available.`
|
|
244251
|
-
)
|
|
244252
|
-
};
|
|
244253
|
-
return;
|
|
244254
|
-
}
|
|
244255
|
-
const useResponses = deepSeekV4Profile?.supportsResponses === true && requestedApiFormat !== "chat-completions";
|
|
244256
|
-
let responsesFallbackStatus;
|
|
244496
|
+
const circuitOpen = requestedApiFormat === "auto" && this.responsesEndpointCircuit !== void 0 && this.responsesEndpointCircuit.unavailableUntil > Date.now();
|
|
244497
|
+
const useResponses = deepSeekV4Profile?.supportsResponses === true && requestedApiFormat !== "chat-completions" && !circuitOpen;
|
|
244498
|
+
let responsesFallbackStatus = circuitOpen ? this.responsesEndpointCircuit?.status : void 0;
|
|
244257
244499
|
if (useResponses && deepSeekV4Profile) {
|
|
244258
244500
|
try {
|
|
244259
244501
|
const responsesInput = {
|
|
@@ -244271,6 +244513,7 @@ var DeepSeekOpenAIProvider = class {
|
|
|
244271
244513
|
profile: deepSeekV4Profile,
|
|
244272
244514
|
requestModel: isOfficialDeepSeek ? deepSeekV4Profile.canonicalModel : input.model
|
|
244273
244515
|
});
|
|
244516
|
+
this.responsesEndpointCircuit = void 0;
|
|
244274
244517
|
return;
|
|
244275
244518
|
} catch (error) {
|
|
244276
244519
|
if (requestedApiFormat !== "auto" || !(error instanceof DeepSeekResponsesUnavailableError)) {
|
|
@@ -244281,6 +244524,10 @@ var DeepSeekOpenAIProvider = class {
|
|
|
244281
244524
|
return;
|
|
244282
244525
|
}
|
|
244283
244526
|
responsesFallbackStatus = error.status;
|
|
244527
|
+
this.responsesEndpointCircuit = {
|
|
244528
|
+
status: error.status,
|
|
244529
|
+
unavailableUntil: Date.now() + _DeepSeekOpenAIProvider.RESPONSES_CIRCUIT_TTL_MS
|
|
244530
|
+
};
|
|
244284
244531
|
}
|
|
244285
244532
|
}
|
|
244286
244533
|
let openaiMessages;
|
|
@@ -244566,10 +244813,10 @@ var DeepSeekOpenAIProvider = class {
|
|
|
244566
244813
|
readLoop: while (true) {
|
|
244567
244814
|
const { done, value } = await reader.read();
|
|
244568
244815
|
resetStreamTimeout();
|
|
244569
|
-
if (done) break;
|
|
244570
244816
|
let accumulatedText = "";
|
|
244571
244817
|
let accumulatedThinking = "";
|
|
244572
|
-
const decoded = decoder.decode(value, { stream: true });
|
|
244818
|
+
const decoded = done ? `${decoder.decode()}${buffer.trim() ? "\n" : ""}` : decoder.decode(value, { stream: true });
|
|
244819
|
+
if (done && !decoded) break;
|
|
244573
244820
|
totalStreamChars += decoded.length;
|
|
244574
244821
|
if (totalStreamChars > MAX_STREAM_TOTAL_CHARS3) {
|
|
244575
244822
|
throw new Error(
|
|
@@ -244717,6 +244964,7 @@ var DeepSeekOpenAIProvider = class {
|
|
|
244717
244964
|
if (accumulatedThinking) {
|
|
244718
244965
|
yield { type: "thinking_delta", text: accumulatedThinking };
|
|
244719
244966
|
}
|
|
244967
|
+
if (done) break;
|
|
244720
244968
|
}
|
|
244721
244969
|
if (isDeepSeekV4 && finishReason === null) {
|
|
244722
244970
|
throw new Error(
|
|
@@ -244858,7 +245106,10 @@ var DeepSeekOpenAIProvider = class {
|
|
|
244858
245106
|
bodyData.prompt = prompt;
|
|
244859
245107
|
bodyData.suffix = options.suffix;
|
|
244860
245108
|
}
|
|
244861
|
-
|
|
245109
|
+
const requestedAdaptation = resolveModelAdaptation(
|
|
245110
|
+
options?.model ?? DEEPSEEK_V4_FLASH
|
|
245111
|
+
);
|
|
245112
|
+
bodyData.model = requestedAdaptation.family === "deepseek-v4" && !requestedAdaptation.deepSeekV4.legacyAlias ? requestedAdaptation.deepSeekV4.canonicalModel : DEEPSEEK_V4_FLASH;
|
|
244862
245113
|
}
|
|
244863
245114
|
const response = await fetchWithRetry(
|
|
244864
245115
|
url,
|
|
@@ -244953,11 +245204,11 @@ import { z as z10 } from "zod";
|
|
|
244953
245204
|
import { z as z23 } from "zod";
|
|
244954
245205
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
244955
245206
|
import {
|
|
244956
|
-
closeSync as
|
|
245207
|
+
closeSync as closeSync3,
|
|
244957
245208
|
existsSync as existsSync5,
|
|
244958
245209
|
fsyncSync as fsyncSync2,
|
|
244959
245210
|
mkdirSync as mkdirSync2,
|
|
244960
|
-
openSync as
|
|
245211
|
+
openSync as openSync3,
|
|
244961
245212
|
renameSync as renameSync2,
|
|
244962
245213
|
unlinkSync as unlinkSync2,
|
|
244963
245214
|
writeFileSync as writeFileSync4
|
|
@@ -246639,10 +246890,10 @@ function atomicWriteWorkspaceFile(cwd, requestedPath, content, expectedCurrentCo
|
|
|
246639
246890
|
const temporaryPath = join5(parent, `.orbit-write-${randomUUID3()}.tmp`);
|
|
246640
246891
|
let descriptor;
|
|
246641
246892
|
try {
|
|
246642
|
-
descriptor =
|
|
246893
|
+
descriptor = openSync3(temporaryPath, "wx", 384);
|
|
246643
246894
|
writeFileSync4(descriptor, content, "utf8");
|
|
246644
246895
|
fsyncSync2(descriptor);
|
|
246645
|
-
|
|
246896
|
+
closeSync3(descriptor);
|
|
246646
246897
|
descriptor = void 0;
|
|
246647
246898
|
const revalidatedPath = resolveSafePath(cwd, requestedPath);
|
|
246648
246899
|
if (revalidatedPath !== safePath) {
|
|
@@ -246651,7 +246902,7 @@ function atomicWriteWorkspaceFile(cwd, requestedPath, content, expectedCurrentCo
|
|
|
246651
246902
|
assertExpectedContent(revalidatedPath, expectedCurrentContent);
|
|
246652
246903
|
renameSync2(temporaryPath, revalidatedPath);
|
|
246653
246904
|
} finally {
|
|
246654
|
-
if (descriptor !== void 0)
|
|
246905
|
+
if (descriptor !== void 0) closeSync3(descriptor);
|
|
246655
246906
|
if (existsSync5(temporaryPath)) unlinkSync2(temporaryPath);
|
|
246656
246907
|
}
|
|
246657
246908
|
}
|
|
@@ -247758,13 +248009,14 @@ var GitCommitTool = class {
|
|
|
247758
248009
|
const { stdout: stdout2 } = await execa("git", ["commit", "-m", commitMessage], {
|
|
247759
248010
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
247760
248011
|
cwd: ctx.cwd,
|
|
248012
|
+
env: buildSanitizedChildEnvironment(),
|
|
247761
248013
|
signal: ctx.abortSignal
|
|
247762
248014
|
});
|
|
247763
248015
|
return {
|
|
247764
248016
|
ok: true,
|
|
247765
|
-
data: stdout2,
|
|
248017
|
+
data: redactSecrets(stdout2),
|
|
247766
248018
|
display: `Staged changes committed:
|
|
247767
|
-
${stdout2}`
|
|
248019
|
+
${redactSecrets(stdout2)}`
|
|
247768
248020
|
};
|
|
247769
248021
|
} catch (error) {
|
|
247770
248022
|
return {
|
|
@@ -247791,9 +248043,10 @@ var GitDiffTool = class {
|
|
|
247791
248043
|
const { stdout: stdout2 } = await execa("git", args, {
|
|
247792
248044
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
247793
248045
|
cwd: ctx.cwd,
|
|
248046
|
+
env: buildSanitizedChildEnvironment(),
|
|
247794
248047
|
signal: ctx.abortSignal
|
|
247795
248048
|
});
|
|
247796
|
-
const bounded = LogTruncator.truncate(stdout2, 300, 4e4);
|
|
248049
|
+
const bounded = redactSecrets(LogTruncator.truncate(stdout2, 300, 4e4));
|
|
247797
248050
|
return {
|
|
247798
248051
|
ok: true,
|
|
247799
248052
|
data: bounded,
|
|
@@ -247830,6 +248083,7 @@ var GitRestoreTool = class {
|
|
|
247830
248083
|
{
|
|
247831
248084
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
247832
248085
|
cwd: ctx.cwd,
|
|
248086
|
+
env: buildSanitizedChildEnvironment(),
|
|
247833
248087
|
signal: ctx.abortSignal
|
|
247834
248088
|
}
|
|
247835
248089
|
);
|
|
@@ -247857,12 +248111,13 @@ var GitStatusTool = class {
|
|
|
247857
248111
|
const { stdout: stdout2 } = await execa("git", ["status", "--short"], {
|
|
247858
248112
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
247859
248113
|
cwd: ctx.cwd,
|
|
248114
|
+
env: buildSanitizedChildEnvironment(),
|
|
247860
248115
|
signal: ctx.abortSignal
|
|
247861
248116
|
});
|
|
247862
248117
|
return {
|
|
247863
248118
|
ok: true,
|
|
247864
|
-
data: stdout2,
|
|
247865
|
-
display: stdout2 ? stdout2 : "Working tree clean."
|
|
248119
|
+
data: redactSecrets(stdout2),
|
|
248120
|
+
display: stdout2 ? redactSecrets(stdout2) : "Working tree clean."
|
|
247866
248121
|
};
|
|
247867
248122
|
} catch (error) {
|
|
247868
248123
|
return {
|
|
@@ -248385,6 +248640,7 @@ var BashTool = class {
|
|
|
248385
248640
|
const result = await execa(invocation.file, invocation.args, {
|
|
248386
248641
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
248387
248642
|
cwd: ctx.cwd,
|
|
248643
|
+
env: buildSanitizedChildEnvironment(),
|
|
248388
248644
|
timeout,
|
|
248389
248645
|
reject: false,
|
|
248390
248646
|
signal: ctx.abortSignal,
|
|
@@ -248401,8 +248657,12 @@ var BashTool = class {
|
|
|
248401
248657
|
const failureMessage = readProcessFailureMessage(result);
|
|
248402
248658
|
const outputLimitExceeded = result.failed && /maxBuffer exceeded/i.test(failureMessage);
|
|
248403
248659
|
const exitCode = result.exitCode ?? (result.failed ? 1 : 0);
|
|
248404
|
-
const displayStdout =
|
|
248405
|
-
|
|
248660
|
+
const displayStdout = redactSecrets(
|
|
248661
|
+
LogTruncator.truncate(stdout2, 150, 2e4)
|
|
248662
|
+
);
|
|
248663
|
+
const displayStderr = redactSecrets(
|
|
248664
|
+
LogTruncator.truncate(stderr, 150, 2e4)
|
|
248665
|
+
);
|
|
248406
248666
|
const truncated = outputLimitExceeded || stdout2.length !== displayStdout.length || stderr.length !== displayStderr.length;
|
|
248407
248667
|
const display = [
|
|
248408
248668
|
displayStdout ? `Stdout:
|
|
@@ -248510,6 +248770,7 @@ var RunTestsTool = class {
|
|
|
248510
248770
|
const result = await execa(invocation.file, invocation.args, {
|
|
248511
248771
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
248512
248772
|
cwd: ctx.cwd,
|
|
248773
|
+
env: buildSanitizedChildEnvironment(),
|
|
248513
248774
|
reject: false,
|
|
248514
248775
|
signal: ctx.abortSignal,
|
|
248515
248776
|
timeout,
|
|
@@ -248526,8 +248787,12 @@ var RunTestsTool = class {
|
|
|
248526
248787
|
const failureMessage = readProcessFailureMessage(result);
|
|
248527
248788
|
const outputLimitExceeded = result.failed && /maxBuffer exceeded/i.test(failureMessage);
|
|
248528
248789
|
const exitCode = result.exitCode ?? (result.failed ? 1 : 0);
|
|
248529
|
-
const displayStdout =
|
|
248530
|
-
|
|
248790
|
+
const displayStdout = redactSecrets(
|
|
248791
|
+
LogTruncator.truncate(stdout2, 150, 2e4)
|
|
248792
|
+
);
|
|
248793
|
+
const displayStderr = redactSecrets(
|
|
248794
|
+
LogTruncator.truncate(stderr, 150, 2e4)
|
|
248795
|
+
);
|
|
248531
248796
|
const truncated = outputLimitExceeded || displayStdout.length !== stdout2.length || displayStderr.length !== stderr.length;
|
|
248532
248797
|
return {
|
|
248533
248798
|
ok: !result.failed && exitCode === 0,
|
|
@@ -250093,6 +250358,7 @@ var BackgroundTaskRuntime = class {
|
|
|
250093
250358
|
child = spawn(invocation.file, invocation.args, {
|
|
250094
250359
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
250095
250360
|
cwd: safeCwd,
|
|
250361
|
+
env: buildSanitizedChildEnvironment(),
|
|
250096
250362
|
detached: process.platform !== "win32",
|
|
250097
250363
|
stdio: ["ignore", "pipe", "pipe"]
|
|
250098
250364
|
});
|
|
@@ -250778,7 +251044,7 @@ var JSVectorStore = class {
|
|
|
250778
251044
|
loaded = false;
|
|
250779
251045
|
loading = null;
|
|
250780
251046
|
cacheState = "uninitialized";
|
|
250781
|
-
async addDocuments(docs) {
|
|
251047
|
+
async addDocuments(docs, persist = true) {
|
|
250782
251048
|
if (!this.loaded) {
|
|
250783
251049
|
await this.load();
|
|
250784
251050
|
}
|
|
@@ -250815,9 +251081,9 @@ var JSVectorStore = class {
|
|
|
250815
251081
|
);
|
|
250816
251082
|
}
|
|
250817
251083
|
this.documents = Array.from(docMap.values());
|
|
250818
|
-
await this.save();
|
|
251084
|
+
if (persist) await this.save();
|
|
250819
251085
|
}
|
|
250820
|
-
async deleteByFilePath(filePath) {
|
|
251086
|
+
async deleteByFilePath(filePath, persist = true) {
|
|
250821
251087
|
if (!this.loaded) {
|
|
250822
251088
|
await this.load();
|
|
250823
251089
|
}
|
|
@@ -250825,7 +251091,7 @@ var JSVectorStore = class {
|
|
|
250825
251091
|
this.documents = this.documents.filter(
|
|
250826
251092
|
(doc) => doc.metadata.filePath !== filePath
|
|
250827
251093
|
);
|
|
250828
|
-
if (this.documents.length !== originalLength) {
|
|
251094
|
+
if (persist && this.documents.length !== originalLength) {
|
|
250829
251095
|
await this.save();
|
|
250830
251096
|
}
|
|
250831
251097
|
}
|
|
@@ -251070,7 +251336,7 @@ var BM25Store = class {
|
|
|
251070
251336
|
loaded = false;
|
|
251071
251337
|
loading = null;
|
|
251072
251338
|
cacheState = "uninitialized";
|
|
251073
|
-
async addDocuments(documents) {
|
|
251339
|
+
async addDocuments(documents, persist = true) {
|
|
251074
251340
|
if (!this.loaded) {
|
|
251075
251341
|
await this.load();
|
|
251076
251342
|
}
|
|
@@ -251102,9 +251368,9 @@ var BM25Store = class {
|
|
|
251102
251368
|
};
|
|
251103
251369
|
}
|
|
251104
251370
|
this.recalculateStats();
|
|
251105
|
-
await this.save();
|
|
251371
|
+
if (persist) await this.save();
|
|
251106
251372
|
}
|
|
251107
|
-
async deleteByFilePath(filePath) {
|
|
251373
|
+
async deleteByFilePath(filePath, persist = true) {
|
|
251108
251374
|
if (!this.loaded) {
|
|
251109
251375
|
await this.load();
|
|
251110
251376
|
}
|
|
@@ -251123,7 +251389,7 @@ var BM25Store = class {
|
|
|
251123
251389
|
}
|
|
251124
251390
|
if (changed) {
|
|
251125
251391
|
this.recalculateStats();
|
|
251126
|
-
await this.save();
|
|
251392
|
+
if (persist) await this.save();
|
|
251127
251393
|
}
|
|
251128
251394
|
}
|
|
251129
251395
|
async search(query, limit) {
|
|
@@ -251288,6 +251554,8 @@ var HybridSearch = class {
|
|
|
251288
251554
|
cwd;
|
|
251289
251555
|
vectorStore;
|
|
251290
251556
|
bm25Store;
|
|
251557
|
+
batchDepth = 0;
|
|
251558
|
+
batchChanged = false;
|
|
251291
251559
|
/**
|
|
251292
251560
|
* Load stores from disk.
|
|
251293
251561
|
*/
|
|
@@ -251308,17 +251576,32 @@ var HybridSearch = class {
|
|
|
251308
251576
|
* Add documents to both vector and BM25 stores.
|
|
251309
251577
|
*/
|
|
251310
251578
|
async addDocuments(docs) {
|
|
251311
|
-
|
|
251312
|
-
await this.
|
|
251579
|
+
const persist = this.batchDepth === 0;
|
|
251580
|
+
await this.vectorStore.addDocuments(docs, persist);
|
|
251581
|
+
await this.bm25Store.addDocuments(docs, persist);
|
|
251582
|
+
if (!persist) this.batchChanged = true;
|
|
251313
251583
|
}
|
|
251314
251584
|
/**
|
|
251315
251585
|
* Incremental clean: delete old indices for a file path.
|
|
251316
251586
|
*/
|
|
251317
251587
|
async deleteByFilePath(filePath) {
|
|
251588
|
+
const persist = this.batchDepth === 0;
|
|
251318
251589
|
await Promise.all([
|
|
251319
|
-
this.vectorStore.deleteByFilePath(filePath),
|
|
251320
|
-
this.bm25Store.deleteByFilePath(filePath)
|
|
251590
|
+
this.vectorStore.deleteByFilePath(filePath, persist),
|
|
251591
|
+
this.bm25Store.deleteByFilePath(filePath, persist)
|
|
251321
251592
|
]);
|
|
251593
|
+
if (!persist) this.batchChanged = true;
|
|
251594
|
+
}
|
|
251595
|
+
/** Defer persistence so one indexing generation performs one save per store. */
|
|
251596
|
+
beginBatch() {
|
|
251597
|
+
this.batchDepth += 1;
|
|
251598
|
+
}
|
|
251599
|
+
async commitBatch() {
|
|
251600
|
+
if (this.batchDepth === 0) return;
|
|
251601
|
+
this.batchDepth -= 1;
|
|
251602
|
+
if (this.batchDepth > 0 || !this.batchChanged) return;
|
|
251603
|
+
this.batchChanged = false;
|
|
251604
|
+
await Promise.all([this.vectorStore.save(), this.bm25Store.save()]);
|
|
251322
251605
|
}
|
|
251323
251606
|
/**
|
|
251324
251607
|
* Performs hybrid search using Reciprocal Rank Fusion (RRF).
|
|
@@ -251382,7 +251665,31 @@ var HybridSearch = class {
|
|
|
251382
251665
|
var TYPESCRIPT_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".mts", ".cts"]);
|
|
251383
251666
|
var JAVASCRIPT_EXTENSIONS = /* @__PURE__ */ new Set([".js", ".jsx", ".mjs", ".cjs"]);
|
|
251384
251667
|
var PYTHON_EXTENSIONS = /* @__PURE__ */ new Set([".py", ".pyw"]);
|
|
251385
|
-
var
|
|
251668
|
+
var GENERIC_LANGUAGE_BY_EXTENSION = {
|
|
251669
|
+
".go": "go",
|
|
251670
|
+
".rs": "rust",
|
|
251671
|
+
".java": "java",
|
|
251672
|
+
".cs": "csharp",
|
|
251673
|
+
".c": "cpp",
|
|
251674
|
+
".h": "cpp",
|
|
251675
|
+
".cc": "cpp",
|
|
251676
|
+
".cpp": "cpp",
|
|
251677
|
+
".cxx": "cpp",
|
|
251678
|
+
".hpp": "cpp",
|
|
251679
|
+
".sql": "sql",
|
|
251680
|
+
".md": "text",
|
|
251681
|
+
".mdx": "text",
|
|
251682
|
+
".json": "text",
|
|
251683
|
+
".yaml": "text",
|
|
251684
|
+
".yml": "text",
|
|
251685
|
+
".toml": "text",
|
|
251686
|
+
".sh": "text",
|
|
251687
|
+
".bash": "text",
|
|
251688
|
+
".ps1": "text",
|
|
251689
|
+
".css": "text",
|
|
251690
|
+
".scss": "text"
|
|
251691
|
+
};
|
|
251692
|
+
var INDEXED_SOURCE_GLOB = "**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs,py,pyw,go,rs,java,cs,c,h,cc,cpp,cxx,hpp,sql,md,mdx,sh,bash,ps1,css,scss}";
|
|
251386
251693
|
function parseSourceFile(content, filePath) {
|
|
251387
251694
|
const extension = extname22(filePath).toLowerCase();
|
|
251388
251695
|
if (PYTHON_EXTENSIONS.has(extension)) {
|
|
@@ -251395,8 +251702,64 @@ function parseSourceFile(content, filePath) {
|
|
|
251395
251702
|
TYPESCRIPT_EXTENSIONS.has(extension) ? "typescript" : "javascript"
|
|
251396
251703
|
);
|
|
251397
251704
|
}
|
|
251705
|
+
const genericLanguage = GENERIC_LANGUAGE_BY_EXTENSION[extension];
|
|
251706
|
+
if (genericLanguage) return parseGenericSource(content, genericLanguage);
|
|
251398
251707
|
throw new Error(`Unsupported source extension "${extension}".`);
|
|
251399
251708
|
}
|
|
251709
|
+
function parseGenericSource(content, language) {
|
|
251710
|
+
if (language === "text") return { language, symbols: [], imports: [] };
|
|
251711
|
+
const symbols = [];
|
|
251712
|
+
const imports = [];
|
|
251713
|
+
const declarationPatterns = language === "go" ? [
|
|
251714
|
+
["function", /^\s*func\s+(?:\([^)]*\)\s*)?([A-Za-z_]\w*)\s*\(/],
|
|
251715
|
+
["type", /^\s*type\s+([A-Za-z_]\w*)\s+/],
|
|
251716
|
+
["constant", /^\s*const\s+([A-Za-z_]\w*)\b/]
|
|
251717
|
+
] : language === "rust" ? [
|
|
251718
|
+
["function", /^\s*(?:pub\s+)?(?:async\s+)?fn\s+([A-Za-z_]\w*)\b/],
|
|
251719
|
+
["class", /^\s*(?:pub\s+)?struct\s+([A-Za-z_]\w*)\b/],
|
|
251720
|
+
["type", /^\s*(?:pub\s+)?(?:enum|type)\s+([A-Za-z_]\w*)\b/],
|
|
251721
|
+
["interface", /^\s*(?:pub\s+)?trait\s+([A-Za-z_]\w*)\b/],
|
|
251722
|
+
["constant", /^\s*(?:pub\s+)?const\s+([A-Za-z_]\w*)\b/]
|
|
251723
|
+
] : language === "sql" ? [
|
|
251724
|
+
[
|
|
251725
|
+
"type",
|
|
251726
|
+
/^\s*create\s+(?:or\s+replace\s+)?(?:table|view)\s+([\w.]+)/i
|
|
251727
|
+
],
|
|
251728
|
+
[
|
|
251729
|
+
"function",
|
|
251730
|
+
/^\s*create\s+(?:or\s+replace\s+)?(?:function|procedure)\s+([\w.]+)/i
|
|
251731
|
+
]
|
|
251732
|
+
] : [
|
|
251733
|
+
[
|
|
251734
|
+
"class",
|
|
251735
|
+
/^\s*(?:public\s+|private\s+|protected\s+|internal\s+|static\s+|abstract\s+|final\s+)*class\s+([A-Za-z_]\w*)\b/
|
|
251736
|
+
],
|
|
251737
|
+
[
|
|
251738
|
+
"interface",
|
|
251739
|
+
/^\s*(?:public\s+|private\s+|protected\s+|internal\s+)*interface\s+([A-Za-z_]\w*)\b/
|
|
251740
|
+
],
|
|
251741
|
+
[
|
|
251742
|
+
"type",
|
|
251743
|
+
/^\s*(?:public\s+|private\s+|protected\s+|internal\s+)*(?:enum|record|struct)\s+([A-Za-z_]\w*)\b/
|
|
251744
|
+
]
|
|
251745
|
+
];
|
|
251746
|
+
for (const [index, line] of content.split(/\r?\n/).entries()) {
|
|
251747
|
+
for (const [type, pattern] of declarationPatterns) {
|
|
251748
|
+
const match = pattern.exec(line);
|
|
251749
|
+
if (match?.[1]) {
|
|
251750
|
+
symbols.push({ name: match[1], type, line: index + 1 });
|
|
251751
|
+
break;
|
|
251752
|
+
}
|
|
251753
|
+
}
|
|
251754
|
+
const importMatch = language === "go" ? /^\s*import\s+(?:[A-Za-z_]+\s+)?["`]([^"`]+)["`]/.exec(line) : language === "rust" ? /^\s*use\s+([^;]+);/.exec(line) : /^\s*(?:import|using|#include)\s+[<"]?([^;>"]+)/.exec(line);
|
|
251755
|
+
if (importMatch?.[1]) imports.push(importMatch[1].trim());
|
|
251756
|
+
}
|
|
251757
|
+
return {
|
|
251758
|
+
language,
|
|
251759
|
+
symbols: deduplicateSymbols(symbols),
|
|
251760
|
+
imports: Array.from(new Set(imports))
|
|
251761
|
+
};
|
|
251762
|
+
}
|
|
251400
251763
|
function parseTypeScriptSource(content, filePath, language) {
|
|
251401
251764
|
const symbols = [];
|
|
251402
251765
|
const imports = [];
|
|
@@ -251557,6 +251920,24 @@ function deduplicateSymbols(symbols) {
|
|
|
251557
251920
|
});
|
|
251558
251921
|
}
|
|
251559
251922
|
var inFlightIndexes = /* @__PURE__ */ new Map();
|
|
251923
|
+
var EMBEDDING_BATCH_MAX_ITEMS = 64;
|
|
251924
|
+
var EMBEDDING_BATCH_MAX_CHARS = 12e4;
|
|
251925
|
+
function embeddingBatches(texts) {
|
|
251926
|
+
const batches = [];
|
|
251927
|
+
let current = [];
|
|
251928
|
+
let characters = 0;
|
|
251929
|
+
for (const text2 of texts) {
|
|
251930
|
+
if (current.length > 0 && (current.length >= EMBEDDING_BATCH_MAX_ITEMS || characters + text2.length > EMBEDDING_BATCH_MAX_CHARS)) {
|
|
251931
|
+
batches.push(current);
|
|
251932
|
+
current = [];
|
|
251933
|
+
characters = 0;
|
|
251934
|
+
}
|
|
251935
|
+
current.push(text2);
|
|
251936
|
+
characters += text2.length;
|
|
251937
|
+
}
|
|
251938
|
+
if (current.length > 0) batches.push(current);
|
|
251939
|
+
return batches;
|
|
251940
|
+
}
|
|
251560
251941
|
function workspaceIndexKey(cwd) {
|
|
251561
251942
|
const absolute = resolve3(cwd).replace(/\\/g, "/");
|
|
251562
251943
|
return process.platform === "win32" ? absolute.toLowerCase() : absolute;
|
|
@@ -251627,7 +252008,18 @@ var FileIndexSchema = z43.object({
|
|
|
251627
252008
|
size: z43.number().int().nonnegative().optional(),
|
|
251628
252009
|
symbols: z43.array(SymbolEntrySchema).max(5e4),
|
|
251629
252010
|
imports: z43.array(z43.string().max(4096)).max(2e4).optional(),
|
|
251630
|
-
language: z43.enum([
|
|
252011
|
+
language: z43.enum([
|
|
252012
|
+
"typescript",
|
|
252013
|
+
"javascript",
|
|
252014
|
+
"python",
|
|
252015
|
+
"go",
|
|
252016
|
+
"rust",
|
|
252017
|
+
"java",
|
|
252018
|
+
"csharp",
|
|
252019
|
+
"cpp",
|
|
252020
|
+
"sql",
|
|
252021
|
+
"text"
|
|
252022
|
+
]).optional()
|
|
251631
252023
|
});
|
|
251632
252024
|
var SymbolIndexSchema2 = z43.object({
|
|
251633
252025
|
version: z43.number().int().positive().default(1),
|
|
@@ -251650,6 +252042,7 @@ var PackageJsonSchema = z43.object({
|
|
|
251650
252042
|
});
|
|
251651
252043
|
var SYMBOL_INDEX_MAX_BYTES = 256 * 1024 * 1024;
|
|
251652
252044
|
var EMBEDDING_CACHE_MAX_BYTES = 256 * 1024 * 1024;
|
|
252045
|
+
var EMBEDDING_CACHE_MAX_ENTRIES = 5e4;
|
|
251653
252046
|
var SYMBOL_INDEX_VERSION = 2;
|
|
251654
252047
|
var EmbeddingCache = class {
|
|
251655
252048
|
constructor(cwd, modelName) {
|
|
@@ -251675,6 +252068,7 @@ var EmbeddingCache = class {
|
|
|
251675
252068
|
const parsed = EmbeddingCacheFileSchema.safeParse(JSON.parse(raw));
|
|
251676
252069
|
if (parsed.success && parsed.data.model === this.modelName) {
|
|
251677
252070
|
this.cache = parsed.data.cache;
|
|
252071
|
+
this.trim();
|
|
251678
252072
|
} else {
|
|
251679
252073
|
this.cache = {};
|
|
251680
252074
|
}
|
|
@@ -251710,14 +252104,28 @@ var EmbeddingCache = class {
|
|
|
251710
252104
|
}
|
|
251711
252105
|
get(text2) {
|
|
251712
252106
|
const hash2 = createHash3("sha256").update(text2).digest("hex");
|
|
251713
|
-
|
|
252107
|
+
const vector = this.cache[hash2];
|
|
252108
|
+
if (vector) {
|
|
252109
|
+
delete this.cache[hash2];
|
|
252110
|
+
this.cache[hash2] = vector;
|
|
252111
|
+
}
|
|
252112
|
+
return vector;
|
|
251714
252113
|
}
|
|
251715
252114
|
set(text2, vector) {
|
|
251716
252115
|
if (vector.length === 0 || vector.length > 32768 || vector.some((value) => !Number.isFinite(value))) {
|
|
251717
252116
|
return;
|
|
251718
252117
|
}
|
|
251719
252118
|
const hash2 = createHash3("sha256").update(text2).digest("hex");
|
|
252119
|
+
delete this.cache[hash2];
|
|
251720
252120
|
this.cache[hash2] = vector;
|
|
252121
|
+
this.trim();
|
|
252122
|
+
}
|
|
252123
|
+
trim() {
|
|
252124
|
+
const hashes = Object.keys(this.cache);
|
|
252125
|
+
const excess = hashes.length - EMBEDDING_CACHE_MAX_ENTRIES;
|
|
252126
|
+
for (let index = 0; index < excess; index += 1) {
|
|
252127
|
+
delete this.cache[hashes[index]];
|
|
252128
|
+
}
|
|
251721
252129
|
}
|
|
251722
252130
|
};
|
|
251723
252131
|
function getEmbeddingProvider(config) {
|
|
@@ -251847,6 +252255,7 @@ var SymbolIndexer = class {
|
|
|
251847
252255
|
const maxFileBytes = config.context.maxFileSizeKb * 1024;
|
|
251848
252256
|
let changed = false;
|
|
251849
252257
|
let i2 = 0;
|
|
252258
|
+
hybridSearch.beginBatch();
|
|
251850
252259
|
for (const relativePath of slicedFiles) {
|
|
251851
252260
|
i2++;
|
|
251852
252261
|
if (i2 % 50 === 0) {
|
|
@@ -251887,9 +252296,14 @@ var SymbolIndexer = class {
|
|
|
251887
252296
|
try {
|
|
251888
252297
|
const embeddingModel2 = config.models?.embedding || "text-embedding-3-small";
|
|
251889
252298
|
const embed = provider.embed.bind(provider);
|
|
251890
|
-
const vectors =
|
|
251891
|
-
|
|
251892
|
-
|
|
252299
|
+
const vectors = [];
|
|
252300
|
+
for (const batch of embeddingBatches(uncachedTexts)) {
|
|
252301
|
+
vectors.push(
|
|
252302
|
+
...await embed(batch, {
|
|
252303
|
+
model: embeddingModel2
|
|
252304
|
+
})
|
|
252305
|
+
);
|
|
252306
|
+
}
|
|
251893
252307
|
let vectorIdx = 0;
|
|
251894
252308
|
for (const chunk of chunks) {
|
|
251895
252309
|
if (!chunk.vector) {
|
|
@@ -251944,6 +252358,7 @@ var SymbolIndexer = class {
|
|
|
251944
252358
|
}
|
|
251945
252359
|
embedCache.save();
|
|
251946
252360
|
}
|
|
252361
|
+
await hybridSearch.commitBatch();
|
|
251947
252362
|
} catch {
|
|
251948
252363
|
}
|
|
251949
252364
|
}
|
|
@@ -252125,7 +252540,7 @@ var SymbolIndexer = class {
|
|
|
252125
252540
|
if (!currentOutput) {
|
|
252126
252541
|
currentOutput = buildOutput();
|
|
252127
252542
|
}
|
|
252128
|
-
return currentOutput;
|
|
252543
|
+
return truncateTextToTokenBudget(currentOutput, tokenLimit);
|
|
252129
252544
|
} catch {
|
|
252130
252545
|
return "";
|
|
252131
252546
|
}
|
|
@@ -252871,11 +253286,11 @@ function selectSkills(skills, userQuery, config) {
|
|
|
252871
253286
|
const query = normalize2(userQuery || "");
|
|
252872
253287
|
if (!query || config.maxActive <= 0) return [];
|
|
252873
253288
|
const queryTerms = terms(query);
|
|
252874
|
-
|
|
253289
|
+
const ranked = skills.filter((skill) => !skill.disabled).map((skill) => {
|
|
252875
253290
|
const name = skill.name.toLowerCase();
|
|
252876
|
-
const
|
|
252877
|
-
let score =
|
|
252878
|
-
if (!
|
|
253291
|
+
const explicit2 = hasExplicitMarker(query, name);
|
|
253292
|
+
let score = explicit2 ? EXPLICIT_SCORE : 0;
|
|
253293
|
+
if (!explicit2 && config.activation === "auto" && skill.allowImplicitInvocation) {
|
|
252879
253294
|
const metadata = normalize2(`${skill.name} ${skill.description}`);
|
|
252880
253295
|
const metadataTerms = new Set(terms(metadata));
|
|
252881
253296
|
for (const term of queryTerms) {
|
|
@@ -252886,18 +253301,23 @@ function selectSkills(skills, userQuery, config) {
|
|
|
252886
253301
|
if (mentionsName(query, name)) score += NAME_MENTION_SCORE;
|
|
252887
253302
|
if (score < MIN_AUTO_SCORE) score = 0;
|
|
252888
253303
|
}
|
|
252889
|
-
return { skill, explicit, score };
|
|
253304
|
+
return { skill, explicit: explicit2, score };
|
|
252890
253305
|
}).filter(({ score }) => score > 0).sort(
|
|
252891
253306
|
(left, right) => right.score - left.score || left.skill.name.localeCompare(right.skill.name)
|
|
252892
|
-
)
|
|
252893
|
-
|
|
253307
|
+
);
|
|
253308
|
+
const explicit = ranked.filter((candidate) => candidate.explicit);
|
|
253309
|
+
const automatic = ranked.filter((candidate) => !candidate.explicit).slice(0, Math.max(0, config.maxActive - explicit.length));
|
|
253310
|
+
return [...explicit, ...automatic].sort(
|
|
253311
|
+
(left, right) => right.score - left.score || left.skill.name.localeCompare(right.skill.name)
|
|
253312
|
+
).map(({ skill, explicit: explicit2 }) => {
|
|
253313
|
+
const limit = explicit2 ? config.maxSkillBytes : Math.min(config.maxAutoSkillBytes, config.maxSkillBytes);
|
|
252894
253314
|
const bounded = truncateUtf8(skill.content, limit);
|
|
252895
253315
|
return {
|
|
252896
253316
|
name: skill.name,
|
|
252897
253317
|
description: skill.description,
|
|
252898
253318
|
path: skill.path,
|
|
252899
253319
|
content: bounded.text,
|
|
252900
|
-
activation:
|
|
253320
|
+
activation: explicit2 ? "explicit" : "auto",
|
|
252901
253321
|
loadedBytes: bounded.bytes,
|
|
252902
253322
|
truncated: skill.truncated || bounded.truncated,
|
|
252903
253323
|
rootDir: skill.rootDir
|
|
@@ -253181,6 +253601,8 @@ function describe2(error) {
|
|
|
253181
253601
|
}
|
|
253182
253602
|
var SKILLS_CACHE_TTL_MS = 3e4;
|
|
253183
253603
|
var PROJECT_INSTRUCTIONS_MAX_BYTES = 1024 * 1024;
|
|
253604
|
+
var MAX_RELEVANT_FILES = 64;
|
|
253605
|
+
var FILE_SUMMARY_CONCURRENCY = 8;
|
|
253184
253606
|
var ContextPackBuilder = class {
|
|
253185
253607
|
constructor(cwd) {
|
|
253186
253608
|
this.cwd = cwd;
|
|
@@ -253213,8 +253635,10 @@ var ContextPackBuilder = class {
|
|
|
253213
253635
|
this.retrieval
|
|
253214
253636
|
).retrieve(userQuery, config, retrievalMode);
|
|
253215
253637
|
}
|
|
253216
|
-
const packedFilesPromise =
|
|
253217
|
-
relevantFiles.
|
|
253638
|
+
const packedFilesPromise = mapWithConcurrency(
|
|
253639
|
+
relevantFiles.slice(0, MAX_RELEVANT_FILES),
|
|
253640
|
+
FILE_SUMMARY_CONCURRENCY,
|
|
253641
|
+
async (f) => {
|
|
253218
253642
|
const { summary, excerpt } = await this.summarizer.summarize(f.path);
|
|
253219
253643
|
return {
|
|
253220
253644
|
path: f.path,
|
|
@@ -253223,7 +253647,7 @@ var ContextPackBuilder = class {
|
|
|
253223
253647
|
excerpt,
|
|
253224
253648
|
readOnly: f.readOnly
|
|
253225
253649
|
};
|
|
253226
|
-
}
|
|
253650
|
+
}
|
|
253227
253651
|
);
|
|
253228
253652
|
const [
|
|
253229
253653
|
projectIndex,
|
|
@@ -253241,17 +253665,19 @@ var ContextPackBuilder = class {
|
|
|
253241
253665
|
const maxTokens = Math.max(256, Math.floor(options.maxTokens ?? 128e3));
|
|
253242
253666
|
const fitted = this.fitContextToBudget(
|
|
253243
253667
|
{
|
|
253668
|
+
projectIndex,
|
|
253669
|
+
skillsIndex: skills.index,
|
|
253244
253670
|
projectInstructions,
|
|
253245
253671
|
codebaseContext,
|
|
253246
253672
|
packedFiles,
|
|
253247
253673
|
activeSkills: skills.active
|
|
253248
253674
|
},
|
|
253249
|
-
{
|
|
253675
|
+
{ maxTokens }
|
|
253250
253676
|
);
|
|
253251
253677
|
return {
|
|
253252
253678
|
projectInstructions: fitted.projectInstructions,
|
|
253253
|
-
projectIndex,
|
|
253254
|
-
skillsIndex:
|
|
253679
|
+
projectIndex: fitted.projectIndex,
|
|
253680
|
+
skillsIndex: fitted.skillsIndex,
|
|
253255
253681
|
activeSkills: fitted.activeSkills,
|
|
253256
253682
|
skillDiagnostics: skills.diagnostics,
|
|
253257
253683
|
relevantFiles: fitted.packedFiles,
|
|
@@ -253281,11 +253707,11 @@ var ContextPackBuilder = class {
|
|
|
253281
253707
|
const fitted = structuredClone(source);
|
|
253282
253708
|
const estimate = () => estimateTokenCount(
|
|
253283
253709
|
JSON.stringify({
|
|
253284
|
-
projectIndex:
|
|
253710
|
+
projectIndex: fitted.projectIndex,
|
|
253285
253711
|
projectInstructions: fitted.projectInstructions,
|
|
253286
253712
|
packedFiles: fitted.packedFiles,
|
|
253287
253713
|
codebaseContext: fitted.codebaseContext,
|
|
253288
|
-
skillsIndex:
|
|
253714
|
+
skillsIndex: fitted.skillsIndex,
|
|
253289
253715
|
activeSkills: fitted.activeSkills
|
|
253290
253716
|
})
|
|
253291
253717
|
);
|
|
@@ -253329,6 +253755,39 @@ var ContextPackBuilder = class {
|
|
|
253329
253755
|
if (nextEstimate >= usedEstimate) break;
|
|
253330
253756
|
usedEstimate = nextEstimate;
|
|
253331
253757
|
}
|
|
253758
|
+
while (usedEstimate > metadata.maxTokens && fitted.packedFiles.length > 0) {
|
|
253759
|
+
fitted.packedFiles.pop();
|
|
253760
|
+
usedEstimate = estimate();
|
|
253761
|
+
}
|
|
253762
|
+
while (usedEstimate > metadata.maxTokens) {
|
|
253763
|
+
const automaticIndex = fitted.activeSkills.findIndex(
|
|
253764
|
+
(skill) => skill.activation === "auto"
|
|
253765
|
+
);
|
|
253766
|
+
if (automaticIndex < 0) break;
|
|
253767
|
+
fitted.activeSkills.splice(automaticIndex, 1);
|
|
253768
|
+
usedEstimate = estimate();
|
|
253769
|
+
}
|
|
253770
|
+
while (usedEstimate > metadata.maxTokens && fitted.skillsIndex.length > 0) {
|
|
253771
|
+
fitted.skillsIndex.pop();
|
|
253772
|
+
usedEstimate = estimate();
|
|
253773
|
+
}
|
|
253774
|
+
if (usedEstimate > metadata.maxTokens) {
|
|
253775
|
+
fitted.codebaseContext = void 0;
|
|
253776
|
+
fitted.projectInstructions = "";
|
|
253777
|
+
fitted.projectIndex = {
|
|
253778
|
+
...fitted.projectIndex,
|
|
253779
|
+
root: ".",
|
|
253780
|
+
entrypoints: fitted.projectIndex.entrypoints.slice(0, 8),
|
|
253781
|
+
importantFiles: fitted.projectIndex.importantFiles.slice(0, 8),
|
|
253782
|
+
ignoredFiles: []
|
|
253783
|
+
};
|
|
253784
|
+
usedEstimate = estimate();
|
|
253785
|
+
}
|
|
253786
|
+
if (usedEstimate > metadata.maxTokens) {
|
|
253787
|
+
throw new Error(
|
|
253788
|
+
`Context metadata requires ${usedEstimate} estimated tokens, exceeding the hard budget of ${metadata.maxTokens}.`
|
|
253789
|
+
);
|
|
253790
|
+
}
|
|
253332
253791
|
return { ...fitted, usedEstimate };
|
|
253333
253792
|
}
|
|
253334
253793
|
async loadInstructions() {
|
|
@@ -253389,6 +253848,19 @@ var ContextPackBuilder = class {
|
|
|
253389
253848
|
};
|
|
253390
253849
|
}
|
|
253391
253850
|
};
|
|
253851
|
+
async function mapWithConcurrency(values, concurrency, mapper) {
|
|
253852
|
+
const results = new Array(values.length);
|
|
253853
|
+
let next = 0;
|
|
253854
|
+
await Promise.all(
|
|
253855
|
+
Array.from({ length: Math.min(concurrency, values.length) }, async () => {
|
|
253856
|
+
while (next < values.length) {
|
|
253857
|
+
const index = next++;
|
|
253858
|
+
results[index] = await mapper(values[index]);
|
|
253859
|
+
}
|
|
253860
|
+
})
|
|
253861
|
+
);
|
|
253862
|
+
return results;
|
|
253863
|
+
}
|
|
253392
253864
|
|
|
253393
253865
|
// ../core/dist/index.js
|
|
253394
253866
|
import { randomUUID as randomUUID7 } from "crypto";
|
|
@@ -253401,7 +253873,7 @@ import fs32 from "fs";
|
|
|
253401
253873
|
import { randomUUID as randomUUID52 } from "crypto";
|
|
253402
253874
|
import { exec as exec2, execFile as execFile3 } from "child_process";
|
|
253403
253875
|
import { promisify as promisify3 } from "util";
|
|
253404
|
-
import { z as
|
|
253876
|
+
import { z as z46 } from "zod";
|
|
253405
253877
|
import fs5 from "fs";
|
|
253406
253878
|
import path5 from "path";
|
|
253407
253879
|
import { exec, execFile as execFile4 } from "child_process";
|
|
@@ -255361,6 +255833,10 @@ var NETWORK_COMMAND_REGEXES = [
|
|
|
255361
255833
|
/\bwget\b/i,
|
|
255362
255834
|
/\binvoke-webrequest\b/i,
|
|
255363
255835
|
/\binvoke-restmethod\b/i,
|
|
255836
|
+
/\b(?:iwr|irm)\b/i,
|
|
255837
|
+
/\bnpx\b/i,
|
|
255838
|
+
/\bpnpm\s+dlx\b/i,
|
|
255839
|
+
/\bbunx\b/i,
|
|
255364
255840
|
/\bnpm\s+install\b/i,
|
|
255365
255841
|
/\bnpm\s+publish\b/i,
|
|
255366
255842
|
/\bpnpm\s+install\b/i,
|
|
@@ -255369,10 +255845,16 @@ var NETWORK_COMMAND_REGEXES = [
|
|
|
255369
255845
|
/\byarn\s+install\b/i,
|
|
255370
255846
|
/\byarn\s+add\b/i,
|
|
255371
255847
|
/\byarn\s+publish\b/i,
|
|
255372
|
-
/\
|
|
255848
|
+
/\b(?:pip|pip3|uv\s+pip)\s+install\b/i,
|
|
255849
|
+
/\buv\s+(?:tool\s+install|runx|x)\b/i,
|
|
255850
|
+
/\bcargo\s+install\b/i,
|
|
255851
|
+
/\bgo\s+install\b/i,
|
|
255373
255852
|
/\bgo\s+get\b/i,
|
|
255374
|
-
/\bgit\s+(?:fetch|pull|push|clone)\b/i,
|
|
255375
|
-
/\bgh\s+(?:api|pr|issue|release|repo|workflow|run)\b/i
|
|
255853
|
+
/\bgit\s+(?:fetch|pull|push|clone|ls-remote|submodule\s+(?:add|update))\b/i,
|
|
255854
|
+
/\bgh\s+(?:api|auth|pr|issue|release|repo|workflow|run)\b/i,
|
|
255855
|
+
/\bdocker\s+(?:pull|push|login|buildx)\b/i,
|
|
255856
|
+
/\bpodman\s+(?:pull|push|login)\b/i,
|
|
255857
|
+
/\b(?:ssh|scp|sftp|rsync)\b/i
|
|
255376
255858
|
];
|
|
255377
255859
|
var RiskClassifier = class {
|
|
255378
255860
|
static isProtectedPath(filePath, protectedPaths) {
|
|
@@ -255911,12 +256393,12 @@ import { createCipheriv, createDecipheriv, randomBytes as randomBytes2 } from "c
|
|
|
255911
256393
|
import { z as z28 } from "zod";
|
|
255912
256394
|
import { randomBytes as randomBytes22 } from "crypto";
|
|
255913
256395
|
import {
|
|
255914
|
-
closeSync as
|
|
256396
|
+
closeSync as closeSync4,
|
|
255915
256397
|
existsSync as existsSync25,
|
|
255916
256398
|
fsyncSync as fsyncSync3,
|
|
255917
256399
|
lstatSync as lstatSync22,
|
|
255918
256400
|
mkdirSync as mkdirSync22,
|
|
255919
|
-
openSync as
|
|
256401
|
+
openSync as openSync4,
|
|
255920
256402
|
renameSync as renameSync22,
|
|
255921
256403
|
rmSync as rmSync22,
|
|
255922
256404
|
statSync,
|
|
@@ -256300,30 +256782,30 @@ var RollbackManager = class {
|
|
|
256300
256782
|
const existingMode = existsSync25(path24) ? statSync(path24).mode : void 0;
|
|
256301
256783
|
let descriptor;
|
|
256302
256784
|
try {
|
|
256303
|
-
descriptor =
|
|
256785
|
+
descriptor = openSync4(
|
|
256304
256786
|
temporaryPath,
|
|
256305
256787
|
"wx",
|
|
256306
256788
|
existingMode === void 0 ? 438 : existingMode
|
|
256307
256789
|
);
|
|
256308
256790
|
writeFileSync6(descriptor, content);
|
|
256309
256791
|
fsyncSync3(descriptor);
|
|
256310
|
-
|
|
256792
|
+
closeSync4(descriptor);
|
|
256311
256793
|
descriptor = void 0;
|
|
256312
256794
|
renameSync22(temporaryPath, path24);
|
|
256313
256795
|
this.fsyncParentDirectory(dirname7(path24));
|
|
256314
256796
|
} finally {
|
|
256315
|
-
if (descriptor !== void 0)
|
|
256797
|
+
if (descriptor !== void 0) closeSync4(descriptor);
|
|
256316
256798
|
rmSync22(temporaryPath, { force: true });
|
|
256317
256799
|
}
|
|
256318
256800
|
}
|
|
256319
256801
|
fsyncParentDirectory(directory) {
|
|
256320
256802
|
let descriptor;
|
|
256321
256803
|
try {
|
|
256322
|
-
descriptor =
|
|
256804
|
+
descriptor = openSync4(directory, "r");
|
|
256323
256805
|
fsyncSync3(descriptor);
|
|
256324
256806
|
} catch {
|
|
256325
256807
|
} finally {
|
|
256326
|
-
if (descriptor !== void 0)
|
|
256808
|
+
if (descriptor !== void 0) closeSync4(descriptor);
|
|
256327
256809
|
}
|
|
256328
256810
|
}
|
|
256329
256811
|
};
|
|
@@ -256607,30 +257089,31 @@ import { z as z29 } from "zod";
|
|
|
256607
257089
|
import { createHash as createHash5, randomUUID as randomUUID6 } from "crypto";
|
|
256608
257090
|
import { dirname as dirname8, isAbsolute as isAbsolute4, join as join9, relative as relative4, resolve as resolve7, sep } from "path";
|
|
256609
257091
|
import {
|
|
256610
|
-
|
|
256611
|
-
closeSync as closeSync4,
|
|
257092
|
+
closeSync as closeSync5,
|
|
256612
257093
|
existsSync as existsSync10,
|
|
256613
257094
|
fsyncSync as fsyncSync4,
|
|
256614
257095
|
lstatSync as lstatSync5,
|
|
256615
257096
|
mkdirSync as mkdirSync5,
|
|
256616
|
-
openSync as
|
|
257097
|
+
openSync as openSync5,
|
|
256617
257098
|
readdirSync as readdirSync3,
|
|
256618
257099
|
renameSync as renameSync5,
|
|
256619
257100
|
rmSync as rmSync4,
|
|
257101
|
+
statSync as statSync2,
|
|
256620
257102
|
writeFileSync as writeFileSync7
|
|
256621
257103
|
} from "fs";
|
|
257104
|
+
import { z as z210 } from "zod";
|
|
256622
257105
|
import { createHash as createHash23 } from "crypto";
|
|
256623
257106
|
import {
|
|
256624
257107
|
closeSync as closeSync22,
|
|
256625
257108
|
lstatSync as lstatSync23,
|
|
256626
257109
|
openSync as openSync22,
|
|
256627
257110
|
realpathSync as realpathSync2,
|
|
256628
|
-
statSync as
|
|
257111
|
+
statSync as statSync22,
|
|
256629
257112
|
unlinkSync as unlinkSync4
|
|
256630
257113
|
} from "fs";
|
|
256631
257114
|
import { homedir as homedir5 } from "os";
|
|
256632
257115
|
import { basename as basename2, dirname as dirname23, isAbsolute as isAbsolute23, join as join25, parse as parse2, resolve as resolve24 } from "path";
|
|
256633
|
-
import { z as
|
|
257116
|
+
import { z as z37 } from "zod";
|
|
256634
257117
|
import {
|
|
256635
257118
|
closeSync as closeSync32,
|
|
256636
257119
|
existsSync as existsSync26,
|
|
@@ -256641,7 +257124,7 @@ import {
|
|
|
256641
257124
|
unlinkSync as unlinkSync22
|
|
256642
257125
|
} from "fs";
|
|
256643
257126
|
import { basename as basename22, join as join34, resolve as resolve32 } from "path";
|
|
256644
|
-
import { z as
|
|
257127
|
+
import { z as z45 } from "zod";
|
|
256645
257128
|
var SafeObjectKeySchema = z29.string().refine(
|
|
256646
257129
|
(key) => !["__proto__", "constructor", "prototype"].includes(key),
|
|
256647
257130
|
"Unsafe object key."
|
|
@@ -256956,6 +257439,13 @@ var PRIVATE_DIRECTORY_MODE2 = 448;
|
|
|
256956
257439
|
var PRIVATE_FILE_MODE2 = 384;
|
|
256957
257440
|
var SESSION_SNAPSHOT_MAX_BYTES = 256 * 1024 * 1024;
|
|
256958
257441
|
var SESSION_LOG_MAX_BYTES = 256 * 1024 * 1024;
|
|
257442
|
+
var HISTORY_JOURNAL_COMPACT_BYTES = 1024 * 1024;
|
|
257443
|
+
var HISTORY_JOURNAL_COMPACT_RECORDS = 32;
|
|
257444
|
+
var HistoryJournalRecordSchema = z210.object({
|
|
257445
|
+
schemaVersion: z210.literal(1),
|
|
257446
|
+
startIndex: z210.number().int().min(0).max(1e5),
|
|
257447
|
+
messages: StoredHistorySchema
|
|
257448
|
+
});
|
|
256959
257449
|
var SessionCreationInputSchema = SessionSchema.pick({
|
|
256960
257450
|
provider: true,
|
|
256961
257451
|
model: true
|
|
@@ -256978,10 +257468,10 @@ function writeJsonAtomically(filePath, value, schema) {
|
|
|
256978
257468
|
const temporaryPath = `${filePath}.${process.pid}.${randomUUID6()}.tmp`;
|
|
256979
257469
|
let temporaryFd;
|
|
256980
257470
|
try {
|
|
256981
|
-
temporaryFd =
|
|
257471
|
+
temporaryFd = openSync5(temporaryPath, "wx", PRIVATE_FILE_MODE2);
|
|
256982
257472
|
writeFileSync7(temporaryFd, serialized, { encoding: "utf8" });
|
|
256983
257473
|
fsyncSync4(temporaryFd);
|
|
256984
|
-
|
|
257474
|
+
closeSync5(temporaryFd);
|
|
256985
257475
|
temporaryFd = void 0;
|
|
256986
257476
|
preserveLastKnownGoodFile(filePath, schema);
|
|
256987
257477
|
replaceFileAtomically(temporaryPath, filePath);
|
|
@@ -256989,7 +257479,7 @@ function writeJsonAtomically(filePath, value, schema) {
|
|
|
256989
257479
|
} finally {
|
|
256990
257480
|
if (temporaryFd !== void 0) {
|
|
256991
257481
|
try {
|
|
256992
|
-
|
|
257482
|
+
closeSync5(temporaryFd);
|
|
256993
257483
|
} catch {
|
|
256994
257484
|
}
|
|
256995
257485
|
}
|
|
@@ -257003,13 +257493,13 @@ function syncParentDirectory(filePath) {
|
|
|
257003
257493
|
if (process.platform === "win32") return;
|
|
257004
257494
|
let directoryFd;
|
|
257005
257495
|
try {
|
|
257006
|
-
directoryFd =
|
|
257496
|
+
directoryFd = openSync5(dirname8(filePath), "r");
|
|
257007
257497
|
fsyncSync4(directoryFd);
|
|
257008
257498
|
} catch {
|
|
257009
257499
|
} finally {
|
|
257010
257500
|
if (directoryFd !== void 0) {
|
|
257011
257501
|
try {
|
|
257012
|
-
|
|
257502
|
+
closeSync5(directoryFd);
|
|
257013
257503
|
} catch {
|
|
257014
257504
|
}
|
|
257015
257505
|
}
|
|
@@ -257022,16 +257512,16 @@ function preserveLastKnownGoodFile(filePath, schema) {
|
|
|
257022
257512
|
const temporaryBackupPath = `${backupPath}.${process.pid}.${randomUUID6()}.tmp`;
|
|
257023
257513
|
let descriptor;
|
|
257024
257514
|
try {
|
|
257025
|
-
descriptor =
|
|
257515
|
+
descriptor = openSync5(temporaryBackupPath, "wx", PRIVATE_FILE_MODE2);
|
|
257026
257516
|
writeFileSync7(descriptor, JSON.stringify(previous, null, 2), "utf8");
|
|
257027
257517
|
fsyncSync4(descriptor);
|
|
257028
|
-
|
|
257518
|
+
closeSync5(descriptor);
|
|
257029
257519
|
descriptor = void 0;
|
|
257030
257520
|
replaceFileAtomically(temporaryBackupPath, backupPath);
|
|
257031
257521
|
} finally {
|
|
257032
257522
|
if (descriptor !== void 0) {
|
|
257033
257523
|
try {
|
|
257034
|
-
|
|
257524
|
+
closeSync5(descriptor);
|
|
257035
257525
|
} catch {
|
|
257036
257526
|
}
|
|
257037
257527
|
}
|
|
@@ -257081,12 +257571,14 @@ function replaceFileAtomically(temporaryPath, destinationPath) {
|
|
|
257081
257571
|
}
|
|
257082
257572
|
}
|
|
257083
257573
|
function appendJsonLine(filePath, value) {
|
|
257084
|
-
|
|
257085
|
-
|
|
257086
|
-
|
|
257087
|
-
|
|
257088
|
-
|
|
257089
|
-
}
|
|
257574
|
+
const descriptor = openSync5(filePath, "a", PRIVATE_FILE_MODE2);
|
|
257575
|
+
try {
|
|
257576
|
+
writeFileSync7(descriptor, `${JSON.stringify(value)}
|
|
257577
|
+
`, "utf8");
|
|
257578
|
+
fsyncSync4(descriptor);
|
|
257579
|
+
} finally {
|
|
257580
|
+
closeSync5(descriptor);
|
|
257581
|
+
}
|
|
257090
257582
|
}
|
|
257091
257583
|
function replaceWorkspacePath(text2, cwd) {
|
|
257092
257584
|
const escaped = cwd.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -257129,6 +257621,7 @@ function normalizeTracePath(filePath, cwd) {
|
|
|
257129
257621
|
var SessionStore = class {
|
|
257130
257622
|
cwd;
|
|
257131
257623
|
sessionRootPath;
|
|
257624
|
+
historyJournalWrites = /* @__PURE__ */ new Map();
|
|
257132
257625
|
constructor(cwd, sessionRootPath = ".orbit/sessions") {
|
|
257133
257626
|
this.cwd = resolve7(cwd);
|
|
257134
257627
|
this.sessionRootPath = sessionRootPath.trim();
|
|
@@ -257503,7 +257996,36 @@ var SessionStore = class {
|
|
|
257503
257996
|
const validated = StoredHistorySchema.parse(history);
|
|
257504
257997
|
const dir = this.resolveSessionDirectory(sessionId);
|
|
257505
257998
|
const historyPath = join9(dir, "history.json");
|
|
257506
|
-
|
|
257999
|
+
const journalPath = join9(dir, "history.jsonl");
|
|
258000
|
+
const previous = this.readHistoryFiles(historyPath, journalPath);
|
|
258001
|
+
let startIndex = 0;
|
|
258002
|
+
while (startIndex < previous.length && startIndex < validated.length && JSON.stringify(previous[startIndex]) === JSON.stringify(validated[startIndex])) {
|
|
258003
|
+
startIndex += 1;
|
|
258004
|
+
}
|
|
258005
|
+
if (startIndex === previous.length && startIndex === validated.length)
|
|
258006
|
+
return;
|
|
258007
|
+
const priorWrites = this.historyJournalWrites.get(sessionId) ?? 0;
|
|
258008
|
+
if (!existsSync10(historyPath) || priorWrites < 2) {
|
|
258009
|
+
writeJsonAtomically(historyPath, validated, StoredHistorySchema);
|
|
258010
|
+
rmSync4(journalPath, { force: true });
|
|
258011
|
+
this.historyJournalWrites.set(sessionId, priorWrites + 1);
|
|
258012
|
+
return;
|
|
258013
|
+
}
|
|
258014
|
+
appendJsonLine(
|
|
258015
|
+
journalPath,
|
|
258016
|
+
HistoryJournalRecordSchema.parse({
|
|
258017
|
+
schemaVersion: 1,
|
|
258018
|
+
startIndex,
|
|
258019
|
+
messages: validated.slice(startIndex)
|
|
258020
|
+
})
|
|
258021
|
+
);
|
|
258022
|
+
const writes = priorWrites + 1;
|
|
258023
|
+
this.historyJournalWrites.set(sessionId, writes);
|
|
258024
|
+
if (writes >= HISTORY_JOURNAL_COMPACT_RECORDS || statSync2(journalPath).size >= HISTORY_JOURNAL_COMPACT_BYTES) {
|
|
258025
|
+
writeJsonAtomically(historyPath, validated, StoredHistorySchema);
|
|
258026
|
+
rmSync4(journalPath, { force: true });
|
|
258027
|
+
this.historyJournalWrites.set(sessionId, 0);
|
|
258028
|
+
}
|
|
257507
258029
|
}
|
|
257508
258030
|
getHistory(sessionId) {
|
|
257509
258031
|
let file;
|
|
@@ -257512,12 +258034,37 @@ var SessionStore = class {
|
|
|
257512
258034
|
} catch {
|
|
257513
258035
|
return [];
|
|
257514
258036
|
}
|
|
257515
|
-
|
|
258037
|
+
return this.readHistoryFiles(file, join9(dirname8(file), "history.jsonl"));
|
|
258038
|
+
}
|
|
258039
|
+
readHistoryFiles(snapshotPath, journalPath) {
|
|
258040
|
+
let history = [];
|
|
258041
|
+
for (const candidate of [snapshotPath, `${snapshotPath}.bak`]) {
|
|
257516
258042
|
if (!existsSync10(candidate)) continue;
|
|
257517
258043
|
const parsed = readValidatedSnapshot(candidate, StoredHistorySchema);
|
|
257518
|
-
if (parsed)
|
|
258044
|
+
if (parsed) {
|
|
258045
|
+
history = parsed;
|
|
258046
|
+
break;
|
|
258047
|
+
}
|
|
257519
258048
|
}
|
|
257520
|
-
return
|
|
258049
|
+
if (!existsSync10(journalPath)) return history;
|
|
258050
|
+
try {
|
|
258051
|
+
const journal = readBoundedRegularFile(
|
|
258052
|
+
journalPath,
|
|
258053
|
+
SESSION_LOG_MAX_BYTES
|
|
258054
|
+
);
|
|
258055
|
+
if (journal === void 0) return history;
|
|
258056
|
+
for (const line of journal.split("\n")) {
|
|
258057
|
+
if (!line.trim()) continue;
|
|
258058
|
+
const parsed = HistoryJournalRecordSchema.safeParse(JSON.parse(line));
|
|
258059
|
+
if (!parsed.success || parsed.data.startIndex > history.length) break;
|
|
258060
|
+
history = StoredHistorySchema.parse([
|
|
258061
|
+
...history.slice(0, parsed.data.startIndex),
|
|
258062
|
+
...parsed.data.messages
|
|
258063
|
+
]);
|
|
258064
|
+
}
|
|
258065
|
+
} catch {
|
|
258066
|
+
}
|
|
258067
|
+
return history;
|
|
257521
258068
|
}
|
|
257522
258069
|
deleteSession(id) {
|
|
257523
258070
|
SessionIdSchema.parse(id);
|
|
@@ -257972,21 +258519,21 @@ var PROJECT_REGISTRY_LOCK_RETRIES = 50;
|
|
|
257972
258519
|
var PROJECT_REGISTRY_LOCK_WAIT_MS = 10;
|
|
257973
258520
|
var PROJECT_REGISTRY_STALE_LOCK_MS = 1e4;
|
|
257974
258521
|
var PROJECT_REGISTRY_LOCK_WAIT = new Int32Array(new SharedArrayBuffer(4));
|
|
257975
|
-
var ProjectRecordSchema =
|
|
257976
|
-
id:
|
|
257977
|
-
path:
|
|
257978
|
-
name:
|
|
257979
|
-
createdAt:
|
|
257980
|
-
lastOpenedAt:
|
|
257981
|
-
lastSessionId:
|
|
257982
|
-
archivedAt:
|
|
258522
|
+
var ProjectRecordSchema = z37.object({
|
|
258523
|
+
id: z37.string().regex(/^proj_[a-f0-9]{16}$/),
|
|
258524
|
+
path: z37.string().min(1).max(4096).refine((value) => !/[\u0000-\u001f\u007f]/.test(value)),
|
|
258525
|
+
name: z37.string().trim().min(1).max(200),
|
|
258526
|
+
createdAt: z37.string().datetime(),
|
|
258527
|
+
lastOpenedAt: z37.string().datetime(),
|
|
258528
|
+
lastSessionId: z37.string().min(1).max(1e3).optional(),
|
|
258529
|
+
archivedAt: z37.string().datetime().optional()
|
|
257983
258530
|
});
|
|
257984
|
-
var ProjectRegistrySnapshotSchema =
|
|
257985
|
-
schemaVersion:
|
|
257986
|
-
projects:
|
|
258531
|
+
var ProjectRegistrySnapshotSchema = z37.object({
|
|
258532
|
+
schemaVersion: z37.literal(1),
|
|
258533
|
+
projects: z37.array(ProjectRecordSchema).max(MAX_PROJECTS)
|
|
257987
258534
|
});
|
|
257988
|
-
var LegacyProjectRegistrySnapshotSchema =
|
|
257989
|
-
projects:
|
|
258535
|
+
var LegacyProjectRegistrySnapshotSchema = z37.object({
|
|
258536
|
+
projects: z37.array(ProjectRecordSchema).max(MAX_PROJECTS)
|
|
257990
258537
|
});
|
|
257991
258538
|
function parseProjectRegistrySnapshot(value) {
|
|
257992
258539
|
const current = ProjectRegistrySnapshotSchema.safeParse(value);
|
|
@@ -258181,7 +258728,7 @@ function projectIdentity(projectPath) {
|
|
|
258181
258728
|
}
|
|
258182
258729
|
function isDirectory(targetPath) {
|
|
258183
258730
|
try {
|
|
258184
|
-
return
|
|
258731
|
+
return statSync22(targetPath).isDirectory();
|
|
258185
258732
|
} catch {
|
|
258186
258733
|
return false;
|
|
258187
258734
|
}
|
|
@@ -258207,20 +258754,20 @@ var AGENT_RUN_LOCK_RETRIES = 50;
|
|
|
258207
258754
|
var AGENT_RUN_LOCK_WAIT_MS = 10;
|
|
258208
258755
|
var AGENT_RUN_STALE_LOCK_MS = 1e4;
|
|
258209
258756
|
var AGENT_RUN_LOCK_WAIT = new Int32Array(new SharedArrayBuffer(4));
|
|
258210
|
-
var AgentIdSchema =
|
|
258211
|
-
var AgentRunIdSchema =
|
|
258212
|
-
var AgentRunOwnerSchema =
|
|
258213
|
-
instanceId:
|
|
258214
|
-
pid:
|
|
258215
|
-
processStartedAt:
|
|
258216
|
-
heartbeatAt:
|
|
258217
|
-
expiresAt:
|
|
258757
|
+
var AgentIdSchema = z45.string().regex(/^agent_[a-z0-9-]+$/, "Invalid agent id.");
|
|
258758
|
+
var AgentRunIdSchema = z45.string().regex(/^run_[a-z0-9-]+$/, "Invalid agent run id.");
|
|
258759
|
+
var AgentRunOwnerSchema = z45.object({
|
|
258760
|
+
instanceId: z45.string().regex(/^orbit_[a-z0-9-]+$/, "Invalid Orbit instance id."),
|
|
258761
|
+
pid: z45.number().int().positive(),
|
|
258762
|
+
processStartedAt: z45.string().datetime(),
|
|
258763
|
+
heartbeatAt: z45.string().datetime(),
|
|
258764
|
+
expiresAt: z45.string().datetime()
|
|
258218
258765
|
});
|
|
258219
|
-
var DurableAgentStateSchema =
|
|
258766
|
+
var DurableAgentStateSchema = z45.object({
|
|
258220
258767
|
id: AgentIdSchema,
|
|
258221
|
-
role:
|
|
258222
|
-
task:
|
|
258223
|
-
status:
|
|
258768
|
+
role: z45.string().min(1).max(80),
|
|
258769
|
+
task: z45.string().min(1).max(8e3),
|
|
258770
|
+
status: z45.enum([
|
|
258224
258771
|
"pending",
|
|
258225
258772
|
"running",
|
|
258226
258773
|
"completed",
|
|
@@ -258228,35 +258775,35 @@ var DurableAgentStateSchema = z37.object({
|
|
|
258228
258775
|
"aborted",
|
|
258229
258776
|
"blocked"
|
|
258230
258777
|
]),
|
|
258231
|
-
model:
|
|
258778
|
+
model: z45.string().min(1).max(200),
|
|
258232
258779
|
sessionId: SessionIdSchema.optional(),
|
|
258233
|
-
budgetUsd:
|
|
258234
|
-
costUsd:
|
|
258235
|
-
access:
|
|
258236
|
-
mode:
|
|
258237
|
-
scopes:
|
|
258780
|
+
budgetUsd: z45.number().finite().nonnegative(),
|
|
258781
|
+
costUsd: z45.number().finite().nonnegative().default(0),
|
|
258782
|
+
access: z45.object({
|
|
258783
|
+
mode: z45.enum(["read", "write"]),
|
|
258784
|
+
scopes: z45.array(z45.string().min(1).max(1e3)).min(1).max(100)
|
|
258238
258785
|
}),
|
|
258239
|
-
steering:
|
|
258240
|
-
count:
|
|
258241
|
-
lastAt:
|
|
258786
|
+
steering: z45.object({
|
|
258787
|
+
count: z45.number().int().nonnegative().max(1e4),
|
|
258788
|
+
lastAt: z45.string().datetime().optional()
|
|
258242
258789
|
}).default({ count: 0 }),
|
|
258243
|
-
startedAt:
|
|
258244
|
-
endedAt:
|
|
258245
|
-
error:
|
|
258790
|
+
startedAt: z45.string().datetime().optional(),
|
|
258791
|
+
endedAt: z45.string().datetime().optional(),
|
|
258792
|
+
error: z45.string().max(4e3).optional()
|
|
258246
258793
|
});
|
|
258247
|
-
var AgentRunSchema =
|
|
258248
|
-
schemaVersion:
|
|
258794
|
+
var AgentRunSchema = z45.object({
|
|
258795
|
+
schemaVersion: z45.literal(1),
|
|
258249
258796
|
id: AgentRunIdSchema,
|
|
258250
|
-
task:
|
|
258251
|
-
status:
|
|
258252
|
-
budgetUsd:
|
|
258253
|
-
costUsd:
|
|
258254
|
-
createdAt:
|
|
258255
|
-
updatedAt:
|
|
258797
|
+
task: z45.string().min(1).max(2e4),
|
|
258798
|
+
status: z45.enum(["running", "completed", "failed", "aborted"]),
|
|
258799
|
+
budgetUsd: z45.number().finite().nonnegative(),
|
|
258800
|
+
costUsd: z45.number().finite().nonnegative().default(0),
|
|
258801
|
+
createdAt: z45.string().datetime(),
|
|
258802
|
+
updatedAt: z45.string().datetime(),
|
|
258256
258803
|
owner: AgentRunOwnerSchema.optional(),
|
|
258257
258804
|
/** Legacy field retained while schema-version 1 records are migrated lazily. */
|
|
258258
|
-
ownerPid:
|
|
258259
|
-
agents:
|
|
258805
|
+
ownerPid: z45.number().int().positive().optional(),
|
|
258806
|
+
agents: z45.array(DurableAgentStateSchema).max(128)
|
|
258260
258807
|
});
|
|
258261
258808
|
var AgentRunStore = class {
|
|
258262
258809
|
constructor(cwd, options = {}) {
|
|
@@ -259318,7 +259865,10 @@ var RoutingInputSchema = z211.object({
|
|
|
259318
259865
|
fallbackModel: z211.string().min(1).optional(),
|
|
259319
259866
|
activeModel: z211.string().min(1).optional(),
|
|
259320
259867
|
repairTurn: z211.boolean().default(false),
|
|
259321
|
-
hasWrittenFiles: z211.boolean().default(false)
|
|
259868
|
+
hasWrittenFiles: z211.boolean().default(false),
|
|
259869
|
+
affectedFileCount: z211.number().int().min(0).max(1e5).default(0),
|
|
259870
|
+
verificationFailureCount: z211.number().int().min(0).max(1e3).default(0),
|
|
259871
|
+
estimatedContextTokens: z211.number().int().min(0).optional()
|
|
259322
259872
|
});
|
|
259323
259873
|
var COMPLEX_SIGNALS = [
|
|
259324
259874
|
"debug",
|
|
@@ -259375,11 +259925,19 @@ var SIMPLE_SIGNALS = [
|
|
|
259375
259925
|
"\u7EE7\u7EED"
|
|
259376
259926
|
];
|
|
259377
259927
|
function classifyTaskComplexity(input) {
|
|
259378
|
-
if (input.repairTurn || input.
|
|
259928
|
+
if (input.repairTurn || (input.verificationFailureCount ?? 0) > 0 || (input.affectedFileCount ?? 0) >= 3 || (input.estimatedContextTokens ?? 0) >= 64e3) {
|
|
259929
|
+
return "complex";
|
|
259930
|
+
}
|
|
259379
259931
|
const query = input.query.toLowerCase().trim();
|
|
259380
259932
|
const complex = COMPLEX_SIGNALS.some((signal) => query.includes(signal));
|
|
259381
|
-
|
|
259382
|
-
|
|
259933
|
+
const referencedFiles = new Set(
|
|
259934
|
+
query.match(/[\w@.-]+(?:\/[\w@.-]+)+\.[a-z0-9]+/gi) ?? []
|
|
259935
|
+
).size;
|
|
259936
|
+
const structuralComplexity = referencedFiles >= 3 || query.length >= 600 || (query.match(/(?:^|\n)\s*(?:[-*]|\d+[.)])\s+/g) ?? []).length >= 4 || /```[\s\S]*```/.test(query);
|
|
259937
|
+
if (complex || structuralComplexity) return "complex";
|
|
259938
|
+
const simpleSignal = SIMPLE_SIGNALS.some((signal) => query.includes(signal));
|
|
259939
|
+
const wordCount = query.split(/\s+/u).filter(Boolean).length;
|
|
259940
|
+
if (!input.hasWrittenFiles && (simpleSignal || wordCount <= 8 && query.length <= 80)) {
|
|
259383
259941
|
return "simple";
|
|
259384
259942
|
}
|
|
259385
259943
|
return "balanced";
|
|
@@ -259405,11 +259963,11 @@ function routeModel(input) {
|
|
|
259405
259963
|
const complex = complexity === "complex";
|
|
259406
259964
|
const simple = complexity === "simple";
|
|
259407
259965
|
if (value.activeModel) {
|
|
259408
|
-
if (value.activeModel === value.fastModel && (complex || value.
|
|
259966
|
+
if (value.activeModel === value.fastModel && (complex || value.affectedFileCount >= 2)) {
|
|
259409
259967
|
return decision(
|
|
259410
259968
|
qualityModel,
|
|
259411
259969
|
"quality",
|
|
259412
|
-
value.
|
|
259970
|
+
value.affectedFileCount >= 2 ? "write_escalation" : "complex_request",
|
|
259413
259971
|
"high"
|
|
259414
259972
|
);
|
|
259415
259973
|
}
|
|
@@ -260223,21 +260781,21 @@ function countRepairAttemptsForCurrentTask(history) {
|
|
|
260223
260781
|
var execPromise = promisify(exec);
|
|
260224
260782
|
var execFilePromise = promisify(execFile4);
|
|
260225
260783
|
var VERIFICATION_CONTRACT_MAX_BYTES = 1048576;
|
|
260226
|
-
var VerificationSuitesSchema =
|
|
260784
|
+
var VerificationSuitesSchema = z46.record(z46.string().min(1).max(200), z46.string().max(2e4)).refine((suites) => Object.keys(suites).length <= 100, {
|
|
260227
260785
|
message: "Verification contracts may define at most 100 suites."
|
|
260228
260786
|
});
|
|
260229
|
-
var VerificationFileListSchema =
|
|
260787
|
+
var VerificationFileListSchema = z46.array(z46.string().min(1).max(4096)).max(1e4);
|
|
260230
260788
|
function safeFailureOutput(error) {
|
|
260231
260789
|
const record = typeof error === "object" && error !== null ? error : {};
|
|
260232
260790
|
const output = [record.stdout, record.stderr].filter((value) => typeof value === "string" && !!value).join("\n").trim();
|
|
260233
260791
|
const message2 = error instanceof Error ? error.message : String(error);
|
|
260234
260792
|
return LogTruncator.truncate(redactSecrets(output || message2), 80, 8e3);
|
|
260235
260793
|
}
|
|
260236
|
-
var VerificationContractSchema =
|
|
260794
|
+
var VerificationContractSchema = z46.object({
|
|
260237
260795
|
suites: VerificationSuitesSchema.default({}),
|
|
260238
260796
|
allowedModifiedFiles: VerificationFileListSchema.optional(),
|
|
260239
260797
|
requiredFiles: VerificationFileListSchema.optional(),
|
|
260240
|
-
maxRepairAttempts:
|
|
260798
|
+
maxRepairAttempts: z46.number().int().min(0).max(10).default(3)
|
|
260241
260799
|
});
|
|
260242
260800
|
var VerificationContractManager = class {
|
|
260243
260801
|
constructor(cwd, sessionId, checkpointManager, trusted = false, commandTimeoutMs = 12e4) {
|
|
@@ -260544,6 +261102,7 @@ function readGitOutput(cwd, args) {
|
|
|
260544
261102
|
const child = spawn3("git", args, {
|
|
260545
261103
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
260546
261104
|
cwd,
|
|
261105
|
+
env: buildSanitizedChildEnvironment(),
|
|
260547
261106
|
stdio: ["ignore", "pipe", "ignore"]
|
|
260548
261107
|
});
|
|
260549
261108
|
const chunks = [];
|
|
@@ -260570,6 +261129,7 @@ function hashGitOutput(cwd, args) {
|
|
|
260570
261129
|
const child = spawn3("git", args, {
|
|
260571
261130
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
260572
261131
|
cwd,
|
|
261132
|
+
env: buildSanitizedChildEnvironment(),
|
|
260573
261133
|
stdio: ["ignore", "pipe", "ignore"]
|
|
260574
261134
|
});
|
|
260575
261135
|
child.stdout.on("data", (chunk) => hash2.update(chunk));
|
|
@@ -260656,10 +261216,9 @@ function prepareIsolatedGitCommit(cwd, requestedPaths) {
|
|
|
260656
261216
|
path32.dirname(gitIndexPath),
|
|
260657
261217
|
`orbit-index-${randomUUID24()}`
|
|
260658
261218
|
);
|
|
260659
|
-
const isolatedEnvironment = {
|
|
260660
|
-
|
|
260661
|
-
|
|
260662
|
-
};
|
|
261219
|
+
const isolatedEnvironment = buildSanitizedChildEnvironment({
|
|
261220
|
+
extra: { GIT_INDEX_FILE: temporaryIndexPath }
|
|
261221
|
+
});
|
|
260663
261222
|
let disposed = false;
|
|
260664
261223
|
try {
|
|
260665
261224
|
try {
|
|
@@ -262128,11 +262687,25 @@ Note: To find where a symbol (class, function, etc.) is declared or referenced,
|
|
|
262128
262687
|
);
|
|
262129
262688
|
const userQueryText = (currentUserMessage?.content.filter((block2) => block2.type === "text").map((block2) => block2.type === "text" ? block2.text : "").join("\n") || this.state.task).toLowerCase();
|
|
262130
262689
|
const currentTurnStartIndex = currentUserMessage ? this.state.history.lastIndexOf(currentUserMessage) : 0;
|
|
262131
|
-
const
|
|
262132
|
-
(
|
|
262133
|
-
(
|
|
262134
|
-
)
|
|
262690
|
+
const writeCalls = this.state.history.slice(Math.max(0, currentTurnStartIndex)).flatMap(
|
|
262691
|
+
(message2) => message2.role === "assistant" ? message2.content.filter(
|
|
262692
|
+
(block2) => block2.type === "tool_call" && (block2.toolCall.name === "write_file" || block2.toolCall.name === "edit_file")
|
|
262693
|
+
) : []
|
|
262135
262694
|
);
|
|
262695
|
+
const hasWrittenFiles = writeCalls.length > 0;
|
|
262696
|
+
const affectedFileCount = new Set(
|
|
262697
|
+
writeCalls.map((block2) => {
|
|
262698
|
+
if (block2.type !== "tool_call") return "";
|
|
262699
|
+
try {
|
|
262700
|
+
const pathValue = toUnknownRecord(
|
|
262701
|
+
JSON.parse(block2.toolCall.arguments)
|
|
262702
|
+
).path;
|
|
262703
|
+
return typeof pathValue === "string" ? pathValue : "";
|
|
262704
|
+
} catch {
|
|
262705
|
+
return "";
|
|
262706
|
+
}
|
|
262707
|
+
}).filter(Boolean)
|
|
262708
|
+
).size;
|
|
262136
262709
|
const routingDecision = routeModel({
|
|
262137
262710
|
query: userQueryText,
|
|
262138
262711
|
defaultModel: this.config.models.default,
|
|
@@ -262142,12 +262715,14 @@ Note: To find where a symbol (class, function, etc.) is declared or referenced,
|
|
|
262142
262715
|
fallbackModel: this.fallbackModelForRun || void 0,
|
|
262143
262716
|
activeModel: this.activeModelForRun || void 0,
|
|
262144
262717
|
repairTurn: isRepairTurn,
|
|
262145
|
-
hasWrittenFiles
|
|
262718
|
+
hasWrittenFiles,
|
|
262719
|
+
affectedFileCount
|
|
262146
262720
|
});
|
|
262147
262721
|
const isComplexTask = classifyTaskComplexity({
|
|
262148
262722
|
query: userQueryText,
|
|
262149
262723
|
repairTurn: isRepairTurn,
|
|
262150
|
-
hasWrittenFiles
|
|
262724
|
+
hasWrittenFiles,
|
|
262725
|
+
affectedFileCount
|
|
262151
262726
|
}) === "complex";
|
|
262152
262727
|
nextModel = routingDecision.model;
|
|
262153
262728
|
if (!this.options?.modelOverride && !this.fallbackModelForRun) {
|
|
@@ -264018,9 +264593,9 @@ ${stdout2.substring(0, 2e4)}`
|
|
|
264018
264593
|
eventBus.emitEvent("tool_result", {
|
|
264019
264594
|
toolCallId: tc.id,
|
|
264020
264595
|
toolName: tc.name,
|
|
264021
|
-
result: finalResult.ok ? finalResult.data : void 0,
|
|
264022
|
-
display: finalResult.ok ? finalResult.display : void 0,
|
|
264023
|
-
error: finalResult.ok ? void 0 : finalResult.error || "Unknown error"
|
|
264596
|
+
result: finalResult.ok ? redactSensitiveValue(finalResult.data) : void 0,
|
|
264597
|
+
display: finalResult.ok ? redactSecrets(finalResult.display || "") : void 0,
|
|
264598
|
+
error: finalResult.ok ? void 0 : redactSecrets(finalResult.error || "Unknown error")
|
|
264024
264599
|
});
|
|
264025
264600
|
const guardNudge = this.progressGuard.record({
|
|
264026
264601
|
name: tc.name,
|
|
@@ -264311,7 +264886,10 @@ ${diff.substring(0, 2e4)}`
|
|
|
264311
264886
|
const { stdout: stdout2, stderr } = await execPromise2(hookCommand, {
|
|
264312
264887
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
264313
264888
|
cwd: this.cwd,
|
|
264314
|
-
env: {
|
|
264889
|
+
env: buildSanitizedChildEnvironment({
|
|
264890
|
+
mode: "minimal",
|
|
264891
|
+
extra: { ORBIT_FILE: relativePath }
|
|
264892
|
+
}),
|
|
264315
264893
|
timeout: this.config.tools.bash.timeoutMs,
|
|
264316
264894
|
signal: this.abortController?.signal
|
|
264317
264895
|
});
|
|
@@ -267501,17 +268079,17 @@ function buildDeepSeekDoctorSection(cwd, config) {
|
|
|
267501
268079
|
);
|
|
267502
268080
|
lines.push(
|
|
267503
268081
|
picocolors6.gray(
|
|
267504
|
-
`\u25CF Model
|
|
268082
|
+
`\u25CF Model profiles: Flash=${DEEPSEEK_V4_FLASH_VERSION}; Pro=${DEEPSEEK_V4_PRO_VERSION}; ${DEEPSEEK_V4_CONTEXT_TOKENS.toLocaleString("en-US")} context tokens and ${DEEPSEEK_V4_MAX_OUTPUT_TOKENS.toLocaleString("en-US")} maximum output tokens.`
|
|
267505
268083
|
)
|
|
267506
268084
|
);
|
|
267507
268085
|
lines.push(
|
|
267508
268086
|
picocolors6.gray(
|
|
267509
|
-
`\u25CF Orbit
|
|
268087
|
+
`\u25CF Orbit V4 policy: Flash=${config.agent?.fastMaxOutputTokens ?? 32768} output tokens with low/high/max task-adaptive thinking; Pro=${config.agent?.maxOutputTokens ?? 16384} with high/max thinking.`
|
|
267510
268088
|
)
|
|
267511
268089
|
);
|
|
267512
268090
|
lines.push(
|
|
267513
268091
|
picocolors6.gray(
|
|
267514
|
-
`\u25CF DeepSeek API format: ${provider?.deepSeekApiFormat ?? "chat-completions"}. Official Flash
|
|
268092
|
+
`\u25CF DeepSeek API format: ${provider?.deepSeekApiFormat ?? "chat-completions"}. Official Flash and Pro use Responses in auto mode; compatible gateways use their configured DeepSeek transport.`
|
|
267515
268093
|
)
|
|
267516
268094
|
);
|
|
267517
268095
|
lines.push(
|
|
@@ -267730,22 +268308,22 @@ async function runDoctor(cwd, options = {}) {
|
|
|
267730
268308
|
import picocolors7 from "picocolors";
|
|
267731
268309
|
import { createHash as createHash8, randomUUID as randomUUID8 } from "crypto";
|
|
267732
268310
|
import { resolve as resolve8 } from "path";
|
|
267733
|
-
import { z as
|
|
267734
|
-
var BenchOptionsSchema =
|
|
267735
|
-
prompt:
|
|
267736
|
-
provider:
|
|
267737
|
-
model:
|
|
267738
|
-
models:
|
|
267739
|
-
repeat:
|
|
267740
|
-
maxTokens:
|
|
267741
|
-
cacheProfile:
|
|
267742
|
-
minCacheHit:
|
|
267743
|
-
maxFirstDeltaMs:
|
|
267744
|
-
maxFirstTextMs:
|
|
267745
|
-
minThroughput:
|
|
267746
|
-
maxErrorRate:
|
|
267747
|
-
thinking:
|
|
267748
|
-
json:
|
|
268311
|
+
import { z as z47 } from "zod";
|
|
268312
|
+
var BenchOptionsSchema = z47.object({
|
|
268313
|
+
prompt: z47.string().optional(),
|
|
268314
|
+
provider: z47.string().optional(),
|
|
268315
|
+
model: z47.string().optional(),
|
|
268316
|
+
models: z47.string().optional(),
|
|
268317
|
+
repeat: z47.union([z47.number(), z47.string()]).optional(),
|
|
268318
|
+
maxTokens: z47.union([z47.number(), z47.string()]).optional(),
|
|
268319
|
+
cacheProfile: z47.boolean().optional(),
|
|
268320
|
+
minCacheHit: z47.union([z47.number(), z47.string()]).optional(),
|
|
268321
|
+
maxFirstDeltaMs: z47.union([z47.number(), z47.string()]).optional(),
|
|
268322
|
+
maxFirstTextMs: z47.union([z47.number(), z47.string()]).optional(),
|
|
268323
|
+
minThroughput: z47.union([z47.number(), z47.string()]).optional(),
|
|
268324
|
+
maxErrorRate: z47.union([z47.number(), z47.string()]).optional(),
|
|
268325
|
+
thinking: z47.string().optional(),
|
|
268326
|
+
json: z47.boolean().optional()
|
|
267749
268327
|
});
|
|
267750
268328
|
function parseBenchOptions(value) {
|
|
267751
268329
|
return BenchOptionsSchema.parse(value);
|
|
@@ -270972,6 +271550,33 @@ function buildSlashCommandHelp(language) {
|
|
|
270972
271550
|
// src/tui/TerminalText.ts
|
|
270973
271551
|
var TERMINAL_CONTROL_PATTERN = /(?:[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;;[^\u0007]*(?:\u0007|\u001b\\))/g;
|
|
270974
271552
|
var HYPERLINK_CLOSE = "\x1B]8;;\x07";
|
|
271553
|
+
var GRAPHEME_SEGMENTER = new Intl.Segmenter(void 0, {
|
|
271554
|
+
granularity: "grapheme"
|
|
271555
|
+
});
|
|
271556
|
+
var ZERO_WIDTH_FORMAT_CHARACTERS = /* @__PURE__ */ new Set([
|
|
271557
|
+
"\u200C",
|
|
271558
|
+
"\u200D",
|
|
271559
|
+
"\uFE0E",
|
|
271560
|
+
"\uFE0F"
|
|
271561
|
+
]);
|
|
271562
|
+
function graphemeEntries(value) {
|
|
271563
|
+
return [...GRAPHEME_SEGMENTER.segment(value)].map(({ segment, index }) => ({
|
|
271564
|
+
segment,
|
|
271565
|
+
index
|
|
271566
|
+
}));
|
|
271567
|
+
}
|
|
271568
|
+
function graphemes(value) {
|
|
271569
|
+
return graphemeEntries(value).map((entry) => entry.segment);
|
|
271570
|
+
}
|
|
271571
|
+
function graphemeWidth(grapheme) {
|
|
271572
|
+
if (!grapheme || [...grapheme].every(
|
|
271573
|
+
(character) => /^\p{Mark}$/u.test(character) || ZERO_WIDTH_FORMAT_CHARACTERS.has(character)
|
|
271574
|
+
)) {
|
|
271575
|
+
return 0;
|
|
271576
|
+
}
|
|
271577
|
+
const codePoints = [...grapheme].map((character) => character.codePointAt(0)).filter((codePoint) => codePoint !== void 0);
|
|
271578
|
+
return grapheme.includes("\u200D") || codePoints.some((codePoint) => isFullWidth2(codePoint)) ? 2 : 1;
|
|
271579
|
+
}
|
|
270975
271580
|
function stripAnsiCodes(str) {
|
|
270976
271581
|
return str.replace(TERMINAL_CONTROL_PATTERN, "");
|
|
270977
271582
|
}
|
|
@@ -270985,10 +271590,8 @@ function isFullWidth2(codePoint) {
|
|
|
270985
271590
|
function truncateToWidth(str, maxWidth) {
|
|
270986
271591
|
let width = 0;
|
|
270987
271592
|
let result = "";
|
|
270988
|
-
for (const char of str) {
|
|
270989
|
-
const
|
|
270990
|
-
if (code === void 0) continue;
|
|
270991
|
-
const charWidth = isFullWidth2(code) ? 2 : 1;
|
|
271593
|
+
for (const char of graphemes(str)) {
|
|
271594
|
+
const charWidth = graphemeWidth(char);
|
|
270992
271595
|
if (width + charWidth > maxWidth) break;
|
|
270993
271596
|
width += charWidth;
|
|
270994
271597
|
result += char;
|
|
@@ -270999,10 +271602,8 @@ function truncateFromEndToWidth(str, maxWidth) {
|
|
|
270999
271602
|
if (maxWidth <= 0) return "";
|
|
271000
271603
|
let width = 0;
|
|
271001
271604
|
const result = [];
|
|
271002
|
-
for (const char of
|
|
271003
|
-
const
|
|
271004
|
-
if (code === void 0) continue;
|
|
271005
|
-
const charWidth = isFullWidth2(code) ? 2 : 1;
|
|
271605
|
+
for (const char of graphemes(str).reverse()) {
|
|
271606
|
+
const charWidth = graphemeWidth(char);
|
|
271006
271607
|
if (width + charWidth > maxWidth) break;
|
|
271007
271608
|
width += charWidth;
|
|
271008
271609
|
result.push(char);
|
|
@@ -271034,9 +271635,8 @@ function truncatePathToWidth(path9, maxWidth) {
|
|
|
271034
271635
|
}
|
|
271035
271636
|
function getStringWidth(str) {
|
|
271036
271637
|
let width = 0;
|
|
271037
|
-
for (const char of stripAnsiCodes(str)) {
|
|
271038
|
-
|
|
271039
|
-
if (code !== void 0) width += isFullWidth2(code) ? 2 : 1;
|
|
271638
|
+
for (const char of graphemes(stripAnsiCodes(str))) {
|
|
271639
|
+
width += graphemeWidth(char);
|
|
271040
271640
|
}
|
|
271041
271641
|
return width;
|
|
271042
271642
|
}
|
|
@@ -271071,21 +271671,22 @@ function wrapAnsiLine(line, maxWidth) {
|
|
|
271071
271671
|
index += controlSequence.length;
|
|
271072
271672
|
continue;
|
|
271073
271673
|
}
|
|
271074
|
-
const
|
|
271075
|
-
const
|
|
271076
|
-
const char
|
|
271077
|
-
|
|
271078
|
-
|
|
271079
|
-
|
|
271080
|
-
|
|
271081
|
-
|
|
271082
|
-
|
|
271083
|
-
|
|
271084
|
-
|
|
271085
|
-
|
|
271086
|
-
|
|
271674
|
+
const plainEnd = match?.index ?? line.length;
|
|
271675
|
+
const plainChunk = line.slice(index, plainEnd);
|
|
271676
|
+
for (const char of graphemes(plainChunk)) {
|
|
271677
|
+
const charWidth = graphemeWidth(char);
|
|
271678
|
+
if (currentWidth + charWidth > maxWidth) {
|
|
271679
|
+
if (activeColor) currentLine += "\x1B[0m";
|
|
271680
|
+
if (activeHyperlink) currentLine += HYPERLINK_CLOSE;
|
|
271681
|
+
lines.push(currentLine);
|
|
271682
|
+
currentLine = activeColor + activeHyperlink + char;
|
|
271683
|
+
currentWidth = charWidth;
|
|
271684
|
+
} else {
|
|
271685
|
+
currentLine += char;
|
|
271686
|
+
currentWidth += charWidth;
|
|
271687
|
+
}
|
|
271087
271688
|
}
|
|
271088
|
-
index
|
|
271689
|
+
index = plainEnd;
|
|
271089
271690
|
}
|
|
271090
271691
|
if (currentLine) lines.push(currentLine);
|
|
271091
271692
|
return lines;
|
|
@@ -271095,23 +271696,17 @@ function wrapInputText(str, maxWidth) {
|
|
|
271095
271696
|
let currentLine = "";
|
|
271096
271697
|
let currentWidth = 0;
|
|
271097
271698
|
let currentStart = 0;
|
|
271098
|
-
for (
|
|
271099
|
-
const
|
|
271100
|
-
|
|
271101
|
-
|
|
271102
|
-
continue;
|
|
271103
|
-
}
|
|
271104
|
-
if (code === 10) {
|
|
271699
|
+
for (const entry of graphemeEntries(str)) {
|
|
271700
|
+
const index = entry.index;
|
|
271701
|
+
const char = entry.segment;
|
|
271702
|
+
if (char === "\n") {
|
|
271105
271703
|
lines.push({ text: currentLine, start: currentStart, end: index });
|
|
271106
|
-
index++;
|
|
271107
271704
|
currentLine = "";
|
|
271108
271705
|
currentWidth = 0;
|
|
271109
|
-
currentStart = index;
|
|
271706
|
+
currentStart = index + char.length;
|
|
271110
271707
|
continue;
|
|
271111
271708
|
}
|
|
271112
|
-
const
|
|
271113
|
-
const char = str.substring(index, index + charLength);
|
|
271114
|
-
const charWidth = isFullWidth2(code) ? 2 : 1;
|
|
271709
|
+
const charWidth = graphemeWidth(char);
|
|
271115
271710
|
if (currentLine && currentWidth + charWidth > maxWidth) {
|
|
271116
271711
|
lines.push({ text: currentLine, start: currentStart, end: index });
|
|
271117
271712
|
currentLine = "";
|
|
@@ -271120,7 +271715,6 @@ function wrapInputText(str, maxWidth) {
|
|
|
271120
271715
|
}
|
|
271121
271716
|
currentLine += char;
|
|
271122
271717
|
currentWidth += charWidth;
|
|
271123
|
-
index += charLength;
|
|
271124
271718
|
}
|
|
271125
271719
|
lines.push({ text: currentLine, start: currentStart, end: str.length });
|
|
271126
271720
|
return lines;
|
|
@@ -271148,7 +271742,7 @@ function formatWrappedLines(wrappedLines, inputLength) {
|
|
|
271148
271742
|
let charIndex = 0;
|
|
271149
271743
|
return wrappedLines.map((line) => {
|
|
271150
271744
|
let formattedLine = "";
|
|
271151
|
-
for (const char of line) {
|
|
271745
|
+
for (const char of graphemes(line)) {
|
|
271152
271746
|
const color = charIndex < inputLength ? "\x1B[1;38;2;245;242;232m" : "\x1B[38;2;148;146;138m";
|
|
271153
271747
|
formattedLine += `${color}${char}\x1B[0m`;
|
|
271154
271748
|
charIndex += char.length;
|
|
@@ -271275,11 +271869,11 @@ function findPreviousHistoryEntry(history, query, startIndex = history.length) {
|
|
|
271275
271869
|
// src/tui/InputHistoryStore.ts
|
|
271276
271870
|
import { join as join14 } from "path";
|
|
271277
271871
|
import { homedir as homedir6 } from "os";
|
|
271278
|
-
import { z as
|
|
271872
|
+
import { z as z48 } from "zod";
|
|
271279
271873
|
var INPUT_HISTORY_MAX_BYTES = 1048576;
|
|
271280
271874
|
var INPUT_HISTORY_MAX_ENTRIES = 500;
|
|
271281
271875
|
var INPUT_HISTORY_ENTRY_MAX_CHARS = 2e4;
|
|
271282
|
-
var inputHistorySchema =
|
|
271876
|
+
var inputHistorySchema = z48.array(z48.string().max(INPUT_HISTORY_ENTRY_MAX_CHARS)).max(INPUT_HISTORY_MAX_ENTRIES);
|
|
271283
271877
|
var InputHistoryStore = class {
|
|
271284
271878
|
constructor(filePath = join14(homedir6(), ".orbit", "input_history.json")) {
|
|
271285
271879
|
this.filePath = filePath;
|
|
@@ -271850,13 +272444,13 @@ function renderPromptScreen(state, viewport, theme = MORANDI) {
|
|
|
271850
272444
|
|
|
271851
272445
|
// src/runtime/UpdateManager.ts
|
|
271852
272446
|
import { execFile as execFile5, execFileSync as execFileSync6 } from "child_process";
|
|
271853
|
-
import { z as
|
|
271854
|
-
var SemanticVersionSchema =
|
|
271855
|
-
var UpdateChannelSchema =
|
|
271856
|
-
var UpdateCheckSchema =
|
|
272447
|
+
import { z as z49 } from "zod";
|
|
272448
|
+
var SemanticVersionSchema = z49.string().trim().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/);
|
|
272449
|
+
var UpdateChannelSchema = z49.enum(["stable", "beta"]);
|
|
272450
|
+
var UpdateCheckSchema = z49.object({
|
|
271857
272451
|
currentVersion: SemanticVersionSchema,
|
|
271858
272452
|
latestVersion: SemanticVersionSchema,
|
|
271859
|
-
updateAvailable:
|
|
272453
|
+
updateAvailable: z49.boolean()
|
|
271860
272454
|
});
|
|
271861
272455
|
var UpdateManager = class {
|
|
271862
272456
|
executable;
|
|
@@ -271940,9 +272534,9 @@ var UpdateManager = class {
|
|
|
271940
272534
|
],
|
|
271941
272535
|
{ timeoutMs: this.timeoutMs, inheritOutput: false }
|
|
271942
272536
|
);
|
|
271943
|
-
const parsed =
|
|
271944
|
-
dependencies:
|
|
271945
|
-
"@orbit-build/cli":
|
|
272537
|
+
const parsed = z49.object({
|
|
272538
|
+
dependencies: z49.object({
|
|
272539
|
+
"@orbit-build/cli": z49.object({ version: SemanticVersionSchema })
|
|
271946
272540
|
})
|
|
271947
272541
|
}).parse(JSON.parse(raw));
|
|
271948
272542
|
return parsed.dependencies["@orbit-build/cli"].version;
|
|
@@ -273551,10 +274145,10 @@ var FullscreenTui = class {
|
|
|
273551
274145
|
if (this.thoughtTimer) clearInterval(this.thoughtTimer);
|
|
273552
274146
|
this.thoughtTimer = setInterval(() => {
|
|
273553
274147
|
if (this.isThinking) {
|
|
273554
|
-
this.thoughtElapsed +=
|
|
274148
|
+
this.thoughtElapsed += 250;
|
|
273555
274149
|
this.render();
|
|
273556
274150
|
}
|
|
273557
|
-
},
|
|
274151
|
+
}, 250);
|
|
273558
274152
|
this.render();
|
|
273559
274153
|
}
|
|
273560
274154
|
handleModelDelta(text2) {
|
|
@@ -273932,7 +274526,8 @@ var FullscreenTui = class {
|
|
|
273932
274526
|
headerLines = [headerLine1, headerLine2, headerLine3, headerLine4];
|
|
273933
274527
|
}
|
|
273934
274528
|
const renderedLines = [];
|
|
273935
|
-
const
|
|
274529
|
+
const renderHistory = this.history.length > 800 ? this.history.slice(-800) : this.history;
|
|
274530
|
+
const conversation = buildTuiConversationViewModel(renderHistory);
|
|
273936
274531
|
const turns = conversation.turns;
|
|
273937
274532
|
const lastAsst = conversation.lastAssistant;
|
|
273938
274533
|
const uBorder = " ";
|
|
@@ -274249,7 +274844,7 @@ import { dirname as dirname13, resolve as resolve14 } from "path";
|
|
|
274249
274844
|
import { homedir as homedir10 } from "os";
|
|
274250
274845
|
import http3 from "http";
|
|
274251
274846
|
import { randomBytes as randomBytes4, randomUUID as randomUUID12, timingSafeEqual as timingSafeEqual2 } from "crypto";
|
|
274252
|
-
import { z as
|
|
274847
|
+
import { z as z67 } from "zod";
|
|
274253
274848
|
|
|
274254
274849
|
// src/runtime/CommandRouter.ts
|
|
274255
274850
|
import picocolors18 from "picocolors";
|
|
@@ -274260,11 +274855,11 @@ import { basename as basename4, extname as extname3, join as join16 } from "path
|
|
|
274260
274855
|
import { homedir as homedir8 } from "os";
|
|
274261
274856
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
274262
274857
|
import { parse as parse3 } from "yaml";
|
|
274263
|
-
import { z as
|
|
274264
|
-
var CommandMetadataSchema =
|
|
274265
|
-
description:
|
|
274266
|
-
argumentHint:
|
|
274267
|
-
"argument-hint":
|
|
274858
|
+
import { z as z50 } from "zod";
|
|
274859
|
+
var CommandMetadataSchema = z50.object({
|
|
274860
|
+
description: z50.string().max(240).optional(),
|
|
274861
|
+
argumentHint: z50.string().max(120).optional(),
|
|
274862
|
+
"argument-hint": z50.string().max(120).optional()
|
|
274268
274863
|
});
|
|
274269
274864
|
var VALID_COMMAND_NAME = /^[a-z0-9][a-z0-9-_]{0,47}$/i;
|
|
274270
274865
|
var MAX_COMMAND_FILE_BYTES = 256 * 1024;
|
|
@@ -274468,21 +275063,21 @@ import { createRequire as createRequire2 } from "module";
|
|
|
274468
275063
|
import http2 from "http";
|
|
274469
275064
|
import { randomBytes as randomBytes3, randomUUID as randomUUID9 } from "crypto";
|
|
274470
275065
|
import { isAbsolute as isAbsolute5, relative as relative7, resolve as resolve11 } from "path";
|
|
274471
|
-
import { z as
|
|
275066
|
+
import { z as z56 } from "zod";
|
|
274472
275067
|
|
|
274473
275068
|
// src/runtime/AutocompleteCandidates.ts
|
|
274474
275069
|
import glob4 from "fast-glob";
|
|
274475
275070
|
import { existsSync as existsSync17, readdirSync as readdirSync8 } from "fs";
|
|
274476
275071
|
import { homedir as homedir9 } from "os";
|
|
274477
275072
|
import { dirname as dirname10, join as join17, resolve as resolve9 } from "path";
|
|
274478
|
-
import { z as
|
|
275073
|
+
import { z as z51 } from "zod";
|
|
274479
275074
|
var AUTOCOMPLETE_SYMBOL_INDEX_MAX_BYTES = 256 * 1024 * 1024;
|
|
274480
|
-
var symbolIndexSchema =
|
|
274481
|
-
files:
|
|
274482
|
-
|
|
274483
|
-
symbols:
|
|
274484
|
-
|
|
274485
|
-
name:
|
|
275075
|
+
var symbolIndexSchema = z51.object({
|
|
275076
|
+
files: z51.record(
|
|
275077
|
+
z51.object({
|
|
275078
|
+
symbols: z51.array(
|
|
275079
|
+
z51.object({
|
|
275080
|
+
name: z51.string().min(1)
|
|
274486
275081
|
})
|
|
274487
275082
|
).optional()
|
|
274488
275083
|
})
|
|
@@ -278800,7 +279395,7 @@ var WEB_UI_CLIENT_SELECT_SCRIPT = String.raw` const selectControls = new Map();
|
|
|
278800
279395
|
searchInput.className = 'select-search';
|
|
278801
279396
|
searchInput.autocomplete = 'off';
|
|
278802
279397
|
searchInput.spellcheck = false;
|
|
278803
|
-
searchInput.placeholder = document.documentElement.lang
|
|
279398
|
+
searchInput.placeholder = document.documentElement.lang.startsWith('zh') ? '搜索模型…' : 'Search models…';
|
|
278804
279399
|
searchInput.setAttribute('aria-label', searchInput.placeholder);
|
|
278805
279400
|
searchWrap.append(searchInput);
|
|
278806
279401
|
entry.menu.append(searchWrap);
|
|
@@ -278844,7 +279439,7 @@ var WEB_UI_CLIENT_SELECT_SCRIPT = String.raw` const selectControls = new Map();
|
|
|
278844
279439
|
if (searchInput) {
|
|
278845
279440
|
const empty = document.createElement('div');
|
|
278846
279441
|
empty.className = 'select-empty';
|
|
278847
|
-
empty.textContent = document.documentElement.lang
|
|
279442
|
+
empty.textContent = document.documentElement.lang.startsWith('zh') ? '没有匹配的模型' : 'No matching models';
|
|
278848
279443
|
empty.hidden = true;
|
|
278849
279444
|
entry.menu.append(empty);
|
|
278850
279445
|
searchInput.addEventListener('input', () => {
|
|
@@ -280539,7 +281134,7 @@ import { relative as relative5 } from "path";
|
|
|
280539
281134
|
|
|
280540
281135
|
// src/runtime/webui/WebUiSecurity.ts
|
|
280541
281136
|
import { timingSafeEqual } from "crypto";
|
|
280542
|
-
import { z as
|
|
281137
|
+
import { z as z55 } from "zod";
|
|
280543
281138
|
|
|
280544
281139
|
// src/runtime/webui/WebUiErrors.ts
|
|
280545
281140
|
var WebUiRequestError = class extends Error {
|
|
@@ -280859,7 +281454,7 @@ function sanitizeBaseUrl(value) {
|
|
|
280859
281454
|
}
|
|
280860
281455
|
}
|
|
280861
281456
|
function webRequestErrorStatus(error) {
|
|
280862
|
-
if (error instanceof
|
|
281457
|
+
if (error instanceof z55.ZodError) return 400;
|
|
280863
281458
|
if (error instanceof WebUiRequestError) return error.statusCode;
|
|
280864
281459
|
return 500;
|
|
280865
281460
|
}
|
|
@@ -288015,6 +288610,36 @@ var WEB_UI_RESPONSIVE_STYLES = String.raw`
|
|
|
288015
288610
|
transition-duration: 0.01ms !important;
|
|
288016
288611
|
}
|
|
288017
288612
|
}
|
|
288613
|
+
|
|
288614
|
+
@media (forced-colors: active) {
|
|
288615
|
+
button,
|
|
288616
|
+
input,
|
|
288617
|
+
select,
|
|
288618
|
+
textarea,
|
|
288619
|
+
.message.user .message-content,
|
|
288620
|
+
.tool-card,
|
|
288621
|
+
.code-block,
|
|
288622
|
+
.composer-shell,
|
|
288623
|
+
.inspector,
|
|
288624
|
+
.sidebar {
|
|
288625
|
+
forced-color-adjust: auto;
|
|
288626
|
+
border-color: CanvasText;
|
|
288627
|
+
}
|
|
288628
|
+
|
|
288629
|
+
button:focus-visible,
|
|
288630
|
+
input:focus-visible,
|
|
288631
|
+
select:focus-visible,
|
|
288632
|
+
textarea:focus-visible,
|
|
288633
|
+
summary:focus-visible {
|
|
288634
|
+
outline: 3px solid Highlight;
|
|
288635
|
+
}
|
|
288636
|
+
|
|
288637
|
+
.tool-status,
|
|
288638
|
+
.control-turn-indicator,
|
|
288639
|
+
.message-progress-indicator {
|
|
288640
|
+
border: 2px solid CanvasText;
|
|
288641
|
+
}
|
|
288642
|
+
}
|
|
288018
288643
|
`;
|
|
288019
288644
|
|
|
288020
288645
|
// src/runtime/webui/styles/WebUiSelectStyles.ts
|
|
@@ -289454,137 +290079,137 @@ function normalizePath4(path9) {
|
|
|
289454
290079
|
}
|
|
289455
290080
|
|
|
289456
290081
|
// src/runtime/webui/WebUiRuntime.ts
|
|
289457
|
-
var WebTurnIdSchema =
|
|
289458
|
-
var AttachmentIdsSchema =
|
|
290082
|
+
var WebTurnIdSchema = z56.string().trim().min(8).max(100).regex(/^[a-zA-Z0-9_-]+$/);
|
|
290083
|
+
var AttachmentIdsSchema = z56.array(WebTurnIdSchema).max(4).refine((ids) => new Set(ids).size === ids.length, {
|
|
289459
290084
|
message: "Attachment IDs must be unique."
|
|
289460
290085
|
});
|
|
289461
|
-
var MessagePageQuerySchema =
|
|
289462
|
-
before:
|
|
289463
|
-
limit:
|
|
290086
|
+
var MessagePageQuerySchema = z56.object({
|
|
290087
|
+
before: z56.coerce.number().int().min(1).max(1e7).optional(),
|
|
290088
|
+
limit: z56.coerce.number().int().min(20).max(100).optional()
|
|
289464
290089
|
}).strict();
|
|
289465
|
-
var ChatRequestSchema =
|
|
289466
|
-
prompt:
|
|
290090
|
+
var ChatRequestSchema = z56.object({
|
|
290091
|
+
prompt: z56.string().trim().min(1).max(1e5),
|
|
289467
290092
|
turnId: WebTurnIdSchema.optional(),
|
|
289468
290093
|
attachmentIds: AttachmentIdsSchema.optional()
|
|
289469
290094
|
}).strict();
|
|
289470
|
-
var InputQueueIdSchema =
|
|
289471
|
-
var InputQueueActionSchema =
|
|
289472
|
-
|
|
289473
|
-
action:
|
|
289474
|
-
prompt:
|
|
289475
|
-
mode:
|
|
290095
|
+
var InputQueueIdSchema = z56.string().trim().regex(/^input_[a-zA-Z0-9_-]+$/).max(200);
|
|
290096
|
+
var InputQueueActionSchema = z56.discriminatedUnion("action", [
|
|
290097
|
+
z56.object({
|
|
290098
|
+
action: z56.literal("enqueue"),
|
|
290099
|
+
prompt: z56.string().trim().min(1).max(1e5),
|
|
290100
|
+
mode: z56.enum(["follow_up", "steer"]).default("follow_up"),
|
|
289476
290101
|
attachmentIds: AttachmentIdsSchema.optional()
|
|
289477
290102
|
}).strict(),
|
|
289478
|
-
|
|
289479
|
-
action:
|
|
290103
|
+
z56.object({
|
|
290104
|
+
action: z56.literal("update"),
|
|
289480
290105
|
inputId: InputQueueIdSchema,
|
|
289481
|
-
prompt:
|
|
289482
|
-
mode:
|
|
290106
|
+
prompt: z56.string().trim().min(1).max(1e5).optional(),
|
|
290107
|
+
mode: z56.enum(["follow_up", "steer"]).optional()
|
|
289483
290108
|
}).strict(),
|
|
289484
|
-
|
|
289485
|
-
action:
|
|
290109
|
+
z56.object({
|
|
290110
|
+
action: z56.literal("move"),
|
|
289486
290111
|
inputId: InputQueueIdSchema,
|
|
289487
|
-
direction:
|
|
290112
|
+
direction: z56.enum(["up", "down"])
|
|
289488
290113
|
}).strict(),
|
|
289489
|
-
|
|
289490
|
-
action:
|
|
290114
|
+
z56.object({
|
|
290115
|
+
action: z56.literal("remove"),
|
|
289491
290116
|
inputId: InputQueueIdSchema
|
|
289492
290117
|
}).strict(),
|
|
289493
|
-
|
|
290118
|
+
z56.object({ action: z56.literal("clear") }).strict()
|
|
289494
290119
|
]).superRefine((action, context) => {
|
|
289495
290120
|
if (action.action === "update" && action.prompt === void 0 && action.mode === void 0) {
|
|
289496
290121
|
context.addIssue({
|
|
289497
|
-
code:
|
|
290122
|
+
code: z56.ZodIssueCode.custom,
|
|
289498
290123
|
message: "A queued-input update must change the prompt or mode."
|
|
289499
290124
|
});
|
|
289500
290125
|
}
|
|
289501
290126
|
});
|
|
289502
|
-
var CancelRequestSchema =
|
|
289503
|
-
var ApprovalDecisionSchema =
|
|
290127
|
+
var CancelRequestSchema = z56.object({ turnId: WebTurnIdSchema.nullish() }).strict();
|
|
290128
|
+
var ApprovalDecisionSchema = z56.object({
|
|
289504
290129
|
id: WebTurnIdSchema,
|
|
289505
|
-
approved:
|
|
290130
|
+
approved: z56.boolean()
|
|
289506
290131
|
}).strict();
|
|
289507
|
-
var SettingsPatchSchema =
|
|
290132
|
+
var SettingsPatchSchema = z56.object({
|
|
289508
290133
|
language: OrbitLanguageSchema.optional(),
|
|
289509
|
-
provider:
|
|
289510
|
-
model:
|
|
289511
|
-
permissionMode:
|
|
289512
|
-
webSearchEnabled:
|
|
289513
|
-
webSearchProvider:
|
|
289514
|
-
webSearchMaxResults:
|
|
289515
|
-
skillsEnabled:
|
|
289516
|
-
skillsActivation:
|
|
289517
|
-
skillsMaxActive:
|
|
289518
|
-
skillsDisabled:
|
|
290134
|
+
provider: z56.string().trim().min(1).max(256).optional(),
|
|
290135
|
+
model: z56.string().trim().min(1).max(200).optional(),
|
|
290136
|
+
permissionMode: z56.enum(["strict", "normal", "auto", "plan"]).optional(),
|
|
290137
|
+
webSearchEnabled: z56.boolean().optional(),
|
|
290138
|
+
webSearchProvider: z56.enum(["auto", "searxng", "tavily", "bing", "duckduckgo"]).optional(),
|
|
290139
|
+
webSearchMaxResults: z56.number().int().min(1).max(20).optional(),
|
|
290140
|
+
skillsEnabled: z56.boolean().optional(),
|
|
290141
|
+
skillsActivation: z56.enum(["auto", "explicit"]).optional(),
|
|
290142
|
+
skillsMaxActive: z56.number().int().min(0).max(8).optional(),
|
|
290143
|
+
skillsDisabled: z56.array(z56.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/)).max(200).optional()
|
|
289519
290144
|
}).strict();
|
|
289520
|
-
var CapabilityNameSchema =
|
|
289521
|
-
var CapabilityCreateSchema =
|
|
289522
|
-
|
|
289523
|
-
kind:
|
|
290145
|
+
var CapabilityNameSchema = z56.string().trim().min(1).max(48).regex(/^[a-z0-9][a-z0-9-]*$/);
|
|
290146
|
+
var CapabilityCreateSchema = z56.discriminatedUnion("kind", [
|
|
290147
|
+
z56.object({
|
|
290148
|
+
kind: z56.literal("skill"),
|
|
289524
290149
|
name: CapabilityNameSchema,
|
|
289525
|
-
description:
|
|
289526
|
-
instructions:
|
|
289527
|
-
scope:
|
|
290150
|
+
description: z56.string().trim().min(1).max(2e3),
|
|
290151
|
+
instructions: z56.string().trim().min(1).max(24e3),
|
|
290152
|
+
scope: z56.enum(["local", "versioned"]).optional()
|
|
289528
290153
|
}).strict(),
|
|
289529
|
-
|
|
289530
|
-
kind:
|
|
290154
|
+
z56.object({
|
|
290155
|
+
kind: z56.literal("workflow"),
|
|
289531
290156
|
name: CapabilityNameSchema,
|
|
289532
|
-
description:
|
|
289533
|
-
instructions:
|
|
289534
|
-
skills:
|
|
289535
|
-
argumentHint:
|
|
290157
|
+
description: z56.string().trim().min(1).max(240),
|
|
290158
|
+
instructions: z56.string().trim().min(1).max(24e3),
|
|
290159
|
+
skills: z56.array(CapabilityNameSchema).max(8),
|
|
290160
|
+
argumentHint: z56.string().trim().min(1).max(160).optional()
|
|
289536
290161
|
}).strict()
|
|
289537
290162
|
]);
|
|
289538
|
-
var SessionActionSchema =
|
|
289539
|
-
|
|
290163
|
+
var SessionActionSchema = z56.discriminatedUnion("action", [
|
|
290164
|
+
z56.object({ action: z56.literal("new") }).strict(),
|
|
289540
290165
|
...["resume", "archive", "restore", "delete"].map(
|
|
289541
|
-
(action) =>
|
|
289542
|
-
action:
|
|
289543
|
-
sessionId:
|
|
290166
|
+
(action) => z56.object({
|
|
290167
|
+
action: z56.literal(action),
|
|
290168
|
+
sessionId: z56.string().trim().min(1).max(200).regex(/^[a-zA-Z0-9_-]+$/)
|
|
289544
290169
|
}).strict()
|
|
289545
290170
|
)
|
|
289546
290171
|
]);
|
|
289547
|
-
var ProjectActionSchema =
|
|
289548
|
-
|
|
289549
|
-
|
|
289550
|
-
action:
|
|
289551
|
-
path:
|
|
290172
|
+
var ProjectActionSchema = z56.discriminatedUnion("action", [
|
|
290173
|
+
z56.object({ action: z56.literal("pick") }).strict(),
|
|
290174
|
+
z56.object({
|
|
290175
|
+
action: z56.enum(["open", "create"]),
|
|
290176
|
+
path: z56.string().trim().min(1).max(4096)
|
|
289552
290177
|
}).strict(),
|
|
289553
|
-
|
|
289554
|
-
action:
|
|
289555
|
-
projectId:
|
|
290178
|
+
z56.object({
|
|
290179
|
+
action: z56.literal("remove"),
|
|
290180
|
+
projectId: z56.string().trim().min(1).max(64).regex(/^[a-zA-Z0-9_-]+$/)
|
|
289556
290181
|
}).strict()
|
|
289557
290182
|
]);
|
|
289558
|
-
var ReviewActionSchema =
|
|
289559
|
-
|
|
289560
|
-
action:
|
|
289561
|
-
path:
|
|
290183
|
+
var ReviewActionSchema = z56.discriminatedUnion("action", [
|
|
290184
|
+
z56.object({
|
|
290185
|
+
action: z56.literal("rollback-file"),
|
|
290186
|
+
path: z56.string().trim().min(1).max(4096)
|
|
289562
290187
|
}).strict(),
|
|
289563
|
-
|
|
289564
|
-
action:
|
|
289565
|
-
checkpointId:
|
|
290188
|
+
z56.object({
|
|
290189
|
+
action: z56.literal("rewind"),
|
|
290190
|
+
checkpointId: z56.string().trim().min(1).max(200).regex(/^[a-zA-Z0-9_-]+$/)
|
|
289566
290191
|
}).strict()
|
|
289567
290192
|
]);
|
|
289568
|
-
var WebAgentIdSchema =
|
|
289569
|
-
var WebAgentRunIdSchema =
|
|
289570
|
-
var AgentActionSchema =
|
|
289571
|
-
|
|
289572
|
-
|
|
289573
|
-
action:
|
|
290193
|
+
var WebAgentIdSchema = z56.string().regex(/^agent_[a-z0-9-]+$/).max(128);
|
|
290194
|
+
var WebAgentRunIdSchema = z56.string().regex(/^run_[a-z0-9-]+$/).max(128);
|
|
290195
|
+
var AgentActionSchema = z56.discriminatedUnion("action", [
|
|
290196
|
+
z56.object({ action: z56.literal("abort"), agentId: WebAgentIdSchema }).strict(),
|
|
290197
|
+
z56.object({
|
|
290198
|
+
action: z56.literal("steer"),
|
|
289574
290199
|
agentId: WebAgentIdSchema,
|
|
289575
|
-
prompt:
|
|
290200
|
+
prompt: z56.string().trim().min(1).max(8e3)
|
|
289576
290201
|
}).strict(),
|
|
289577
|
-
|
|
289578
|
-
action:
|
|
290202
|
+
z56.object({
|
|
290203
|
+
action: z56.literal("resume"),
|
|
289579
290204
|
runId: WebAgentRunIdSchema,
|
|
289580
290205
|
agentId: WebAgentIdSchema
|
|
289581
290206
|
}).strict()
|
|
289582
290207
|
]);
|
|
289583
|
-
var TaskActionSchema =
|
|
289584
|
-
action:
|
|
290208
|
+
var TaskActionSchema = z56.object({
|
|
290209
|
+
action: z56.enum(["plan", "parallel-improve"]),
|
|
289585
290210
|
turnId: WebTurnIdSchema.optional()
|
|
289586
290211
|
}).strict();
|
|
289587
|
-
var CompletionQuerySchema =
|
|
290212
|
+
var CompletionQuerySchema = z56.string().trim().max(200);
|
|
289588
290213
|
var IMAGE_ATTACHMENT_LIMIT_BYTES = 5 * 1024 * 1024;
|
|
289589
290214
|
var IMAGE_ATTACHMENT_STORE_LIMIT = 16;
|
|
289590
290215
|
var COMPLETION_CACHE_TTL_MS = 2e3;
|
|
@@ -291344,9 +291969,9 @@ import { execFileSync as execFileSync7 } from "child_process";
|
|
|
291344
291969
|
import { existsSync as existsSync19, lstatSync as lstatSync7, mkdirSync as mkdirSync6, rmSync as rmSync5, writeFileSync as writeFileSync8 } from "fs";
|
|
291345
291970
|
import { dirname as dirname11 } from "path";
|
|
291346
291971
|
import picocolors13 from "picocolors";
|
|
291347
|
-
import { z as
|
|
291348
|
-
var GitStatusCodeSchema =
|
|
291349
|
-
var GitStatusPathSchema =
|
|
291972
|
+
import { z as z57 } from "zod";
|
|
291973
|
+
var GitStatusCodeSchema = z57.string().length(2).regex(/^[ MADRCU?!]{2}$/);
|
|
291974
|
+
var GitStatusPathSchema = z57.string().min(1).max(32768);
|
|
291350
291975
|
var ROLLBACK_SNAPSHOT_FILE_MAX_BYTES = 16 * 1024 * 1024;
|
|
291351
291976
|
var ROLLBACK_SNAPSHOT_TOTAL_MAX_BYTES = 128 * 1024 * 1024;
|
|
291352
291977
|
var ROLLBACK_SNAPSHOT_MAX_PATHS = 1e4;
|
|
@@ -292117,32 +292742,32 @@ function ensureSessionTitle(loop, prompt) {
|
|
|
292117
292742
|
}
|
|
292118
292743
|
|
|
292119
292744
|
// src/runtime/ModelDiscovery.ts
|
|
292120
|
-
import { z as
|
|
292121
|
-
var ModelEntrySchema =
|
|
292122
|
-
id:
|
|
292123
|
-
model:
|
|
292124
|
-
context_length:
|
|
292125
|
-
context_window:
|
|
292126
|
-
max_context_tokens:
|
|
292127
|
-
max_output_tokens:
|
|
292128
|
-
input_modalities:
|
|
292129
|
-
output_modalities:
|
|
292130
|
-
modalities:
|
|
292131
|
-
architecture:
|
|
292132
|
-
capabilities:
|
|
292133
|
-
supported_parameters:
|
|
292134
|
-
type:
|
|
292135
|
-
kind:
|
|
292136
|
-
task:
|
|
292137
|
-
endpoint:
|
|
292138
|
-
details:
|
|
292745
|
+
import { z as z58 } from "zod";
|
|
292746
|
+
var ModelEntrySchema = z58.object({
|
|
292747
|
+
id: z58.unknown().optional(),
|
|
292748
|
+
model: z58.unknown().optional(),
|
|
292749
|
+
context_length: z58.unknown().optional(),
|
|
292750
|
+
context_window: z58.unknown().optional(),
|
|
292751
|
+
max_context_tokens: z58.unknown().optional(),
|
|
292752
|
+
max_output_tokens: z58.unknown().optional(),
|
|
292753
|
+
input_modalities: z58.unknown().optional(),
|
|
292754
|
+
output_modalities: z58.unknown().optional(),
|
|
292755
|
+
modalities: z58.unknown().optional(),
|
|
292756
|
+
architecture: z58.unknown().optional(),
|
|
292757
|
+
capabilities: z58.unknown().optional(),
|
|
292758
|
+
supported_parameters: z58.unknown().optional(),
|
|
292759
|
+
type: z58.unknown().optional(),
|
|
292760
|
+
kind: z58.unknown().optional(),
|
|
292761
|
+
task: z58.unknown().optional(),
|
|
292762
|
+
endpoint: z58.unknown().optional(),
|
|
292763
|
+
details: z58.unknown().optional()
|
|
292139
292764
|
}).passthrough();
|
|
292140
|
-
var ModelListSchema =
|
|
292141
|
-
|
|
292142
|
-
|
|
292143
|
-
|
|
292765
|
+
var ModelListSchema = z58.union([
|
|
292766
|
+
z58.object({ data: z58.array(ModelEntrySchema).max(1e3) }),
|
|
292767
|
+
z58.object({ models: z58.array(ModelEntrySchema).max(1e3) }),
|
|
292768
|
+
z58.array(ModelEntrySchema).max(1e3)
|
|
292144
292769
|
]);
|
|
292145
|
-
var DiscoveryUrlSchema =
|
|
292770
|
+
var DiscoveryUrlSchema = z58.string().url().max(4096).transform((value) => new URL(value));
|
|
292146
292771
|
var MAX_MODEL_RESPONSE_BYTES = 2 * 1024 * 1024;
|
|
292147
292772
|
async function discoverProviderModels(options) {
|
|
292148
292773
|
const base = DiscoveryUrlSchema.parse(options.baseUrl.trim());
|
|
@@ -292307,9 +292932,9 @@ function normalizeModelEntries(entries) {
|
|
|
292307
292932
|
}
|
|
292308
292933
|
return { models, modelCapabilities };
|
|
292309
292934
|
}
|
|
292310
|
-
var OllamaShowSchema =
|
|
292311
|
-
capabilities:
|
|
292312
|
-
model_info:
|
|
292935
|
+
var OllamaShowSchema = z58.object({
|
|
292936
|
+
capabilities: z58.array(z58.string().max(128)).max(64).optional(),
|
|
292937
|
+
model_info: z58.record(z58.unknown()).optional()
|
|
292313
292938
|
}).passthrough();
|
|
292314
292939
|
async function enrichOllamaCapabilities(base, models, target, fetchImpl, signal) {
|
|
292315
292940
|
const endpoint = new URL(base);
|
|
@@ -292790,9 +293415,9 @@ function isPickerCancellation(error) {
|
|
|
292790
293415
|
|
|
292791
293416
|
// src/runtime/commands/SessionMetadataCommandHandler.ts
|
|
292792
293417
|
import picocolors15 from "picocolors";
|
|
292793
|
-
import { z as
|
|
292794
|
-
var GoalSchema =
|
|
292795
|
-
var SessionTitleSchema =
|
|
293418
|
+
import { z as z59 } from "zod";
|
|
293419
|
+
var GoalSchema = z59.string().trim().min(1).max(4e3);
|
|
293420
|
+
var SessionTitleSchema = z59.string().trim().min(1).max(160);
|
|
292796
293421
|
function handleSessionMetadataCommand(command, argument, dependencies) {
|
|
292797
293422
|
if (command === "/goal") {
|
|
292798
293423
|
handleGoal(argument, dependencies);
|
|
@@ -292857,9 +293482,9 @@ function handleRename(argument, { loop, isZh, printOutput }) {
|
|
|
292857
293482
|
|
|
292858
293483
|
// src/runtime/commands/WorkspaceStateCommandHandler.ts
|
|
292859
293484
|
import picocolors16 from "picocolors";
|
|
292860
|
-
import { z as
|
|
292861
|
-
var TextSchema =
|
|
292862
|
-
var ItemReferenceSchema =
|
|
293485
|
+
import { z as z60 } from "zod";
|
|
293486
|
+
var TextSchema = z60.string().trim().min(1).max(2e3);
|
|
293487
|
+
var ItemReferenceSchema = z60.string().trim().min(1).max(100);
|
|
292863
293488
|
function handleWorkspaceStateCommand(command, argument, dependencies) {
|
|
292864
293489
|
if (command === "/memory") {
|
|
292865
293490
|
handleMemory(argument, dependencies);
|
|
@@ -293141,11 +293766,11 @@ ${usage(false)}`
|
|
|
293141
293766
|
// src/commands/update.ts
|
|
293142
293767
|
import readline4 from "readline";
|
|
293143
293768
|
import picocolors17 from "picocolors";
|
|
293144
|
-
import { z as
|
|
293145
|
-
var UpdateCommandOptionsSchema =
|
|
293146
|
-
check:
|
|
293147
|
-
yes:
|
|
293148
|
-
json:
|
|
293769
|
+
import { z as z61 } from "zod";
|
|
293770
|
+
var UpdateCommandOptionsSchema = z61.object({
|
|
293771
|
+
check: z61.boolean().default(false),
|
|
293772
|
+
yes: z61.boolean().default(false),
|
|
293773
|
+
json: z61.boolean().default(false),
|
|
293149
293774
|
channel: UpdateChannelSchema.default("stable")
|
|
293150
293775
|
}).strict();
|
|
293151
293776
|
async function runUpdate(currentVersion, rawOptions, dependencies = {}) {
|
|
@@ -293278,18 +293903,18 @@ async function confirmUpdate(prompt) {
|
|
|
293278
293903
|
}
|
|
293279
293904
|
|
|
293280
293905
|
// src/runtime/review/ReviewCommand.ts
|
|
293281
|
-
import { z as
|
|
293282
|
-
var ReviewPresetSchema =
|
|
293906
|
+
import { z as z65 } from "zod";
|
|
293907
|
+
var ReviewPresetSchema = z65.enum([
|
|
293283
293908
|
"comprehensive",
|
|
293284
293909
|
"security",
|
|
293285
293910
|
"tests",
|
|
293286
293911
|
"performance",
|
|
293287
293912
|
"accessibility"
|
|
293288
293913
|
]);
|
|
293289
|
-
var ReviewScopeSchema =
|
|
293290
|
-
|
|
293291
|
-
|
|
293292
|
-
|
|
293914
|
+
var ReviewScopeSchema = z65.discriminatedUnion("kind", [
|
|
293915
|
+
z65.object({ kind: z65.literal("working-tree") }),
|
|
293916
|
+
z65.object({ kind: z65.literal("commit"), ref: z65.string().min(1).max(200) }),
|
|
293917
|
+
z65.object({ kind: z65.literal("branch"), ref: z65.string().min(1).max(200) })
|
|
293293
293918
|
]);
|
|
293294
293919
|
var SAFE_GIT_REF = /^[A-Za-z0-9][A-Za-z0-9._/@{}~^:+-]{0,199}$/;
|
|
293295
293920
|
function parseReviewCommand(rawArguments) {
|
|
@@ -293368,6 +293993,32 @@ ${request.customInstructions}` : "";
|
|
|
293368
293993
|
|
|
293369
293994
|
// src/runtime/CommandRouter.ts
|
|
293370
293995
|
import { randomUUID as randomUUID11 } from "crypto";
|
|
293996
|
+
|
|
293997
|
+
// src/runtime/CommitSafety.ts
|
|
293998
|
+
var SENSITIVE_DIFF_PATH = /(?:^|\/)(?:\.env(?:\.|$)|\.npmrc$|\.pypirc$|\.netrc$|\.ssh\/|\.gnupg\/|\.aws\/|\.azure\/|\.kube\/|\.git\/|\.orbit\/)|\.(?:key|pem|p12|pfx)$/i;
|
|
293999
|
+
var CONTROL_CHARACTERS = /[\u0000-\u001f\u007f-\u009f]/g;
|
|
294000
|
+
var MAX_COMMIT_SUBJECT_LENGTH = 120;
|
|
294001
|
+
function buildCommitDiffForModel(diff, maxChars = 2e4) {
|
|
294002
|
+
const blocks = diff.split(/(?=^diff --git )/m);
|
|
294003
|
+
const visible = blocks.map((block2) => {
|
|
294004
|
+
const path9 = block2.match(/^diff --git a\/(.+?) b\/(.+)$/m)?.[2];
|
|
294005
|
+
if (path9 && SENSITIVE_DIFF_PATH.test(path9)) {
|
|
294006
|
+
return `diff --git a/${path9} b/${path9}
|
|
294007
|
+
[Orbit omitted protected file contents]`;
|
|
294008
|
+
}
|
|
294009
|
+
return redactSecrets(block2);
|
|
294010
|
+
});
|
|
294011
|
+
return visible.join("").slice(0, Math.max(0, maxChars));
|
|
294012
|
+
}
|
|
294013
|
+
function normalizeCommitMessage(message2) {
|
|
294014
|
+
const subject = redactSecrets(message2).replace(CONTROL_CHARACTERS, " ").replace(/^\s*["'`]+|["'`]+\s*$/g, "").replace(/\s+/g, " ").trim().slice(0, MAX_COMMIT_SUBJECT_LENGTH).trim();
|
|
294015
|
+
if (!subject) return "chore: update project";
|
|
294016
|
+
return /^(?:feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\([a-z0-9._/-]+\))?!?:\s+\S/i.test(
|
|
294017
|
+
subject
|
|
294018
|
+
) ? subject : `chore: ${subject}`.slice(0, MAX_COMMIT_SUBJECT_LENGTH).trim();
|
|
294019
|
+
}
|
|
294020
|
+
|
|
294021
|
+
// src/runtime/CommandRouter.ts
|
|
293371
294022
|
var require2 = createRequire2(import.meta.url);
|
|
293372
294023
|
function stripAnsi4(value) {
|
|
293373
294024
|
return value.replace(/\u001b\[[0-9;]*m/g, "");
|
|
@@ -294143,12 +294794,14 @@ var CommandRouter = class {
|
|
|
294143
294794
|
try {
|
|
294144
294795
|
let diff = execSync3("git diff --cached", {
|
|
294145
294796
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
294146
|
-
cwd
|
|
294797
|
+
cwd,
|
|
294798
|
+
env: buildSanitizedChildEnvironment()
|
|
294147
294799
|
}).toString().trim();
|
|
294148
294800
|
if (!diff) {
|
|
294149
294801
|
const unstaged = execSync3("git status --porcelain", {
|
|
294150
294802
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
294151
|
-
cwd
|
|
294803
|
+
cwd,
|
|
294804
|
+
env: buildSanitizedChildEnvironment()
|
|
294152
294805
|
}).toString().trim();
|
|
294153
294806
|
if (!unstaged) {
|
|
294154
294807
|
this.printOutput(
|
|
@@ -294174,11 +294827,13 @@ var CommandRouter = class {
|
|
|
294174
294827
|
);
|
|
294175
294828
|
execSync3("git add -A", {
|
|
294176
294829
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
294177
|
-
cwd
|
|
294830
|
+
cwd,
|
|
294831
|
+
env: buildSanitizedChildEnvironment()
|
|
294178
294832
|
});
|
|
294179
294833
|
diff = execSync3("git diff --cached", {
|
|
294180
294834
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
294181
|
-
cwd
|
|
294835
|
+
cwd,
|
|
294836
|
+
env: buildSanitizedChildEnvironment()
|
|
294182
294837
|
}).toString().trim();
|
|
294183
294838
|
if (!diff) {
|
|
294184
294839
|
this.printOutput(
|
|
@@ -294203,9 +294858,9 @@ var CommandRouter = class {
|
|
|
294203
294858
|
content: [
|
|
294204
294859
|
{
|
|
294205
294860
|
type: "text",
|
|
294206
|
-
text: `Generate a concise, high-quality conventional git commit message (e.g. feat(cli): add autocomplete) for the following git diff. Output ONLY the commit message, no formatting, no markdown, no quotes, just the text:
|
|
294861
|
+
text: `Generate a concise, high-quality conventional git commit message (e.g. feat(cli): add autocomplete) for the following redacted git diff. Output ONLY the commit message, no formatting, no markdown, no quotes, just the text:
|
|
294207
294862
|
|
|
294208
|
-
${diff
|
|
294863
|
+
${buildCommitDiffForModel(diff)}`
|
|
294209
294864
|
}
|
|
294210
294865
|
]
|
|
294211
294866
|
}
|
|
@@ -294218,17 +294873,16 @@ ${diff.substring(0, 2e4)}`
|
|
|
294218
294873
|
generatedMessage += event.text;
|
|
294219
294874
|
}
|
|
294220
294875
|
}
|
|
294221
|
-
finalMsg = generatedMessage
|
|
294222
|
-
if (!finalMsg) {
|
|
294223
|
-
finalMsg = "chore: auto-commit";
|
|
294224
|
-
}
|
|
294876
|
+
finalMsg = normalizeCommitMessage(generatedMessage);
|
|
294225
294877
|
}
|
|
294878
|
+
finalMsg = normalizeCommitMessage(finalMsg);
|
|
294226
294879
|
this.printOutput(
|
|
294227
294880
|
`Committing changes with message: "${picocolors18.green(finalMsg)}"`
|
|
294228
294881
|
);
|
|
294229
294882
|
execFileSync9("git", ["commit", "-m", finalMsg], {
|
|
294230
294883
|
...HIDDEN_CHILD_PROCESS_OPTIONS,
|
|
294231
|
-
cwd
|
|
294884
|
+
cwd,
|
|
294885
|
+
env: buildSanitizedChildEnvironment()
|
|
294232
294886
|
});
|
|
294233
294887
|
this.printOutput(
|
|
294234
294888
|
picocolors18.green("\u2714 Git commit created successfully.")
|
|
@@ -295226,20 +295880,20 @@ ${picocolors18.green("\u2714")} Switched security mode to: ${picocolors18.green(
|
|
|
295226
295880
|
};
|
|
295227
295881
|
|
|
295228
295882
|
// src/runtime/LocalRuntimeState.ts
|
|
295229
|
-
import { z as
|
|
295883
|
+
import { z as z66 } from "zod";
|
|
295230
295884
|
var LOCAL_RUNTIME_STATE_MAX_BYTES = 1048576;
|
|
295231
|
-
var LocalSkillsStateSchema =
|
|
295232
|
-
enabled:
|
|
295233
|
-
activation:
|
|
295234
|
-
maxActive:
|
|
295235
|
-
disabled:
|
|
295885
|
+
var LocalSkillsStateSchema = z66.object({
|
|
295886
|
+
enabled: z66.boolean().optional(),
|
|
295887
|
+
activation: z66.enum(["auto", "explicit"]).optional(),
|
|
295888
|
+
maxActive: z66.number().int().min(0).max(8).optional(),
|
|
295889
|
+
disabled: z66.array(z66.string().min(1).max(128)).max(1e3).optional()
|
|
295236
295890
|
});
|
|
295237
|
-
var LocalRuntimeStateSchema =
|
|
295238
|
-
lastSessionId:
|
|
295239
|
-
lastProvider:
|
|
295240
|
-
lastModel:
|
|
295891
|
+
var LocalRuntimeStateSchema = z66.object({
|
|
295892
|
+
lastSessionId: z66.string().min(1).max(1e3).optional(),
|
|
295893
|
+
lastProvider: z66.string().min(1).max(256).optional(),
|
|
295894
|
+
lastModel: z66.string().max(512).optional(),
|
|
295241
295895
|
language: OrbitLanguageSchema.optional(),
|
|
295242
|
-
permissionMode:
|
|
295896
|
+
permissionMode: z66.enum(["strict", "normal", "auto", "plan"]).optional(),
|
|
295243
295897
|
skills: LocalSkillsStateSchema.optional()
|
|
295244
295898
|
});
|
|
295245
295899
|
function readLocalRuntimeState(cwd) {
|
|
@@ -295270,16 +295924,16 @@ function writeLocalRuntimeState(cwd, patch) {
|
|
|
295270
295924
|
}
|
|
295271
295925
|
|
|
295272
295926
|
// src/runtime/ReplController.ts
|
|
295273
|
-
var AutocompleteRequestSchema =
|
|
295274
|
-
prefix:
|
|
295275
|
-
suffix:
|
|
295276
|
-
windowId:
|
|
295927
|
+
var AutocompleteRequestSchema = z67.object({
|
|
295928
|
+
prefix: z67.string().max(2e4),
|
|
295929
|
+
suffix: z67.string().max(2e4),
|
|
295930
|
+
windowId: z67.string().max(1e3).optional()
|
|
295277
295931
|
});
|
|
295278
295932
|
var AUTOCOMPLETE_BODY_LIMIT_BYTES = 1e5;
|
|
295279
295933
|
var AUTOCOMPLETE_MAX_CONCURRENCY = 4;
|
|
295280
|
-
var AutocompleteEndpointSchema =
|
|
295281
|
-
port:
|
|
295282
|
-
token:
|
|
295934
|
+
var AutocompleteEndpointSchema = z67.object({
|
|
295935
|
+
port: z67.number().int().min(1).max(65535),
|
|
295936
|
+
token: z67.string().min(32).max(256)
|
|
295283
295937
|
});
|
|
295284
295938
|
function getRunOutcomeMessage2(outcome) {
|
|
295285
295939
|
if (!outcome || outcome.status === "completed") return void 0;
|
|
@@ -296301,36 +296955,36 @@ function isRecord8(value) {
|
|
|
296301
296955
|
}
|
|
296302
296956
|
|
|
296303
296957
|
// src/commands/LSPServer.ts
|
|
296304
|
-
import { z as
|
|
296958
|
+
import { z as z68 } from "zod";
|
|
296305
296959
|
var MAX_LSP_HEADER_BYTES = 8 * 1024;
|
|
296306
296960
|
var MAX_LSP_BODY_BYTES = 8 * 1024 * 1024;
|
|
296307
|
-
var JsonRpcIdSchema =
|
|
296308
|
-
var JSONRPCMessageSchema =
|
|
296309
|
-
jsonrpc:
|
|
296961
|
+
var JsonRpcIdSchema = z68.union([z68.string(), z68.number(), z68.null()]);
|
|
296962
|
+
var JSONRPCMessageSchema = z68.object({
|
|
296963
|
+
jsonrpc: z68.literal("2.0"),
|
|
296310
296964
|
id: JsonRpcIdSchema.optional(),
|
|
296311
|
-
method:
|
|
296312
|
-
params:
|
|
296965
|
+
method: z68.string().min(1).max(512),
|
|
296966
|
+
params: z68.unknown().optional()
|
|
296313
296967
|
}).strict();
|
|
296314
|
-
var TextDocumentIdentifierSchema =
|
|
296315
|
-
uri:
|
|
296968
|
+
var TextDocumentIdentifierSchema = z68.object({
|
|
296969
|
+
uri: z68.string().min(1).max(16384)
|
|
296316
296970
|
});
|
|
296317
|
-
var DidOpenParamsSchema =
|
|
296971
|
+
var DidOpenParamsSchema = z68.object({
|
|
296318
296972
|
textDocument: TextDocumentIdentifierSchema.extend({
|
|
296319
|
-
text:
|
|
296973
|
+
text: z68.string().max(MAX_LSP_BODY_BYTES)
|
|
296320
296974
|
}).passthrough()
|
|
296321
296975
|
});
|
|
296322
|
-
var DidChangeParamsSchema =
|
|
296976
|
+
var DidChangeParamsSchema = z68.object({
|
|
296323
296977
|
textDocument: TextDocumentIdentifierSchema,
|
|
296324
|
-
contentChanges:
|
|
296978
|
+
contentChanges: z68.array(z68.object({ text: z68.string().max(MAX_LSP_BODY_BYTES) }).passthrough()).min(1).max(100)
|
|
296325
296979
|
});
|
|
296326
|
-
var DidCloseParamsSchema =
|
|
296980
|
+
var DidCloseParamsSchema = z68.object({
|
|
296327
296981
|
textDocument: TextDocumentIdentifierSchema
|
|
296328
296982
|
});
|
|
296329
|
-
var CompletionParamsSchema =
|
|
296983
|
+
var CompletionParamsSchema = z68.object({
|
|
296330
296984
|
textDocument: TextDocumentIdentifierSchema,
|
|
296331
|
-
position:
|
|
296332
|
-
line:
|
|
296333
|
-
character:
|
|
296985
|
+
position: z68.object({
|
|
296986
|
+
line: z68.number().int().nonnegative(),
|
|
296987
|
+
character: z68.number().int().nonnegative()
|
|
296334
296988
|
})
|
|
296335
296989
|
});
|
|
296336
296990
|
var JSONRPCReader = class {
|
|
@@ -296576,7 +297230,7 @@ ${completion}
|
|
|
296576
297230
|
);
|
|
296577
297231
|
}
|
|
296578
297232
|
} catch (error) {
|
|
296579
|
-
if (error instanceof
|
|
297233
|
+
if (error instanceof z68.ZodError) {
|
|
296580
297234
|
sendError(message2.id, -32602, "Invalid method parameters.");
|
|
296581
297235
|
return;
|
|
296582
297236
|
}
|
|
@@ -297102,10 +297756,10 @@ import {
|
|
|
297102
297756
|
} from "fs";
|
|
297103
297757
|
import { dirname as dirname14, resolve as resolve15 } from "path";
|
|
297104
297758
|
import { randomUUID as randomUUID13 } from "crypto";
|
|
297105
|
-
import { z as
|
|
297106
|
-
var TraceOptionsSchema =
|
|
297107
|
-
full:
|
|
297108
|
-
out:
|
|
297759
|
+
import { z as z69 } from "zod";
|
|
297760
|
+
var TraceOptionsSchema = z69.object({
|
|
297761
|
+
full: z69.boolean().default(false),
|
|
297762
|
+
out: z69.string().trim().min(1).max(4096).optional()
|
|
297109
297763
|
});
|
|
297110
297764
|
function runTraceExport(cwd, sessionId, options = {}) {
|
|
297111
297765
|
const value = TraceOptionsSchema.parse(options);
|
|
@@ -297160,16 +297814,16 @@ import { randomUUID as randomUUID14 } from "crypto";
|
|
|
297160
297814
|
import { promisify as promisify5 } from "util";
|
|
297161
297815
|
import picocolors25 from "picocolors";
|
|
297162
297816
|
import { parse as parseYaml4 } from "yaml";
|
|
297163
|
-
import { z as
|
|
297817
|
+
import { z as z70 } from "zod";
|
|
297164
297818
|
var exec5 = promisify5(execCallback);
|
|
297165
297819
|
var MAX_SUITE_BYTES = 1024 * 1024;
|
|
297166
297820
|
var MAX_VERIFICATION_OUTPUT = 4e3;
|
|
297167
|
-
var EvalOptionsSchema =
|
|
297168
|
-
provider:
|
|
297169
|
-
model:
|
|
297170
|
-
task:
|
|
297171
|
-
allowCommands:
|
|
297172
|
-
json:
|
|
297821
|
+
var EvalOptionsSchema = z70.object({
|
|
297822
|
+
provider: z70.string().trim().min(1).optional(),
|
|
297823
|
+
model: z70.string().trim().min(1).optional(),
|
|
297824
|
+
task: z70.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/).optional(),
|
|
297825
|
+
allowCommands: z70.boolean().default(false),
|
|
297826
|
+
json: z70.boolean().default(false)
|
|
297173
297827
|
});
|
|
297174
297828
|
async function runEval(cwd, suiteFile, options = {}) {
|
|
297175
297829
|
const value = EvalOptionsSchema.parse(options);
|
|
@@ -297517,7 +298171,7 @@ function safeSummary(value) {
|
|
|
297517
298171
|
import readline6 from "readline";
|
|
297518
298172
|
import picocolors26 from "picocolors";
|
|
297519
298173
|
import { resolve as resolve17 } from "path";
|
|
297520
|
-
import { z as
|
|
298174
|
+
import { z as z74 } from "zod";
|
|
297521
298175
|
|
|
297522
298176
|
// src/runtime/CleanupManager.ts
|
|
297523
298177
|
import {
|
|
@@ -297529,10 +298183,10 @@ import {
|
|
|
297529
298183
|
} from "fs";
|
|
297530
298184
|
import { homedir as homedir11 } from "os";
|
|
297531
298185
|
import { basename as basename6, join as join20, parse as parse5, resolve as resolve16 } from "path";
|
|
297532
|
-
import { z as
|
|
297533
|
-
var CleanupScopeSchema =
|
|
298186
|
+
import { z as z71 } from "zod";
|
|
298187
|
+
var CleanupScopeSchema = z71.enum(["user", "project"]);
|
|
297534
298188
|
function buildCleanupPlan(options) {
|
|
297535
|
-
const scopes =
|
|
298189
|
+
const scopes = z71.array(CleanupScopeSchema).min(1).parse(options.scopes);
|
|
297536
298190
|
const homeDirectory = resolve16(options.homeDirectory ?? homedir11());
|
|
297537
298191
|
const projectDirectory = resolve16(options.projectDirectory ?? options.cwd);
|
|
297538
298192
|
const candidates = scopes.map((scope) => ({
|
|
@@ -297690,12 +298344,12 @@ function safeInventoryWarning(targetPath, error) {
|
|
|
297690
298344
|
}
|
|
297691
298345
|
|
|
297692
298346
|
// src/commands/clean.ts
|
|
297693
|
-
var CleanCommandOptionsSchema =
|
|
297694
|
-
user:
|
|
297695
|
-
project:
|
|
297696
|
-
all:
|
|
297697
|
-
yes:
|
|
297698
|
-
json:
|
|
298347
|
+
var CleanCommandOptionsSchema = z74.object({
|
|
298348
|
+
user: z74.boolean().default(false),
|
|
298349
|
+
project: z74.union([z74.boolean(), z74.string().min(1).max(4096)]).optional(),
|
|
298350
|
+
all: z74.boolean().default(false),
|
|
298351
|
+
yes: z74.boolean().default(false),
|
|
298352
|
+
json: z74.boolean().default(false)
|
|
297699
298353
|
}).strict();
|
|
297700
298354
|
async function runClean(cwd, rawOptions, dependencies = {}) {
|
|
297701
298355
|
const options = CleanCommandOptionsSchema.parse(rawOptions);
|
|
@@ -297810,7 +298464,7 @@ async function confirmDeletion(prompt) {
|
|
|
297810
298464
|
// src/commands/backup.ts
|
|
297811
298465
|
import { basename as basename7, resolve as resolve19 } from "path";
|
|
297812
298466
|
import picocolors27 from "picocolors";
|
|
297813
|
-
import { z as
|
|
298467
|
+
import { z as z76 } from "zod";
|
|
297814
298468
|
|
|
297815
298469
|
// src/runtime/ProjectBackup.ts
|
|
297816
298470
|
import {
|
|
@@ -297824,25 +298478,25 @@ import {
|
|
|
297824
298478
|
} from "fs";
|
|
297825
298479
|
import { createHash as createHash9, randomUUID as randomUUID15 } from "crypto";
|
|
297826
298480
|
import { dirname as dirname16, isAbsolute as isAbsolute8, join as join21, relative as relative9, resolve as resolve18, sep as sep2 } from "path";
|
|
297827
|
-
import { z as
|
|
298481
|
+
import { z as z75 } from "zod";
|
|
297828
298482
|
var MAX_BACKUP_BYTES = 64 * 1024 * 1024;
|
|
297829
298483
|
var MAX_SERIALIZED_BACKUP_BYTES = 96 * 1024 * 1024;
|
|
297830
298484
|
var MAX_BACKUP_FILES = 1e4;
|
|
297831
298485
|
var MAX_BACKUP_TREE_ENTRIES = 5e4;
|
|
297832
298486
|
var MAX_BACKUP_TREE_DEPTH = 64;
|
|
297833
298487
|
var SHA256_PATTERN = /^[a-f0-9]{64}$/;
|
|
297834
|
-
var BackupFileSchema =
|
|
297835
|
-
path:
|
|
297836
|
-
size:
|
|
297837
|
-
sha256:
|
|
297838
|
-
content:
|
|
298488
|
+
var BackupFileSchema = z75.object({
|
|
298489
|
+
path: z75.string().min(1).max(4096),
|
|
298490
|
+
size: z75.number().int().min(0).max(MAX_BACKUP_BYTES),
|
|
298491
|
+
sha256: z75.string().regex(SHA256_PATTERN),
|
|
298492
|
+
content: z75.string().max(Math.ceil(MAX_BACKUP_BYTES * 4 / 3) + 8)
|
|
297839
298493
|
});
|
|
297840
|
-
var ProjectBackupBundleSchema =
|
|
297841
|
-
schemaVersion:
|
|
297842
|
-
kind:
|
|
297843
|
-
createdAt:
|
|
297844
|
-
sourceName:
|
|
297845
|
-
files:
|
|
298494
|
+
var ProjectBackupBundleSchema = z75.object({
|
|
298495
|
+
schemaVersion: z75.literal(1),
|
|
298496
|
+
kind: z75.literal("orbit-project-backup"),
|
|
298497
|
+
createdAt: z75.string().datetime(),
|
|
298498
|
+
sourceName: z75.string().min(1).max(512),
|
|
298499
|
+
files: z75.array(BackupFileSchema).max(MAX_BACKUP_FILES)
|
|
297846
298500
|
}).superRefine((bundle, context) => {
|
|
297847
298501
|
let totalBytes = 0;
|
|
297848
298502
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -297850,7 +298504,7 @@ var ProjectBackupBundleSchema = z74.object({
|
|
|
297850
298504
|
totalBytes += file.size;
|
|
297851
298505
|
if (totalBytes > MAX_BACKUP_BYTES) {
|
|
297852
298506
|
context.addIssue({
|
|
297853
|
-
code:
|
|
298507
|
+
code: z75.ZodIssueCode.custom,
|
|
297854
298508
|
message: `Backup exceeds ${MAX_BACKUP_BYTES} bytes.`
|
|
297855
298509
|
});
|
|
297856
298510
|
break;
|
|
@@ -297858,14 +298512,14 @@ var ProjectBackupBundleSchema = z74.object({
|
|
|
297858
298512
|
const normalized = normalizeBundlePath(file.path);
|
|
297859
298513
|
if (!normalized || normalized !== file.path) {
|
|
297860
298514
|
context.addIssue({
|
|
297861
|
-
code:
|
|
298515
|
+
code: z75.ZodIssueCode.custom,
|
|
297862
298516
|
message: `Unsafe backup path: ${file.path}`
|
|
297863
298517
|
});
|
|
297864
298518
|
continue;
|
|
297865
298519
|
}
|
|
297866
298520
|
if (seen.has(normalized.toLowerCase())) {
|
|
297867
298521
|
context.addIssue({
|
|
297868
|
-
code:
|
|
298522
|
+
code: z75.ZodIssueCode.custom,
|
|
297869
298523
|
message: `Duplicate backup path: ${file.path}`
|
|
297870
298524
|
});
|
|
297871
298525
|
}
|
|
@@ -298098,9 +298752,9 @@ function formatBytes2(bytes) {
|
|
|
298098
298752
|
}
|
|
298099
298753
|
|
|
298100
298754
|
// src/commands/backup.ts
|
|
298101
|
-
var BackupOptionsSchema =
|
|
298102
|
-
output:
|
|
298103
|
-
json:
|
|
298755
|
+
var BackupOptionsSchema = z76.object({
|
|
298756
|
+
output: z76.string().min(1).max(4096).optional(),
|
|
298757
|
+
json: z76.boolean().default(false)
|
|
298104
298758
|
}).strict();
|
|
298105
298759
|
function runBackupCreate(cwd, rawOptions = {}) {
|
|
298106
298760
|
const options = BackupOptionsSchema.parse(rawOptions);
|
|
@@ -298200,21 +298854,21 @@ import {
|
|
|
298200
298854
|
import { randomUUID as randomUUID16 } from "crypto";
|
|
298201
298855
|
import { dirname as dirname17, isAbsolute as isAbsolute9, join as join26, relative as relative10, resolve as resolve20, sep as sep3 } from "path";
|
|
298202
298856
|
import { homedir as homedir12 } from "os";
|
|
298203
|
-
import { z as
|
|
298204
|
-
var InstalledExtensionSchema2 =
|
|
298857
|
+
import { z as z77 } from "zod";
|
|
298858
|
+
var InstalledExtensionSchema2 = z77.object({
|
|
298205
298859
|
id: InstalledExtensionIdSchema,
|
|
298206
|
-
displayName:
|
|
298207
|
-
version:
|
|
298208
|
-
digest:
|
|
298860
|
+
displayName: z77.string().min(1).max(256),
|
|
298861
|
+
version: z77.string().min(1).max(128),
|
|
298862
|
+
digest: z77.string().regex(/^[a-f0-9]{64}$/),
|
|
298209
298863
|
digestAlgorithm: ExtensionDigestAlgorithmSchema.default("sha256-v1"),
|
|
298210
|
-
installedAt:
|
|
298211
|
-
trusted:
|
|
298212
|
-
path:
|
|
298213
|
-
manifestFile:
|
|
298864
|
+
installedAt: z77.string().datetime(),
|
|
298865
|
+
trusted: z77.boolean(),
|
|
298866
|
+
path: z77.string().min(1).max(4096),
|
|
298867
|
+
manifestFile: z77.string().min(1).max(4096).default("extension.yaml")
|
|
298214
298868
|
});
|
|
298215
|
-
var ExtensionRegistrySchema2 =
|
|
298216
|
-
schemaVersion:
|
|
298217
|
-
extensions:
|
|
298869
|
+
var ExtensionRegistrySchema2 = z77.object({
|
|
298870
|
+
schemaVersion: z77.literal(1),
|
|
298871
|
+
extensions: z77.array(InstalledExtensionSchema2).max(500).default([])
|
|
298218
298872
|
});
|
|
298219
298873
|
var ExtensionManager = class {
|
|
298220
298874
|
orbitDir;
|
|
@@ -298826,7 +299480,7 @@ program.command("bench").description(
|
|
|
298826
299480
|
"run a repeated stable-prefix DeepSeek cache profile (minimum 3 samples)"
|
|
298827
299481
|
).option(
|
|
298828
299482
|
"--thinking <mode>",
|
|
298829
|
-
"thinking mode: disabled, high, or max (
|
|
299483
|
+
"thinking mode: disabled, low, high, or max (provider default: high; Orbit Auto may select low for simple Flash turns)"
|
|
298830
299484
|
).option(
|
|
298831
299485
|
"--min-cache-hit <ratio>",
|
|
298832
299486
|
"fail when repeated-sample average cache hit is below ratio, e.g. 0.75 or 75"
|