@orbit-build/cli 0.1.11 → 0.2.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/dist/index.js +589 -486
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -221285,7 +221285,7 @@ import {
|
|
|
221285
221285
|
} from "fs";
|
|
221286
221286
|
import { createHash as createHash7 } from "crypto";
|
|
221287
221287
|
import { dirname as dirname7, join as join13 } from "path";
|
|
221288
|
-
import { z as
|
|
221288
|
+
import { z as z30 } from "zod";
|
|
221289
221289
|
import { z as z210 } from "zod";
|
|
221290
221290
|
|
|
221291
221291
|
// ../tools/dist/index.js
|
|
@@ -225276,6 +225276,7 @@ toolRegistry.register(new UpdatePlanTool());
|
|
|
225276
225276
|
// ../sandbox/dist/index.js
|
|
225277
225277
|
import {
|
|
225278
225278
|
existsSync as existsSync10,
|
|
225279
|
+
lstatSync as lstatSync3,
|
|
225279
225280
|
readFileSync as readFileSync13,
|
|
225280
225281
|
writeFileSync as writeFileSync6,
|
|
225281
225282
|
mkdirSync as mkdirSync6,
|
|
@@ -225283,38 +225284,63 @@ import {
|
|
|
225283
225284
|
rmSync as rmSync2
|
|
225284
225285
|
} from "fs";
|
|
225285
225286
|
import { join as join10 } from "path";
|
|
225287
|
+
import { z as z20 } from "zod";
|
|
225286
225288
|
import { existsSync as existsSync24, writeFileSync as writeFileSync24, unlinkSync as unlinkSync3 } from "fs";
|
|
225287
225289
|
import { execFileSync as execFileSync3 } from "child_process";
|
|
225288
225290
|
import fs from "fs";
|
|
225289
225291
|
import path3 from "path";
|
|
225292
|
+
var SafePathSegmentSchema = z20.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/);
|
|
225293
|
+
var CheckpointIdSchema = z20.string().regex(/^cp_[a-f0-9]{32}$/);
|
|
225294
|
+
var PersistedCheckpointMetadataSchema = z20.object({
|
|
225295
|
+
id: CheckpointIdSchema,
|
|
225296
|
+
timestamp: z20.string().datetime(),
|
|
225297
|
+
toolCallId: z20.string().min(1).max(256),
|
|
225298
|
+
filePath: z20.string().min(1).max(4096),
|
|
225299
|
+
exists: z20.boolean()
|
|
225300
|
+
}).strict();
|
|
225290
225301
|
var CheckpointManager = class {
|
|
225291
225302
|
constructor(cwd, sessionId) {
|
|
225292
225303
|
this.cwd = cwd;
|
|
225293
225304
|
this.sessionId = sessionId;
|
|
225305
|
+
if (!SafePathSegmentSchema.safeParse(sessionId).success) {
|
|
225306
|
+
throw new Error(`Invalid checkpoint session id: ${sessionId}`);
|
|
225307
|
+
}
|
|
225308
|
+
this.checkpointRoot = resolveSafePath(
|
|
225309
|
+
cwd,
|
|
225310
|
+
join10(".orbit", "checkpoints", sessionId)
|
|
225311
|
+
);
|
|
225294
225312
|
this.loadPersistedCheckpoints();
|
|
225295
225313
|
}
|
|
225296
225314
|
cwd;
|
|
225297
225315
|
sessionId;
|
|
225298
225316
|
checkpoints = [];
|
|
225317
|
+
checkpointRoot;
|
|
225299
225318
|
getSessionCheckpointDir() {
|
|
225300
|
-
return
|
|
225319
|
+
return this.checkpointRoot;
|
|
225301
225320
|
}
|
|
225302
225321
|
loadPersistedCheckpoints() {
|
|
225303
225322
|
const sessionDir = this.getSessionCheckpointDir();
|
|
225304
225323
|
if (!existsSync10(sessionDir)) return;
|
|
225305
225324
|
const loaded = [];
|
|
225306
225325
|
for (const entry of readdirSync3(sessionDir, { withFileTypes: true })) {
|
|
225307
|
-
if (!entry.isDirectory())
|
|
225308
|
-
|
|
225309
|
-
|
|
225326
|
+
if (!entry.isDirectory() || !CheckpointIdSchema.safeParse(entry.name).success) {
|
|
225327
|
+
continue;
|
|
225328
|
+
}
|
|
225329
|
+
const checkpointDir = resolveSafePath(sessionDir, entry.name);
|
|
225330
|
+
const metaPath = resolveSafePath(checkpointDir, "meta.json");
|
|
225310
225331
|
if (!existsSync10(metaPath)) continue;
|
|
225311
225332
|
try {
|
|
225312
|
-
const
|
|
225313
|
-
|
|
225333
|
+
const parsed = PersistedCheckpointMetadataSchema.safeParse(
|
|
225334
|
+
JSON.parse(readFileSync13(metaPath, "utf8"))
|
|
225335
|
+
);
|
|
225336
|
+
if (!parsed.success || parsed.data.id !== entry.name) {
|
|
225314
225337
|
continue;
|
|
225315
225338
|
}
|
|
225316
|
-
const
|
|
225317
|
-
|
|
225339
|
+
const meta = parsed.data;
|
|
225340
|
+
resolveSafePath(this.cwd, meta.filePath);
|
|
225341
|
+
const backupPath = resolveSafePath(checkpointDir, "backup_content.txt");
|
|
225342
|
+
if (meta.exists && !existsSync10(backupPath)) continue;
|
|
225343
|
+
const originalContent = meta.exists ? readFileSync13(backupPath, "utf8") : null;
|
|
225318
225344
|
loaded.push({
|
|
225319
225345
|
id: meta.id,
|
|
225320
225346
|
sessionId: this.sessionId,
|
|
@@ -225334,23 +225360,26 @@ var CheckpointManager = class {
|
|
|
225334
225360
|
this.checkpoints = loaded;
|
|
225335
225361
|
}
|
|
225336
225362
|
async captureBeforeState(toolCallId, filePath) {
|
|
225363
|
+
const validToolCallId = z20.string().min(1).max(256).parse(toolCallId);
|
|
225364
|
+
const validFilePath = z20.string().min(1).max(4096).parse(filePath);
|
|
225365
|
+
const safePath = resolveSafePath(this.cwd, validFilePath);
|
|
225337
225366
|
let originalContent = null;
|
|
225338
|
-
|
|
225339
|
-
const
|
|
225340
|
-
if (
|
|
225341
|
-
|
|
225367
|
+
if (existsSync10(safePath)) {
|
|
225368
|
+
const stats = lstatSync3(safePath);
|
|
225369
|
+
if (!stats.isFile() && !stats.isSymbolicLink()) {
|
|
225370
|
+
throw new Error(`Checkpoint target must be a file: ${validFilePath}`);
|
|
225342
225371
|
}
|
|
225343
|
-
|
|
225372
|
+
originalContent = readFileSync13(safePath, "utf8");
|
|
225344
225373
|
}
|
|
225345
225374
|
const backup = {
|
|
225346
|
-
path:
|
|
225375
|
+
path: validFilePath,
|
|
225347
225376
|
originalContent
|
|
225348
225377
|
};
|
|
225349
225378
|
const checkpoint = {
|
|
225350
225379
|
id: generateId("cp"),
|
|
225351
225380
|
sessionId: this.sessionId,
|
|
225352
225381
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
225353
|
-
toolCallId,
|
|
225382
|
+
toolCallId: validToolCallId,
|
|
225354
225383
|
backups: [backup]
|
|
225355
225384
|
};
|
|
225356
225385
|
this.checkpoints.push(checkpoint);
|
|
@@ -225368,8 +225397,8 @@ var CheckpointManager = class {
|
|
|
225368
225397
|
JSON.stringify({
|
|
225369
225398
|
id: checkpoint.id,
|
|
225370
225399
|
timestamp: checkpoint.timestamp,
|
|
225371
|
-
toolCallId,
|
|
225372
|
-
filePath,
|
|
225400
|
+
toolCallId: validToolCallId,
|
|
225401
|
+
filePath: validFilePath,
|
|
225373
225402
|
exists: originalContent !== null
|
|
225374
225403
|
}),
|
|
225375
225404
|
"utf8"
|
|
@@ -225380,10 +225409,16 @@ var CheckpointManager = class {
|
|
|
225380
225409
|
return [...this.checkpoints];
|
|
225381
225410
|
}
|
|
225382
225411
|
removeCheckpoint(checkpointId) {
|
|
225412
|
+
if (!CheckpointIdSchema.safeParse(checkpointId).success) {
|
|
225413
|
+
throw new Error(`Invalid checkpoint id: ${checkpointId}`);
|
|
225414
|
+
}
|
|
225383
225415
|
this.checkpoints = this.checkpoints.filter(
|
|
225384
225416
|
(checkpoint) => checkpoint.id !== checkpointId
|
|
225385
225417
|
);
|
|
225386
|
-
const checkpointDir =
|
|
225418
|
+
const checkpointDir = resolveSafePath(
|
|
225419
|
+
this.getSessionCheckpointDir(),
|
|
225420
|
+
checkpointId
|
|
225421
|
+
);
|
|
225387
225422
|
if (existsSync10(checkpointDir)) {
|
|
225388
225423
|
rmSync2(checkpointDir, { recursive: true, force: true });
|
|
225389
225424
|
}
|
|
@@ -225394,18 +225429,28 @@ var RollbackManager = class {
|
|
|
225394
225429
|
this.cwd = cwd;
|
|
225395
225430
|
}
|
|
225396
225431
|
cwd;
|
|
225432
|
+
/** Restore a checkpoint without allowing one filesystem failure to crash the caller. */
|
|
225397
225433
|
rollback(checkpoint) {
|
|
225398
225434
|
const restored = [];
|
|
225399
225435
|
for (const backup of checkpoint.backups) {
|
|
225400
|
-
|
|
225401
|
-
|
|
225402
|
-
if (
|
|
225403
|
-
|
|
225436
|
+
try {
|
|
225437
|
+
const safePath = resolveSafePath(this.cwd, backup.path);
|
|
225438
|
+
if (backup.originalContent === null) {
|
|
225439
|
+
if (existsSync24(safePath)) {
|
|
225440
|
+
unlinkSync3(safePath);
|
|
225441
|
+
restored.push(backup.path);
|
|
225442
|
+
}
|
|
225443
|
+
} else {
|
|
225444
|
+
writeFileSync24(safePath, backup.originalContent, "utf8");
|
|
225404
225445
|
restored.push(backup.path);
|
|
225405
225446
|
}
|
|
225406
|
-
}
|
|
225407
|
-
|
|
225408
|
-
|
|
225447
|
+
} catch (error) {
|
|
225448
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
225449
|
+
return {
|
|
225450
|
+
success: false,
|
|
225451
|
+
error: `Could not restore ${backup.path}: ${detail}`,
|
|
225452
|
+
restored
|
|
225453
|
+
};
|
|
225409
225454
|
}
|
|
225410
225455
|
}
|
|
225411
225456
|
return {
|
|
@@ -225674,7 +225719,7 @@ var import_typescript = __toESM(require_typescript(), 1);
|
|
|
225674
225719
|
import { existsSync as existsSync11, promises as fsPromises2 } from "fs";
|
|
225675
225720
|
import { dirname as dirname5, resolve as resolve5 } from "path";
|
|
225676
225721
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
225677
|
-
import { z as
|
|
225722
|
+
import { z as z21 } from "zod";
|
|
225678
225723
|
import { basename as basename3, join as join11 } from "path";
|
|
225679
225724
|
import { existsSync as existsSync25, promises as fsPromises3 } from "fs";
|
|
225680
225725
|
import { dirname as dirname22, resolve as resolve23 } from "path";
|
|
@@ -225845,29 +225890,29 @@ function getOrbitCachePath(cwd, fileName) {
|
|
|
225845
225890
|
const relativePath = branchName ? join11(".orbit", "branches", branchName, fileName) : join11(".orbit", fileName);
|
|
225846
225891
|
return resolveSafePath(cwd, relativePath);
|
|
225847
225892
|
}
|
|
225848
|
-
var EmbeddingVectorSchema =
|
|
225849
|
-
var DocumentSchema =
|
|
225850
|
-
id:
|
|
225851
|
-
text:
|
|
225893
|
+
var EmbeddingVectorSchema = z21.array(z21.number().finite()).min(1).max(32768);
|
|
225894
|
+
var DocumentSchema = z21.object({
|
|
225895
|
+
id: z21.string().min(1).max(4096),
|
|
225896
|
+
text: z21.string().max(2e6),
|
|
225852
225897
|
vector: EmbeddingVectorSchema.optional(),
|
|
225853
|
-
metadata:
|
|
225854
|
-
filePath:
|
|
225855
|
-
symbolName:
|
|
225856
|
-
symbolType:
|
|
225857
|
-
startLine:
|
|
225858
|
-
endLine:
|
|
225898
|
+
metadata: z21.object({
|
|
225899
|
+
filePath: z21.string().min(1).max(4096),
|
|
225900
|
+
symbolName: z21.string().max(4096).optional(),
|
|
225901
|
+
symbolType: z21.string().max(256).optional(),
|
|
225902
|
+
startLine: z21.number().int().positive(),
|
|
225903
|
+
endLine: z21.number().int().positive()
|
|
225859
225904
|
})
|
|
225860
225905
|
});
|
|
225861
|
-
var DBHeaderSchema =
|
|
225862
|
-
modelName:
|
|
225863
|
-
dimension:
|
|
225864
|
-
updatedAt:
|
|
225906
|
+
var DBHeaderSchema = z21.object({
|
|
225907
|
+
modelName: z21.string().min(1).max(1024),
|
|
225908
|
+
dimension: z21.number().int().positive().max(32768),
|
|
225909
|
+
updatedAt: z21.string().min(1)
|
|
225865
225910
|
});
|
|
225866
|
-
var VectorStoreFileSchema =
|
|
225911
|
+
var VectorStoreFileSchema = z21.object({
|
|
225867
225912
|
header: DBHeaderSchema.nullable(),
|
|
225868
|
-
documents:
|
|
225913
|
+
documents: z21.array(DocumentSchema)
|
|
225869
225914
|
});
|
|
225870
|
-
var LegacyVectorStoreFileSchema =
|
|
225915
|
+
var LegacyVectorStoreFileSchema = z21.array(DocumentSchema);
|
|
225871
225916
|
var JSVectorStore = class {
|
|
225872
225917
|
constructor(cwd, modelName) {
|
|
225873
225918
|
this.cwd = cwd;
|
|
@@ -225886,7 +225931,7 @@ var JSVectorStore = class {
|
|
|
225886
225931
|
if (!this.loaded) {
|
|
225887
225932
|
await this.load();
|
|
225888
225933
|
}
|
|
225889
|
-
const validatedDocs =
|
|
225934
|
+
const validatedDocs = z21.array(DocumentSchema).parse(docs);
|
|
225890
225935
|
const vectorDimensions = new Set(
|
|
225891
225936
|
validatedDocs.flatMap(
|
|
225892
225937
|
(doc) => doc.vector === void 0 ? [] : [doc.vector.length]
|
|
@@ -227852,7 +227897,7 @@ function lD(e2) {
|
|
|
227852
227897
|
function v(e2, u) {
|
|
227853
227898
|
e2.isTTY && e2.setRawMode(u);
|
|
227854
227899
|
}
|
|
227855
|
-
var
|
|
227900
|
+
var z25 = /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"]]);
|
|
227856
227901
|
var xD = /* @__PURE__ */ new Set(["up", "down", "left", "right", "space", "enter"]);
|
|
227857
227902
|
var x = class {
|
|
227858
227903
|
constructor({ render: u, input: F = $2, output: t = k, ...s }, C2 = true) {
|
|
@@ -227887,7 +227932,7 @@ var x = class {
|
|
|
227887
227932
|
this.subscribers.clear();
|
|
227888
227933
|
}
|
|
227889
227934
|
onKeypress(u, F) {
|
|
227890
|
-
if (this.state === "error" && (this.state = "active"), F?.name && !this._track &&
|
|
227935
|
+
if (this.state === "error" && (this.state = "active"), F?.name && !this._track && z25.has(F.name) && this.emit("cursor", z25.get(F.name)), F?.name && xD.has(F.name) && this.emit("cursor", F.name), u && (u.toLowerCase() === "y" || u.toLowerCase() === "n") && this.emit("confirm", u.toLowerCase() === "y"), u === " " && this.opts.placeholder && (this.value || (this.rl.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u && this.emit("key", u.toLowerCase()), F?.name === "return") {
|
|
227891
227936
|
if (this.opts.validate) {
|
|
227892
227937
|
const t = this.opts.validate(this.value);
|
|
227893
227938
|
t && (this.error = t, this.state = "error", this.rl.write(this.value));
|
|
@@ -228098,7 +228143,7 @@ var M2 = o("\u25FB", "[ ]");
|
|
|
228098
228143
|
var U2 = o("\u25AA", "\u2022");
|
|
228099
228144
|
var B = o("\u2500", "-");
|
|
228100
228145
|
var Z2 = o("\u256E", "+");
|
|
228101
|
-
var
|
|
228146
|
+
var z26 = o("\u251C", "+");
|
|
228102
228147
|
var X2 = o("\u256F", "+");
|
|
228103
228148
|
var J2 = o("\u25CF", "\u2022");
|
|
228104
228149
|
var Y2 = o("\u25C6", "*");
|
|
@@ -228961,35 +229006,35 @@ import { promisify } from "util";
|
|
|
228961
229006
|
// ../mcp/dist/index.js
|
|
228962
229007
|
import { spawn } from "child_process";
|
|
228963
229008
|
import { createHash as createHash5 } from "crypto";
|
|
228964
|
-
import { z as
|
|
229009
|
+
import { z as z27 } from "zod";
|
|
228965
229010
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
228966
229011
|
var MCP_REQUEST_TIMEOUT_MS = 3e4;
|
|
228967
229012
|
var MCP_STDIO_LINE_LIMIT_BYTES = 8 * 1024 * 1024;
|
|
228968
229013
|
var MCP_STDERR_LIMIT_CHARS = 4e3;
|
|
228969
|
-
var MCPToolDefinitionSchema =
|
|
228970
|
-
name:
|
|
228971
|
-
description:
|
|
228972
|
-
inputSchema:
|
|
229014
|
+
var MCPToolDefinitionSchema = z27.object({
|
|
229015
|
+
name: z27.string().min(1).max(512),
|
|
229016
|
+
description: z27.string().max(1e4).default(""),
|
|
229017
|
+
inputSchema: z27.record(z27.unknown()).default({})
|
|
228973
229018
|
});
|
|
228974
|
-
var MCPToolsListSchema =
|
|
228975
|
-
tools:
|
|
229019
|
+
var MCPToolsListSchema = z27.object({
|
|
229020
|
+
tools: z27.array(MCPToolDefinitionSchema).max(1e4).default([])
|
|
228976
229021
|
});
|
|
228977
|
-
var MCPToolCallResultSchema =
|
|
228978
|
-
content:
|
|
228979
|
-
|
|
228980
|
-
type:
|
|
228981
|
-
text:
|
|
229022
|
+
var MCPToolCallResultSchema = z27.object({
|
|
229023
|
+
content: z27.array(
|
|
229024
|
+
z27.object({
|
|
229025
|
+
type: z27.string().max(100),
|
|
229026
|
+
text: z27.string().max(MCP_STDIO_LINE_LIMIT_BYTES).optional()
|
|
228982
229027
|
}).passthrough()
|
|
228983
229028
|
).max(1e4).default([]),
|
|
228984
|
-
isError:
|
|
229029
|
+
isError: z27.boolean().default(false)
|
|
228985
229030
|
}).passthrough();
|
|
228986
|
-
var MCPResponseSchema =
|
|
228987
|
-
jsonrpc:
|
|
228988
|
-
id:
|
|
228989
|
-
result:
|
|
228990
|
-
error:
|
|
228991
|
-
code:
|
|
228992
|
-
message:
|
|
229031
|
+
var MCPResponseSchema = z27.object({
|
|
229032
|
+
jsonrpc: z27.literal("2.0"),
|
|
229033
|
+
id: z27.number().int().positive(),
|
|
229034
|
+
result: z27.unknown().optional(),
|
|
229035
|
+
error: z27.object({
|
|
229036
|
+
code: z27.number().int(),
|
|
229037
|
+
message: z27.string().max(1e4)
|
|
228993
229038
|
}).passthrough().optional()
|
|
228994
229039
|
}).refine((message) => message.result !== void 0 || message.error, {
|
|
228995
229040
|
message: "MCP response requires a result or error."
|
|
@@ -229272,7 +229317,7 @@ var DynamicMCPTool = class {
|
|
|
229272
229317
|
client;
|
|
229273
229318
|
name;
|
|
229274
229319
|
description;
|
|
229275
|
-
inputSchema =
|
|
229320
|
+
inputSchema = z27.record(z27.unknown());
|
|
229276
229321
|
inputJsonSchema;
|
|
229277
229322
|
risk;
|
|
229278
229323
|
originalToolName;
|
|
@@ -229795,7 +229840,7 @@ function firstString(...values) {
|
|
|
229795
229840
|
}
|
|
229796
229841
|
|
|
229797
229842
|
// ../session/dist/index.js
|
|
229798
|
-
import { z as
|
|
229843
|
+
import { z as z28 } from "zod";
|
|
229799
229844
|
import { createHash as createHash6, randomUUID as randomUUID5 } from "crypto";
|
|
229800
229845
|
import { dirname as dirname6, isAbsolute as isAbsolute4, join as join12, relative as relative3, resolve as resolve6, sep } from "path";
|
|
229801
229846
|
import {
|
|
@@ -229805,7 +229850,7 @@ import {
|
|
|
229805
229850
|
copyFileSync as copyFileSync2,
|
|
229806
229851
|
existsSync as existsSync12,
|
|
229807
229852
|
fsyncSync,
|
|
229808
|
-
lstatSync as
|
|
229853
|
+
lstatSync as lstatSync4,
|
|
229809
229854
|
mkdirSync as mkdirSync8,
|
|
229810
229855
|
openSync,
|
|
229811
229856
|
readFileSync as readFileSync15,
|
|
@@ -229829,89 +229874,89 @@ import {
|
|
|
229829
229874
|
} from "fs";
|
|
229830
229875
|
import { homedir as homedir5 } from "os";
|
|
229831
229876
|
import { basename as basename4, isAbsolute as isAbsolute22, join as join25, parse as parse2, resolve as resolve24 } from "path";
|
|
229832
|
-
import { z as
|
|
229833
|
-
var SafeObjectKeySchema =
|
|
229877
|
+
import { z as z29 } from "zod";
|
|
229878
|
+
var SafeObjectKeySchema = z28.string().refine(
|
|
229834
229879
|
(key) => !["__proto__", "constructor", "prototype"].includes(key),
|
|
229835
229880
|
"Unsafe object key."
|
|
229836
229881
|
);
|
|
229837
|
-
var JsonValueSchema =
|
|
229838
|
-
() =>
|
|
229839
|
-
|
|
229840
|
-
|
|
229841
|
-
|
|
229842
|
-
|
|
229843
|
-
|
|
229844
|
-
|
|
229882
|
+
var JsonValueSchema = z28.lazy(
|
|
229883
|
+
() => z28.union([
|
|
229884
|
+
z28.string(),
|
|
229885
|
+
z28.number().finite(),
|
|
229886
|
+
z28.boolean(),
|
|
229887
|
+
z28.null(),
|
|
229888
|
+
z28.array(JsonValueSchema),
|
|
229889
|
+
z28.record(SafeObjectKeySchema, JsonValueSchema)
|
|
229845
229890
|
])
|
|
229846
229891
|
);
|
|
229847
|
-
var JsonTextSchema =
|
|
229892
|
+
var JsonTextSchema = z28.string().superRefine((value, context) => {
|
|
229848
229893
|
try {
|
|
229849
229894
|
const parsed = JSON.parse(value);
|
|
229850
229895
|
if (JsonValueSchema.safeParse(parsed).success) return;
|
|
229851
229896
|
} catch {
|
|
229852
229897
|
}
|
|
229853
229898
|
context.addIssue({
|
|
229854
|
-
code:
|
|
229899
|
+
code: z28.ZodIssueCode.custom,
|
|
229855
229900
|
message: "Expected valid, safe JSON text."
|
|
229856
229901
|
});
|
|
229857
229902
|
});
|
|
229858
|
-
var SessionIdSchema =
|
|
229859
|
-
var SessionSchema =
|
|
229860
|
-
schemaVersion:
|
|
229903
|
+
var SessionIdSchema = z28.string().regex(/^sess_[a-z]+-[a-z]+-\d{3}$/, "Invalid Orbit session id.");
|
|
229904
|
+
var SessionSchema = z28.object({
|
|
229905
|
+
schemaVersion: z28.literal(1).default(1),
|
|
229861
229906
|
id: SessionIdSchema,
|
|
229862
|
-
cwd:
|
|
229863
|
-
title:
|
|
229864
|
-
goal:
|
|
229865
|
-
status:
|
|
229866
|
-
createdAt:
|
|
229867
|
-
updatedAt:
|
|
229868
|
-
provider:
|
|
229869
|
-
model:
|
|
229870
|
-
totalInputTokens:
|
|
229871
|
-
totalOutputTokens:
|
|
229872
|
-
totalCostEstimate:
|
|
229873
|
-
totalCacheReadTokens:
|
|
229874
|
-
archivedAt:
|
|
229907
|
+
cwd: z28.string().min(1),
|
|
229908
|
+
title: z28.string(),
|
|
229909
|
+
goal: z28.string().trim().min(1).max(4e3).optional(),
|
|
229910
|
+
status: z28.enum(["active", "completed", "failed", "aborted"]),
|
|
229911
|
+
createdAt: z28.string().datetime(),
|
|
229912
|
+
updatedAt: z28.string().datetime(),
|
|
229913
|
+
provider: z28.string().min(1),
|
|
229914
|
+
model: z28.string().min(1),
|
|
229915
|
+
totalInputTokens: z28.number().int().nonnegative(),
|
|
229916
|
+
totalOutputTokens: z28.number().int().nonnegative(),
|
|
229917
|
+
totalCostEstimate: z28.number().finite().nonnegative(),
|
|
229918
|
+
totalCacheReadTokens: z28.number().int().nonnegative().optional(),
|
|
229919
|
+
archivedAt: z28.string().datetime().optional()
|
|
229875
229920
|
});
|
|
229876
|
-
var SessionEventSchema =
|
|
229877
|
-
id:
|
|
229921
|
+
var SessionEventSchema = z28.object({
|
|
229922
|
+
id: z28.string().min(1),
|
|
229878
229923
|
sessionId: SessionIdSchema,
|
|
229879
|
-
type:
|
|
229924
|
+
type: z28.string().min(1),
|
|
229880
229925
|
payload: JsonValueSchema,
|
|
229881
|
-
createdAt:
|
|
229926
|
+
createdAt: z28.string().datetime()
|
|
229882
229927
|
});
|
|
229883
|
-
var TaskPlanItemSchema =
|
|
229884
|
-
id:
|
|
229885
|
-
text:
|
|
229886
|
-
status:
|
|
229887
|
-
createdAt:
|
|
229888
|
-
updatedAt:
|
|
229928
|
+
var TaskPlanItemSchema = z28.object({
|
|
229929
|
+
id: z28.string().regex(/^step_[a-z0-9-]+$/, "Invalid task-plan item id."),
|
|
229930
|
+
text: z28.string().trim().min(1).max(1e3),
|
|
229931
|
+
status: z28.enum(["pending", "in_progress", "completed"]),
|
|
229932
|
+
createdAt: z28.string().datetime(),
|
|
229933
|
+
updatedAt: z28.string().datetime()
|
|
229889
229934
|
});
|
|
229890
|
-
var TaskPlanSchema =
|
|
229891
|
-
schemaVersion:
|
|
229935
|
+
var TaskPlanSchema = z28.object({
|
|
229936
|
+
schemaVersion: z28.literal(1).default(1),
|
|
229892
229937
|
sessionId: SessionIdSchema,
|
|
229893
|
-
goal:
|
|
229894
|
-
items:
|
|
229895
|
-
updatedAt:
|
|
229938
|
+
goal: z28.string().trim().min(1).max(4e3).optional(),
|
|
229939
|
+
items: z28.array(TaskPlanItemSchema).max(100),
|
|
229940
|
+
updatedAt: z28.string().datetime()
|
|
229896
229941
|
});
|
|
229897
|
-
var SessionMetricsSchema =
|
|
229942
|
+
var SessionMetricsSchema = z28.object({
|
|
229898
229943
|
sessionId: SessionIdSchema,
|
|
229899
|
-
eventCount:
|
|
229900
|
-
toolRuns:
|
|
229901
|
-
toolFailures:
|
|
229902
|
-
deniedTools:
|
|
229903
|
-
filesChanged:
|
|
229904
|
-
modelSwitches:
|
|
229905
|
-
routingDecisions:
|
|
229906
|
-
fastRoutes:
|
|
229907
|
-
qualityRoutes:
|
|
229908
|
-
compactions:
|
|
229909
|
-
resumedCount:
|
|
229944
|
+
eventCount: z28.number().int().nonnegative(),
|
|
229945
|
+
toolRuns: z28.number().int().nonnegative(),
|
|
229946
|
+
toolFailures: z28.number().int().nonnegative(),
|
|
229947
|
+
deniedTools: z28.number().int().nonnegative(),
|
|
229948
|
+
filesChanged: z28.number().int().nonnegative(),
|
|
229949
|
+
modelSwitches: z28.number().int().nonnegative(),
|
|
229950
|
+
routingDecisions: z28.number().int().nonnegative(),
|
|
229951
|
+
fastRoutes: z28.number().int().nonnegative(),
|
|
229952
|
+
qualityRoutes: z28.number().int().nonnegative(),
|
|
229953
|
+
compactions: z28.number().int().nonnegative(),
|
|
229954
|
+
resumedCount: z28.number().int().nonnegative()
|
|
229910
229955
|
});
|
|
229911
|
-
var RunJournalSchema =
|
|
229912
|
-
schemaVersion:
|
|
229956
|
+
var RunJournalSchema = z28.object({
|
|
229957
|
+
schemaVersion: z28.literal(1).default(1),
|
|
229913
229958
|
sessionId: SessionIdSchema,
|
|
229914
|
-
state:
|
|
229959
|
+
state: z28.enum([
|
|
229915
229960
|
"running",
|
|
229916
229961
|
"awaiting_approval",
|
|
229917
229962
|
"verifying",
|
|
@@ -229920,99 +229965,99 @@ var RunJournalSchema = z27.object({
|
|
|
229920
229965
|
"aborted",
|
|
229921
229966
|
"interrupted"
|
|
229922
229967
|
]),
|
|
229923
|
-
phase:
|
|
229924
|
-
attempt:
|
|
229925
|
-
activeToolCallId:
|
|
229926
|
-
startedAt:
|
|
229927
|
-
updatedAt:
|
|
229928
|
-
recoveryCount:
|
|
229968
|
+
phase: z28.string().trim().min(1).max(200),
|
|
229969
|
+
attempt: z28.number().int().nonnegative().default(0),
|
|
229970
|
+
activeToolCallId: z28.string().min(1).max(512).optional(),
|
|
229971
|
+
startedAt: z28.string().datetime(),
|
|
229972
|
+
updatedAt: z28.string().datetime(),
|
|
229973
|
+
recoveryCount: z28.number().int().nonnegative().default(0)
|
|
229929
229974
|
});
|
|
229930
|
-
var SessionRecoveryReportSchema =
|
|
229975
|
+
var SessionRecoveryReportSchema = z28.object({
|
|
229931
229976
|
sessionId: SessionIdSchema,
|
|
229932
229977
|
previousState: RunJournalSchema.shape.state,
|
|
229933
|
-
previousPhase:
|
|
229934
|
-
attempt:
|
|
229935
|
-
recoveryCount:
|
|
229936
|
-
repairedToolCalls:
|
|
229937
|
-
resetPlanItems:
|
|
229938
|
-
recoveredAt:
|
|
229978
|
+
previousPhase: z28.string().trim().min(1).max(200),
|
|
229979
|
+
attempt: z28.number().int().nonnegative(),
|
|
229980
|
+
recoveryCount: z28.number().int().positive(),
|
|
229981
|
+
repairedToolCalls: z28.number().int().nonnegative(),
|
|
229982
|
+
resetPlanItems: z28.number().int().nonnegative(),
|
|
229983
|
+
recoveredAt: z28.string().datetime()
|
|
229939
229984
|
});
|
|
229940
|
-
var StoredToolCallSchema =
|
|
229941
|
-
id:
|
|
229942
|
-
name:
|
|
229985
|
+
var StoredToolCallSchema = z28.object({
|
|
229986
|
+
id: z28.string().min(1),
|
|
229987
|
+
name: z28.string().min(1),
|
|
229943
229988
|
arguments: JsonTextSchema
|
|
229944
229989
|
});
|
|
229945
|
-
var StoredToolResultSchema =
|
|
229946
|
-
toolCallId:
|
|
229947
|
-
name:
|
|
229948
|
-
content:
|
|
229949
|
-
isError:
|
|
229990
|
+
var StoredToolResultSchema = z28.object({
|
|
229991
|
+
toolCallId: z28.string().min(1),
|
|
229992
|
+
name: z28.string().min(1),
|
|
229993
|
+
content: z28.string(),
|
|
229994
|
+
isError: z28.boolean().optional()
|
|
229950
229995
|
});
|
|
229951
|
-
var StoredContentBlockSchema =
|
|
229952
|
-
|
|
229953
|
-
|
|
229954
|
-
type:
|
|
229955
|
-
mediaType:
|
|
229956
|
-
data:
|
|
229957
|
-
name:
|
|
229996
|
+
var StoredContentBlockSchema = z28.discriminatedUnion("type", [
|
|
229997
|
+
z28.object({ type: z28.literal("text"), text: z28.string() }),
|
|
229998
|
+
z28.object({
|
|
229999
|
+
type: z28.literal("image"),
|
|
230000
|
+
mediaType: z28.enum(["image/png", "image/jpeg", "image/gif", "image/webp"]),
|
|
230001
|
+
data: z28.string().max(8e6),
|
|
230002
|
+
name: z28.string().max(255).optional()
|
|
229958
230003
|
}),
|
|
229959
|
-
|
|
229960
|
-
|
|
229961
|
-
type:
|
|
230004
|
+
z28.object({ type: z28.literal("tool_call"), toolCall: StoredToolCallSchema }),
|
|
230005
|
+
z28.object({
|
|
230006
|
+
type: z28.literal("tool_result"),
|
|
229962
230007
|
toolResult: StoredToolResultSchema
|
|
229963
230008
|
}),
|
|
229964
|
-
|
|
229965
|
-
type:
|
|
229966
|
-
text:
|
|
229967
|
-
signature:
|
|
230009
|
+
z28.object({
|
|
230010
|
+
type: z28.literal("thinking"),
|
|
230011
|
+
text: z28.string(),
|
|
230012
|
+
signature: z28.string().optional()
|
|
229968
230013
|
})
|
|
229969
230014
|
]);
|
|
229970
|
-
var StoredHistoryMessageSchema =
|
|
229971
|
-
id:
|
|
229972
|
-
role:
|
|
229973
|
-
content:
|
|
229974
|
-
createdAt:
|
|
229975
|
-
metadata:
|
|
230015
|
+
var StoredHistoryMessageSchema = z28.object({
|
|
230016
|
+
id: z28.string().min(1),
|
|
230017
|
+
role: z28.enum(["system", "user", "assistant", "tool"]),
|
|
230018
|
+
content: z28.array(StoredContentBlockSchema),
|
|
230019
|
+
createdAt: z28.string().datetime(),
|
|
230020
|
+
metadata: z28.record(SafeObjectKeySchema, JsonValueSchema).optional()
|
|
229976
230021
|
});
|
|
229977
|
-
var StoredHistorySchema =
|
|
229978
|
-
var ToolCallRecordSchema =
|
|
229979
|
-
id:
|
|
230022
|
+
var StoredHistorySchema = z28.array(StoredHistoryMessageSchema);
|
|
230023
|
+
var ToolCallRecordSchema = z28.object({
|
|
230024
|
+
id: z28.string().min(1),
|
|
229980
230025
|
sessionId: SessionIdSchema,
|
|
229981
|
-
toolName:
|
|
230026
|
+
toolName: z28.string().min(1),
|
|
229982
230027
|
inputJson: JsonTextSchema,
|
|
229983
230028
|
outputJson: JsonTextSchema.optional(),
|
|
229984
|
-
risk:
|
|
229985
|
-
permissionDecision:
|
|
229986
|
-
status:
|
|
229987
|
-
startedAt:
|
|
229988
|
-
endedAt:
|
|
230029
|
+
risk: z28.string().min(1),
|
|
230030
|
+
permissionDecision: z28.string().min(1),
|
|
230031
|
+
status: z28.enum(["pending", "success", "failed", "denied"]),
|
|
230032
|
+
startedAt: z28.string().datetime(),
|
|
230033
|
+
endedAt: z28.string().datetime().optional()
|
|
229989
230034
|
});
|
|
229990
|
-
var FileChangeRecordSchema =
|
|
229991
|
-
id:
|
|
230035
|
+
var FileChangeRecordSchema = z28.object({
|
|
230036
|
+
id: z28.string().min(1),
|
|
229992
230037
|
sessionId: SessionIdSchema,
|
|
229993
|
-
path:
|
|
229994
|
-
beforeHash:
|
|
229995
|
-
afterHash:
|
|
229996
|
-
diff:
|
|
229997
|
-
createdAt:
|
|
230038
|
+
path: z28.string().min(1),
|
|
230039
|
+
beforeHash: z28.string().optional(),
|
|
230040
|
+
afterHash: z28.string().optional(),
|
|
230041
|
+
diff: z28.string(),
|
|
230042
|
+
createdAt: z28.string().datetime()
|
|
229998
230043
|
});
|
|
229999
|
-
var SessionTraceBundleSchema =
|
|
230000
|
-
schemaVersion:
|
|
230001
|
-
exportedAt:
|
|
230002
|
-
workspace:
|
|
230003
|
-
id:
|
|
230004
|
-
path:
|
|
230044
|
+
var SessionTraceBundleSchema = z28.object({
|
|
230045
|
+
schemaVersion: z28.literal(1),
|
|
230046
|
+
exportedAt: z28.string().datetime(),
|
|
230047
|
+
workspace: z28.object({
|
|
230048
|
+
id: z28.string().regex(/^[a-f0-9]{16}$/),
|
|
230049
|
+
path: z28.literal("<workspace>")
|
|
230005
230050
|
}),
|
|
230006
230051
|
session: SessionSchema.omit({ cwd: true }).extend({
|
|
230007
|
-
cwd:
|
|
230052
|
+
cwd: z28.literal("<workspace>")
|
|
230008
230053
|
}),
|
|
230009
230054
|
journal: RunJournalSchema.optional(),
|
|
230010
230055
|
plan: TaskPlanSchema.optional(),
|
|
230011
230056
|
metrics: SessionMetricsSchema,
|
|
230012
|
-
events:
|
|
230013
|
-
toolCalls:
|
|
230014
|
-
fileChanges:
|
|
230015
|
-
history:
|
|
230057
|
+
events: z28.array(SessionEventSchema),
|
|
230058
|
+
toolCalls: z28.array(ToolCallRecordSchema),
|
|
230059
|
+
fileChanges: z28.array(FileChangeRecordSchema),
|
|
230060
|
+
history: z28.array(JsonValueSchema).optional()
|
|
230016
230061
|
});
|
|
230017
230062
|
var CREDENTIAL_ASSIGNMENT_PATTERN = /(\b(?:api[-_]?key|authorization|credentials?|password|passwd|secret|access[-_]?token|refresh[-_]?token|auth[-_]?token|bearer[-_]?token|session[-_]?token|client[-_]?secret|private[-_]?key|cookie)\b\s*[:=]\s*)(?:"[^"]*"|'[^']*'|[^\s,;}]*)/gi;
|
|
230018
230063
|
var SENSITIVE_KEY_PATTERN2 = /(?:^|_)(?:api_key|authorization|credentials?|password|passwd|secret|access_token|refresh_token|auth_token|bearer_token|session_token|client_secret|private_key|cookie)(?:$|_)/;
|
|
@@ -230654,7 +230699,7 @@ var SessionStore = class {
|
|
|
230654
230699
|
throw new Error("Orbit session root cannot be the workspace root.");
|
|
230655
230700
|
}
|
|
230656
230701
|
if (existsSync12(sessionRoot)) {
|
|
230657
|
-
const rootStats =
|
|
230702
|
+
const rootStats = lstatSync4(sessionRoot);
|
|
230658
230703
|
if (rootStats.isSymbolicLink() || !rootStats.isDirectory()) {
|
|
230659
230704
|
throw new Error("Orbit session root must be a real directory.");
|
|
230660
230705
|
}
|
|
@@ -230670,7 +230715,7 @@ var SessionStore = class {
|
|
|
230670
230715
|
throw new Error(`Invalid session directory: ${id}`);
|
|
230671
230716
|
}
|
|
230672
230717
|
if (existsSync12(resolved)) {
|
|
230673
|
-
const stats =
|
|
230718
|
+
const stats = lstatSync4(resolved);
|
|
230674
230719
|
if (stats.isSymbolicLink() || !stats.isDirectory()) {
|
|
230675
230720
|
throw new Error(`Invalid session directory: ${id}`);
|
|
230676
230721
|
}
|
|
@@ -230939,21 +230984,21 @@ var SessionManager = class {
|
|
|
230939
230984
|
var PRIVATE_DIRECTORY_MODE2 = 448;
|
|
230940
230985
|
var PRIVATE_FILE_MODE2 = 384;
|
|
230941
230986
|
var MAX_PROJECTS = 200;
|
|
230942
|
-
var ProjectRecordSchema =
|
|
230943
|
-
id:
|
|
230944
|
-
path:
|
|
230945
|
-
name:
|
|
230946
|
-
createdAt:
|
|
230947
|
-
lastOpenedAt:
|
|
230948
|
-
lastSessionId:
|
|
230949
|
-
archivedAt:
|
|
230987
|
+
var ProjectRecordSchema = z29.object({
|
|
230988
|
+
id: z29.string().regex(/^proj_[a-f0-9]{16}$/),
|
|
230989
|
+
path: z29.string().min(1).max(4096).refine((value) => !/[\u0000-\u001f\u007f]/.test(value)),
|
|
230990
|
+
name: z29.string().trim().min(1).max(200),
|
|
230991
|
+
createdAt: z29.string().datetime(),
|
|
230992
|
+
lastOpenedAt: z29.string().datetime(),
|
|
230993
|
+
lastSessionId: z29.string().min(1).optional(),
|
|
230994
|
+
archivedAt: z29.string().datetime().optional()
|
|
230950
230995
|
});
|
|
230951
|
-
var ProjectRegistrySnapshotSchema =
|
|
230952
|
-
schemaVersion:
|
|
230953
|
-
projects:
|
|
230996
|
+
var ProjectRegistrySnapshotSchema = z29.object({
|
|
230997
|
+
schemaVersion: z29.literal(1),
|
|
230998
|
+
projects: z29.array(ProjectRecordSchema).max(MAX_PROJECTS)
|
|
230954
230999
|
});
|
|
230955
|
-
var LegacyProjectRegistrySnapshotSchema =
|
|
230956
|
-
projects:
|
|
231000
|
+
var LegacyProjectRegistrySnapshotSchema = z29.object({
|
|
231001
|
+
projects: z29.array(ProjectRecordSchema).max(MAX_PROJECTS)
|
|
230957
231002
|
});
|
|
230958
231003
|
function parseProjectRegistrySnapshot(value) {
|
|
230959
231004
|
const current = ProjectRegistrySnapshotSchema.safeParse(value);
|
|
@@ -231117,7 +231162,7 @@ import {
|
|
|
231117
231162
|
chmodSync as chmodSync4,
|
|
231118
231163
|
copyFileSync as copyFileSync3,
|
|
231119
231164
|
existsSync as existsSync27,
|
|
231120
|
-
lstatSync as
|
|
231165
|
+
lstatSync as lstatSync5,
|
|
231121
231166
|
mkdirSync as mkdirSync23,
|
|
231122
231167
|
readFileSync as readFileSync26,
|
|
231123
231168
|
renameSync as renameSync23,
|
|
@@ -231306,20 +231351,20 @@ ${this.normalizeContextText(options.repoMapText)}` : "",
|
|
|
231306
231351
|
);
|
|
231307
231352
|
}
|
|
231308
231353
|
};
|
|
231309
|
-
var PromptCacheTelemetrySampleSchema =
|
|
231310
|
-
recordedAt:
|
|
231311
|
-
inputTokens:
|
|
231312
|
-
hitTokens:
|
|
231313
|
-
missTokens:
|
|
231314
|
-
hitRate:
|
|
231315
|
-
degraded:
|
|
231354
|
+
var PromptCacheTelemetrySampleSchema = z30.object({
|
|
231355
|
+
recordedAt: z30.string(),
|
|
231356
|
+
inputTokens: z30.number().int().nonnegative(),
|
|
231357
|
+
hitTokens: z30.number().int().nonnegative(),
|
|
231358
|
+
missTokens: z30.number().int().nonnegative(),
|
|
231359
|
+
hitRate: z30.number().min(0).max(1),
|
|
231360
|
+
degraded: z30.boolean()
|
|
231316
231361
|
});
|
|
231317
|
-
var PromptCacheSlabMetadataSchema =
|
|
231318
|
-
hash:
|
|
231319
|
-
model:
|
|
231320
|
-
tokenEstimate:
|
|
231321
|
-
lastPrimedAt:
|
|
231322
|
-
telemetry:
|
|
231362
|
+
var PromptCacheSlabMetadataSchema = z30.object({
|
|
231363
|
+
hash: z30.string().optional(),
|
|
231364
|
+
model: z30.string().optional(),
|
|
231365
|
+
tokenEstimate: z30.number().int().nonnegative().optional(),
|
|
231366
|
+
lastPrimedAt: z30.string().optional(),
|
|
231367
|
+
telemetry: z30.array(PromptCacheTelemetrySampleSchema).max(100).optional()
|
|
231323
231368
|
}).passthrough();
|
|
231324
231369
|
var PromptCacheSlabBuilder = class {
|
|
231325
231370
|
static build(input) {
|
|
@@ -232703,7 +232748,7 @@ var ProjectMemoryStore = class {
|
|
|
232703
232748
|
const validated = ProjectMemorySchema.parse(value);
|
|
232704
232749
|
const directory = dirname23(this.memoryPath);
|
|
232705
232750
|
if (existsSync27(directory)) {
|
|
232706
|
-
const stats =
|
|
232751
|
+
const stats = lstatSync5(directory);
|
|
232707
232752
|
if (stats.isSymbolicLink() || !stats.isDirectory()) {
|
|
232708
232753
|
throw new Error("Orbit memory directory must be a real directory.");
|
|
232709
232754
|
}
|
|
@@ -232732,7 +232777,7 @@ var ProjectMemoryStore = class {
|
|
|
232732
232777
|
}
|
|
232733
232778
|
assertSafeFile(filePath) {
|
|
232734
232779
|
if (!existsSync27(filePath)) return;
|
|
232735
|
-
const stats =
|
|
232780
|
+
const stats = lstatSync5(filePath);
|
|
232736
232781
|
if (stats.isSymbolicLink() || !stats.isFile()) {
|
|
232737
232782
|
throw new Error("Orbit project memory must be a real file.");
|
|
232738
232783
|
}
|
|
@@ -237692,8 +237737,8 @@ function findPreviousHistoryEntry(history, query, startIndex = history.length) {
|
|
|
237692
237737
|
import { dirname as dirname8, join as join14 } from "path";
|
|
237693
237738
|
import { homedir as homedir6 } from "os";
|
|
237694
237739
|
import { existsSync as existsSync14, mkdirSync as mkdirSync10, readFileSync as readFileSync17, writeFileSync as writeFileSync10 } from "fs";
|
|
237695
|
-
import { z as
|
|
237696
|
-
var inputHistorySchema =
|
|
237740
|
+
import { z as z31 } from "zod";
|
|
237741
|
+
var inputHistorySchema = z31.array(z31.string());
|
|
237697
237742
|
var InputHistoryStore = class {
|
|
237698
237743
|
constructor(filePath = join14(homedir6(), ".orbit", "input_history.json")) {
|
|
237699
237744
|
this.filePath = filePath;
|
|
@@ -238256,13 +238301,13 @@ function renderPromptScreen(state, viewport, theme = MORANDI) {
|
|
|
238256
238301
|
|
|
238257
238302
|
// src/runtime/UpdateManager.ts
|
|
238258
238303
|
import { execFile as execFile4, execFileSync as execFileSync4 } from "child_process";
|
|
238259
|
-
import { z as
|
|
238260
|
-
var SemanticVersionSchema =
|
|
238261
|
-
var UpdateChannelSchema =
|
|
238262
|
-
var UpdateCheckSchema =
|
|
238304
|
+
import { z as z35 } from "zod";
|
|
238305
|
+
var SemanticVersionSchema = z35.string().trim().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/);
|
|
238306
|
+
var UpdateChannelSchema = z35.enum(["stable", "beta"]);
|
|
238307
|
+
var UpdateCheckSchema = z35.object({
|
|
238263
238308
|
currentVersion: SemanticVersionSchema,
|
|
238264
238309
|
latestVersion: SemanticVersionSchema,
|
|
238265
|
-
updateAvailable:
|
|
238310
|
+
updateAvailable: z35.boolean()
|
|
238266
238311
|
});
|
|
238267
238312
|
var UpdateManager = class {
|
|
238268
238313
|
executable;
|
|
@@ -238346,9 +238391,9 @@ var UpdateManager = class {
|
|
|
238346
238391
|
],
|
|
238347
238392
|
{ timeoutMs: this.timeoutMs, inheritOutput: false }
|
|
238348
238393
|
);
|
|
238349
|
-
const parsed =
|
|
238350
|
-
dependencies:
|
|
238351
|
-
"@orbit-build/cli":
|
|
238394
|
+
const parsed = z35.object({
|
|
238395
|
+
dependencies: z35.object({
|
|
238396
|
+
"@orbit-build/cli": z35.object({ version: SemanticVersionSchema })
|
|
238352
238397
|
})
|
|
238353
238398
|
}).parse(JSON.parse(raw));
|
|
238354
238399
|
return parsed.dependencies["@orbit-build/cli"].version;
|
|
@@ -238575,6 +238620,7 @@ var FullscreenTui = class {
|
|
|
238575
238620
|
cachedStaticLinesCount = 0;
|
|
238576
238621
|
cachedStaticContent = "";
|
|
238577
238622
|
lastRenderedBottomHeight = 0;
|
|
238623
|
+
pinnedNotice = null;
|
|
238578
238624
|
// DeepSeek real-time thinking
|
|
238579
238625
|
currentThinking = "";
|
|
238580
238626
|
// Timers and metrics
|
|
@@ -238824,6 +238870,12 @@ var FullscreenTui = class {
|
|
|
238824
238870
|
});
|
|
238825
238871
|
this.render();
|
|
238826
238872
|
}
|
|
238873
|
+
/** Keep one important action visible immediately above the terminal status row. */
|
|
238874
|
+
setPinnedNotice(text, url) {
|
|
238875
|
+
const normalized = text?.trim();
|
|
238876
|
+
this.pinnedNotice = normalized ? { text: normalized, url } : null;
|
|
238877
|
+
if (this.isActive) this.render();
|
|
238878
|
+
}
|
|
238827
238879
|
/** Mirror a prompt submitted by another local UI into this conversation. */
|
|
238828
238880
|
addUserMessage(text) {
|
|
238829
238881
|
const trimmed = text.trim();
|
|
@@ -240212,6 +240264,15 @@ var FullscreenTui = class {
|
|
|
240212
240264
|
1,
|
|
240213
240265
|
columns - 6 - statusTextLength - keybindingsLength
|
|
240214
240266
|
);
|
|
240267
|
+
if (this.pinnedNotice) {
|
|
240268
|
+
const availableWidth2 = Math.max(12, columns - 7);
|
|
240269
|
+
const noticeText = truncatePlainToWidth(
|
|
240270
|
+
this.pinnedNotice.text,
|
|
240271
|
+
availableWidth2
|
|
240272
|
+
);
|
|
240273
|
+
const renderedNotice = this.pinnedNotice.url ? `\x1B]8;;${this.pinnedNotice.url}\x07${morandi2.accent(noticeText)}\x1B]8;;\x07` : morandi2.accent(noticeText);
|
|
240274
|
+
bottomLines.push(" " + morandi2.completed("\u25CF") + " " + renderedNotice);
|
|
240275
|
+
}
|
|
240215
240276
|
bottomLines.push(" " + statusText + " ".repeat(spacing) + keybindings);
|
|
240216
240277
|
const bottomHeight = bottomLines.length;
|
|
240217
240278
|
const displayedModel = environment.activeModelName || this.modelNameGetter();
|
|
@@ -240628,7 +240689,7 @@ import { dirname as dirname10, resolve as resolve10 } from "path";
|
|
|
240628
240689
|
import { homedir as homedir10 } from "os";
|
|
240629
240690
|
import http2 from "http";
|
|
240630
240691
|
import { randomBytes as randomBytes2, randomUUID as randomUUID9, timingSafeEqual as timingSafeEqual2 } from "crypto";
|
|
240631
|
-
import { z as
|
|
240692
|
+
import { z as z48 } from "zod";
|
|
240632
240693
|
|
|
240633
240694
|
// src/runtime/CommandRouter.ts
|
|
240634
240695
|
import picocolors18 from "picocolors";
|
|
@@ -240638,11 +240699,11 @@ import { existsSync as existsSync16, readFileSync as readFileSync19, readdirSync
|
|
|
240638
240699
|
import { basename as basename5, extname as extname2, join as join16 } from "path";
|
|
240639
240700
|
import { homedir as homedir8 } from "os";
|
|
240640
240701
|
import { parse as parse3 } from "yaml";
|
|
240641
|
-
import { z as
|
|
240642
|
-
var CommandMetadataSchema =
|
|
240643
|
-
description:
|
|
240644
|
-
argumentHint:
|
|
240645
|
-
"argument-hint":
|
|
240702
|
+
import { z as z36 } from "zod";
|
|
240703
|
+
var CommandMetadataSchema = z36.object({
|
|
240704
|
+
description: z36.string().max(240).optional(),
|
|
240705
|
+
argumentHint: z36.string().max(120).optional(),
|
|
240706
|
+
"argument-hint": z36.string().max(120).optional()
|
|
240646
240707
|
});
|
|
240647
240708
|
var VALID_COMMAND_NAME = /^[a-z0-9][a-z0-9-_]{0,47}$/i;
|
|
240648
240709
|
var MAX_COMMAND_FILE_BYTES = 256 * 1024;
|
|
@@ -240788,20 +240849,20 @@ import { spawn as spawn2 } from "child_process";
|
|
|
240788
240849
|
// src/runtime/webui/WebUiRuntime.ts
|
|
240789
240850
|
import http from "http";
|
|
240790
240851
|
import { randomBytes, randomUUID as randomUUID7 } from "crypto";
|
|
240791
|
-
import { z as
|
|
240852
|
+
import { z as z39 } from "zod";
|
|
240792
240853
|
|
|
240793
240854
|
// src/runtime/AutocompleteCandidates.ts
|
|
240794
240855
|
import glob6 from "fast-glob";
|
|
240795
240856
|
import { existsSync as existsSync17, readFileSync as readFileSync20, readdirSync as readdirSync7 } from "fs";
|
|
240796
240857
|
import { homedir as homedir9 } from "os";
|
|
240797
240858
|
import { dirname as dirname9, join as join17, resolve as resolve7 } from "path";
|
|
240798
|
-
import { z as
|
|
240799
|
-
var symbolIndexSchema =
|
|
240800
|
-
files:
|
|
240801
|
-
|
|
240802
|
-
symbols:
|
|
240803
|
-
|
|
240804
|
-
name:
|
|
240859
|
+
import { z as z37 } from "zod";
|
|
240860
|
+
var symbolIndexSchema = z37.object({
|
|
240861
|
+
files: z37.record(
|
|
240862
|
+
z37.object({
|
|
240863
|
+
symbols: z37.array(
|
|
240864
|
+
z37.object({
|
|
240865
|
+
name: z37.string().min(1)
|
|
240805
240866
|
})
|
|
240806
240867
|
).optional()
|
|
240807
240868
|
})
|
|
@@ -244996,7 +245057,7 @@ var WEB_UI_FAVICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4
|
|
|
244996
245057
|
|
|
244997
245058
|
// src/runtime/webui/WebUiSecurity.ts
|
|
244998
245059
|
import { timingSafeEqual } from "crypto";
|
|
244999
|
-
import { z as
|
|
245060
|
+
import { z as z38 } from "zod";
|
|
245000
245061
|
function sanitizeWebEventPayload(type, payload) {
|
|
245001
245062
|
if (!isRecord3(payload)) return void 0;
|
|
245002
245063
|
switch (type) {
|
|
@@ -245189,7 +245250,7 @@ function sanitizeBaseUrl(value) {
|
|
|
245189
245250
|
}
|
|
245190
245251
|
}
|
|
245191
245252
|
function webRequestErrorStatus(error) {
|
|
245192
|
-
if (error instanceof
|
|
245253
|
+
if (error instanceof z38.ZodError) return 400;
|
|
245193
245254
|
if (error instanceof Error && error.message === "Request body too large.") {
|
|
245194
245255
|
return 413;
|
|
245195
245256
|
}
|
|
@@ -246680,8 +246741,8 @@ var WEB_UI_COMPOSER_STYLES = String.raw`
|
|
|
246680
246741
|
}
|
|
246681
246742
|
|
|
246682
246743
|
.empty-composer-slot .composer {
|
|
246683
|
-
border-radius:
|
|
246684
|
-
box-shadow:
|
|
246744
|
+
border-radius: 18px;
|
|
246745
|
+
box-shadow: 0 18px 46px rgba(25, 43, 39, 0.09), 0 3px 10px rgba(25, 43, 39, 0.04);
|
|
246685
246746
|
}
|
|
246686
246747
|
|
|
246687
246748
|
.empty-composer-slot .composer-dock::before {
|
|
@@ -246727,18 +246788,18 @@ var WEB_UI_COMPOSER_STYLES = String.raw`
|
|
|
246727
246788
|
.composer {
|
|
246728
246789
|
position: relative;
|
|
246729
246790
|
padding: 13px 13px 10px;
|
|
246730
|
-
background: color-mix(in srgb, var(--surface-raised)
|
|
246731
|
-
border: 1px solid var(--border-strong);
|
|
246791
|
+
background: color-mix(in srgb, var(--surface-raised) 94%, transparent);
|
|
246792
|
+
border: 1px solid color-mix(in srgb, var(--border-strong) 92%, transparent);
|
|
246732
246793
|
border-radius: 18px;
|
|
246733
|
-
box-shadow:
|
|
246734
|
-
backdrop-filter:
|
|
246735
|
-
transition: border-color 160ms ease, background 160ms ease;
|
|
246794
|
+
box-shadow: 0 12px 34px rgba(25, 43, 39, 0.075), 0 2px 6px rgba(25, 43, 39, 0.035);
|
|
246795
|
+
backdrop-filter: blur(18px) saturate(118%);
|
|
246796
|
+
transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
|
|
246736
246797
|
}
|
|
246737
246798
|
|
|
246738
246799
|
.composer:focus-within {
|
|
246739
|
-
border-color: color-mix(in srgb, var(--accent)
|
|
246800
|
+
border-color: color-mix(in srgb, var(--accent) 58%, var(--border));
|
|
246740
246801
|
background: var(--surface-raised);
|
|
246741
|
-
box-shadow:
|
|
246802
|
+
box-shadow: 0 18px 48px rgba(25, 43, 39, 0.11), 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
|
|
246742
246803
|
}
|
|
246743
246804
|
|
|
246744
246805
|
.slash-command-menu {
|
|
@@ -247126,7 +247187,7 @@ var WEB_UI_COMPOSER_STYLES = String.raw`
|
|
|
247126
247187
|
|
|
247127
247188
|
.app-shell.is-disconnected .composer {
|
|
247128
247189
|
border-color: color-mix(in srgb, var(--danger) 22%, var(--border));
|
|
247129
|
-
box-shadow:
|
|
247190
|
+
box-shadow: 0 12px 34px rgba(25, 43, 39, 0.06);
|
|
247130
247191
|
}
|
|
247131
247192
|
|
|
247132
247193
|
.jump-bottom {
|
|
@@ -247728,8 +247789,12 @@ var WEB_UI_CONVERSATION_STYLES = String.raw`
|
|
|
247728
247789
|
position: absolute;
|
|
247729
247790
|
inset: 0;
|
|
247730
247791
|
background:
|
|
247731
|
-
radial-gradient(circle at 42% -16%, color-mix(in srgb, var(--accent)
|
|
247732
|
-
radial-gradient(circle at 92% 12%, color-mix(in srgb, var(--brand-coral)
|
|
247792
|
+
radial-gradient(circle at 42% -16%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 36%),
|
|
247793
|
+
radial-gradient(circle at 92% 12%, color-mix(in srgb, var(--brand-coral) 3%, transparent), transparent 26%),
|
|
247794
|
+
linear-gradient(color-mix(in srgb, var(--border) 18%, transparent) 1px, transparent 1px),
|
|
247795
|
+
linear-gradient(90deg, color-mix(in srgb, var(--border) 14%, transparent) 1px, transparent 1px);
|
|
247796
|
+
background-size: auto, auto, 48px 48px, 48px 48px;
|
|
247797
|
+
mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.42), transparent 48%);
|
|
247733
247798
|
pointer-events: none;
|
|
247734
247799
|
}
|
|
247735
247800
|
|
|
@@ -247761,7 +247826,7 @@ var WEB_UI_CONVERSATION_STYLES = String.raw`
|
|
|
247761
247826
|
min-height: 100%;
|
|
247762
247827
|
display: flex;
|
|
247763
247828
|
flex-direction: column;
|
|
247764
|
-
gap:
|
|
247829
|
+
gap: 30px;
|
|
247765
247830
|
margin: 0 auto;
|
|
247766
247831
|
padding: 34px 0 40px;
|
|
247767
247832
|
}
|
|
@@ -247807,6 +247872,10 @@ var WEB_UI_CONVERSATION_STYLES = String.raw`
|
|
|
247807
247872
|
min-width: 0;
|
|
247808
247873
|
}
|
|
247809
247874
|
|
|
247875
|
+
.message.assistant .message-content {
|
|
247876
|
+
max-width: min(100%, 800px);
|
|
247877
|
+
}
|
|
247878
|
+
|
|
247810
247879
|
.message-role {
|
|
247811
247880
|
display: flex;
|
|
247812
247881
|
align-items: center;
|
|
@@ -248435,7 +248504,7 @@ var WEB_UI_CONVERSATION_STYLES = String.raw`
|
|
|
248435
248504
|
align-items: stretch;
|
|
248436
248505
|
justify-content: flex-start;
|
|
248437
248506
|
margin: 0 auto;
|
|
248438
|
-
padding: clamp(
|
|
248507
|
+
padding: clamp(72px, 11vh, 124px) 0 clamp(44px, 8vh, 86px);
|
|
248439
248508
|
text-align: left;
|
|
248440
248509
|
}
|
|
248441
248510
|
|
|
@@ -248472,8 +248541,8 @@ var WEB_UI_CONVERSATION_STYLES = String.raw`
|
|
|
248472
248541
|
max-width: 720px;
|
|
248473
248542
|
margin: 0;
|
|
248474
248543
|
color: var(--ink-strong);
|
|
248475
|
-
font-size: clamp(
|
|
248476
|
-
font-weight:
|
|
248544
|
+
font-size: clamp(34px, 2.65vw, 48px);
|
|
248545
|
+
font-weight: 690;
|
|
248477
248546
|
letter-spacing: -0.035em;
|
|
248478
248547
|
line-height: 1.16;
|
|
248479
248548
|
}
|
|
@@ -248482,7 +248551,8 @@ var WEB_UI_CONVERSATION_STYLES = String.raw`
|
|
|
248482
248551
|
max-width: 600px;
|
|
248483
248552
|
margin: 10px 0 0;
|
|
248484
248553
|
color: var(--muted);
|
|
248485
|
-
font-size:
|
|
248554
|
+
font-size: 14.5px;
|
|
248555
|
+
line-height: 1.65;
|
|
248486
248556
|
}
|
|
248487
248557
|
|
|
248488
248558
|
.connection-help {
|
|
@@ -248569,17 +248639,17 @@ var WEB_UI_CONVERSATION_STYLES = String.raw`
|
|
|
248569
248639
|
|
|
248570
248640
|
.suggestion-card {
|
|
248571
248641
|
min-width: 0;
|
|
248572
|
-
min-height:
|
|
248642
|
+
min-height: 62px;
|
|
248573
248643
|
display: flex;
|
|
248574
248644
|
align-items: center;
|
|
248575
248645
|
gap: 11px;
|
|
248576
248646
|
padding: 10px 13px;
|
|
248577
248647
|
color: var(--ink);
|
|
248578
|
-
background: color-mix(in srgb, var(--surface-raised)
|
|
248648
|
+
background: color-mix(in srgb, var(--surface-raised) 72%, transparent);
|
|
248579
248649
|
border: 1px solid var(--border);
|
|
248580
248650
|
border-radius: 13px;
|
|
248581
248651
|
text-align: left;
|
|
248582
|
-
box-shadow:
|
|
248652
|
+
box-shadow: 0 1px 2px rgba(26, 43, 40, 0.035);
|
|
248583
248653
|
transition: background 150ms ease, border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
|
|
248584
248654
|
}
|
|
248585
248655
|
|
|
@@ -248968,8 +249038,8 @@ var WEB_UI_FEEDBACK_STYLES = String.raw`
|
|
|
248968
249038
|
var WEB_UI_FOUNDATION_STYLES = String.raw`
|
|
248969
249039
|
:root {
|
|
248970
249040
|
color-scheme: light;
|
|
248971
|
-
--canvas: #
|
|
248972
|
-
--canvas-deep: #
|
|
249041
|
+
--canvas: #f7f8f6;
|
|
249042
|
+
--canvas-deep: #e7ece9;
|
|
248973
249043
|
--sidebar: #edf1f0;
|
|
248974
249044
|
--sidebar-ink: #202a2a;
|
|
248975
249045
|
--sidebar-muted: #596765;
|
|
@@ -248977,21 +249047,21 @@ var WEB_UI_FOUNDATION_STYLES = String.raw`
|
|
|
248977
249047
|
--sidebar-border: rgba(42, 61, 59, 0.12);
|
|
248978
249048
|
--sidebar-surface: rgba(255, 255, 255, 0.68);
|
|
248979
249049
|
--sidebar-active: rgba(255, 255, 255, 0.84);
|
|
248980
|
-
--surface: #
|
|
249050
|
+
--surface: #fbfcfa;
|
|
248981
249051
|
--surface-raised: #ffffff;
|
|
248982
249052
|
--surface-subtle: #f0f3f1;
|
|
248983
249053
|
--surface-hover: #e8edeb;
|
|
248984
249054
|
--surface-glass: rgba(250, 252, 251, 0.88);
|
|
248985
|
-
--ink: #
|
|
248986
|
-
--ink-strong: #
|
|
248987
|
-
--muted: #
|
|
249055
|
+
--ink: #303b38;
|
|
249056
|
+
--ink-strong: #14201d;
|
|
249057
|
+
--muted: #5f6c68;
|
|
248988
249058
|
--faint: #87928f;
|
|
248989
249059
|
--border: rgba(39, 57, 54, 0.1);
|
|
248990
249060
|
--border-strong: rgba(39, 57, 54, 0.17);
|
|
248991
|
-
--accent: #
|
|
248992
|
-
--accent-strong: #
|
|
248993
|
-
--accent-soft: #
|
|
248994
|
-
--accent-glow: rgba(
|
|
249061
|
+
--accent: #638c85;
|
|
249062
|
+
--accent-strong: #356b63;
|
|
249063
|
+
--accent-soft: #e0eeea;
|
|
249064
|
+
--accent-glow: rgba(72, 121, 111, 0.15);
|
|
248995
249065
|
--brand-coral: #dd7069;
|
|
248996
249066
|
--brand-coral-soft: #f7e4e1;
|
|
248997
249067
|
--success: #4f815e;
|
|
@@ -249002,8 +249072,8 @@ var WEB_UI_FOUNDATION_STYLES = String.raw`
|
|
|
249002
249072
|
--danger-soft: #f7e4e2;
|
|
249003
249073
|
--code: #182027;
|
|
249004
249074
|
--code-ink: #e7edf0;
|
|
249005
|
-
--shadow-sm: 0 1px 2px rgba(26, 43, 40, 0.
|
|
249006
|
-
--shadow-md: 0
|
|
249075
|
+
--shadow-sm: 0 1px 2px rgba(26, 43, 40, 0.06), 0 3px 10px rgba(26, 43, 40, 0.035);
|
|
249076
|
+
--shadow-md: 0 20px 54px rgba(26, 43, 40, 0.1), 0 4px 12px rgba(26, 43, 40, 0.045);
|
|
249007
249077
|
--shadow-lg: 0 30px 86px rgba(21, 34, 32, 0.15), 0 5px 18px rgba(21, 34, 32, 0.06);
|
|
249008
249078
|
--sidebar-width: clamp(232px, 14vw, 258px);
|
|
249009
249079
|
--content-width: 880px;
|
|
@@ -250734,10 +250804,11 @@ var WEB_UI_SHELL_STYLES = String.raw`
|
|
|
250734
250804
|
height: 100dvh;
|
|
250735
250805
|
display: grid;
|
|
250736
250806
|
grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
|
|
250737
|
-
gap:
|
|
250738
|
-
padding:
|
|
250807
|
+
gap: 10px;
|
|
250808
|
+
padding: 10px 10px 10px 0;
|
|
250739
250809
|
background:
|
|
250740
|
-
radial-gradient(circle at
|
|
250810
|
+
radial-gradient(circle at 6% 2%, var(--accent-glow), transparent 26%),
|
|
250811
|
+
linear-gradient(135deg, color-mix(in srgb, var(--canvas-deep) 92%, white), var(--canvas-deep)),
|
|
250741
250812
|
var(--canvas-deep);
|
|
250742
250813
|
transition: grid-template-columns 210ms cubic-bezier(0.2, 0.75, 0.3, 1), gap 210ms ease, padding 210ms ease;
|
|
250743
250814
|
}
|
|
@@ -251610,25 +251681,25 @@ var WEB_UI_SHELL_STYLES = String.raw`
|
|
|
251610
251681
|
min-width: 0;
|
|
251611
251682
|
min-height: 0;
|
|
251612
251683
|
display: grid;
|
|
251613
|
-
grid-template-rows:
|
|
251684
|
+
grid-template-rows: 62px auto minmax(0, 1fr);
|
|
251614
251685
|
overflow: hidden;
|
|
251615
251686
|
background: var(--canvas);
|
|
251616
251687
|
border: 1px solid color-mix(in srgb, var(--border-strong) 82%, transparent);
|
|
251617
|
-
border-radius:
|
|
251618
|
-
box-shadow: 0
|
|
251688
|
+
border-radius: 20px;
|
|
251689
|
+
box-shadow: 0 22px 62px rgba(25, 43, 39, 0.09), 0 2px 8px rgba(25, 43, 39, 0.04);
|
|
251619
251690
|
}
|
|
251620
251691
|
|
|
251621
251692
|
.topbar {
|
|
251622
251693
|
grid-row: 1;
|
|
251623
251694
|
min-width: 0;
|
|
251624
|
-
height:
|
|
251695
|
+
height: 62px;
|
|
251625
251696
|
display: flex;
|
|
251626
251697
|
align-items: center;
|
|
251627
251698
|
justify-content: space-between;
|
|
251628
251699
|
gap: 16px;
|
|
251629
251700
|
padding: 0 clamp(16px, 2vw, 28px);
|
|
251630
|
-
border-bottom: 1px solid var(--border);
|
|
251631
|
-
background: color-mix(in srgb, var(--surface-glass)
|
|
251701
|
+
border-bottom: 1px solid color-mix(in srgb, var(--border-strong) 72%, transparent);
|
|
251702
|
+
background: color-mix(in srgb, var(--surface-glass) 96%, var(--canvas));
|
|
251632
251703
|
backdrop-filter: blur(22px) saturate(130%);
|
|
251633
251704
|
z-index: 15;
|
|
251634
251705
|
}
|
|
@@ -251727,8 +251798,8 @@ var WEB_UI_SHELL_STYLES = String.raw`
|
|
|
251727
251798
|
|
|
251728
251799
|
.workspace-heading strong {
|
|
251729
251800
|
color: var(--ink-strong);
|
|
251730
|
-
font-size:
|
|
251731
|
-
font-weight:
|
|
251801
|
+
font-size: 14.5px;
|
|
251802
|
+
font-weight: 700;
|
|
251732
251803
|
}
|
|
251733
251804
|
|
|
251734
251805
|
.workspace-heading span {
|
|
@@ -251782,8 +251853,8 @@ var WEB_UI_SHELL_STYLES = String.raw`
|
|
|
251782
251853
|
gap: 6px;
|
|
251783
251854
|
padding: 0 9px;
|
|
251784
251855
|
color: var(--faint);
|
|
251785
|
-
background: transparent;
|
|
251786
|
-
border:
|
|
251856
|
+
background: color-mix(in srgb, var(--surface-raised) 58%, transparent);
|
|
251857
|
+
border: 1px solid var(--border);
|
|
251787
251858
|
border-radius: 9px;
|
|
251788
251859
|
font-size: 11px;
|
|
251789
251860
|
white-space: nowrap;
|
|
@@ -251859,56 +251930,56 @@ var WEB_UI_STYLE_SECTIONS = [
|
|
|
251859
251930
|
var WEB_UI_STYLES = WEB_UI_STYLE_SECTIONS.join("");
|
|
251860
251931
|
|
|
251861
251932
|
// src/runtime/webui/WebUiRuntime.ts
|
|
251862
|
-
var WebTurnIdSchema =
|
|
251863
|
-
var ChatRequestSchema =
|
|
251864
|
-
prompt:
|
|
251933
|
+
var WebTurnIdSchema = z39.string().trim().min(8).max(100).regex(/^[a-zA-Z0-9_-]+$/);
|
|
251934
|
+
var ChatRequestSchema = z39.object({
|
|
251935
|
+
prompt: z39.string().trim().min(1).max(1e5),
|
|
251865
251936
|
turnId: WebTurnIdSchema.optional(),
|
|
251866
|
-
attachmentIds:
|
|
251937
|
+
attachmentIds: z39.array(WebTurnIdSchema).max(4).optional()
|
|
251867
251938
|
}).strict();
|
|
251868
|
-
var CancelRequestSchema =
|
|
251869
|
-
var ApprovalDecisionSchema =
|
|
251939
|
+
var CancelRequestSchema = z39.object({ turnId: WebTurnIdSchema.nullish() }).strict();
|
|
251940
|
+
var ApprovalDecisionSchema = z39.object({
|
|
251870
251941
|
id: WebTurnIdSchema,
|
|
251871
|
-
approved:
|
|
251942
|
+
approved: z39.boolean()
|
|
251872
251943
|
}).strict();
|
|
251873
|
-
var SettingsPatchSchema =
|
|
251874
|
-
provider:
|
|
251875
|
-
model:
|
|
251876
|
-
permissionMode:
|
|
251877
|
-
webSearchEnabled:
|
|
251878
|
-
webSearchProvider:
|
|
251879
|
-
webSearchMaxResults:
|
|
251944
|
+
var SettingsPatchSchema = z39.object({
|
|
251945
|
+
provider: z39.string().trim().min(1).max(256).optional(),
|
|
251946
|
+
model: z39.string().trim().min(1).max(200).optional(),
|
|
251947
|
+
permissionMode: z39.enum(["strict", "normal", "auto", "plan"]).optional(),
|
|
251948
|
+
webSearchEnabled: z39.boolean().optional(),
|
|
251949
|
+
webSearchProvider: z39.enum(["auto", "searxng", "tavily", "bing", "duckduckgo"]).optional(),
|
|
251950
|
+
webSearchMaxResults: z39.number().int().min(1).max(20).optional()
|
|
251880
251951
|
}).strict();
|
|
251881
|
-
var SessionActionSchema =
|
|
251882
|
-
|
|
251952
|
+
var SessionActionSchema = z39.discriminatedUnion("action", [
|
|
251953
|
+
z39.object({ action: z39.literal("new") }).strict(),
|
|
251883
251954
|
...["resume", "archive", "restore", "delete"].map(
|
|
251884
|
-
(action) =>
|
|
251885
|
-
action:
|
|
251886
|
-
sessionId:
|
|
251955
|
+
(action) => z39.object({
|
|
251956
|
+
action: z39.literal(action),
|
|
251957
|
+
sessionId: z39.string().trim().min(1).max(200).regex(/^[a-zA-Z0-9_-]+$/)
|
|
251887
251958
|
}).strict()
|
|
251888
251959
|
)
|
|
251889
251960
|
]);
|
|
251890
|
-
var ProjectActionSchema =
|
|
251891
|
-
|
|
251892
|
-
|
|
251893
|
-
action:
|
|
251894
|
-
path:
|
|
251961
|
+
var ProjectActionSchema = z39.discriminatedUnion("action", [
|
|
251962
|
+
z39.object({ action: z39.literal("pick") }).strict(),
|
|
251963
|
+
z39.object({
|
|
251964
|
+
action: z39.enum(["open", "create"]),
|
|
251965
|
+
path: z39.string().trim().min(1).max(4096)
|
|
251895
251966
|
}).strict(),
|
|
251896
|
-
|
|
251897
|
-
action:
|
|
251898
|
-
projectId:
|
|
251967
|
+
z39.object({
|
|
251968
|
+
action: z39.literal("remove"),
|
|
251969
|
+
projectId: z39.string().trim().min(1).max(64).regex(/^[a-zA-Z0-9_-]+$/)
|
|
251899
251970
|
}).strict()
|
|
251900
251971
|
]);
|
|
251901
|
-
var ReviewActionSchema =
|
|
251902
|
-
|
|
251903
|
-
action:
|
|
251904
|
-
path:
|
|
251972
|
+
var ReviewActionSchema = z39.discriminatedUnion("action", [
|
|
251973
|
+
z39.object({
|
|
251974
|
+
action: z39.literal("rollback-file"),
|
|
251975
|
+
path: z39.string().trim().min(1).max(4096)
|
|
251905
251976
|
}).strict(),
|
|
251906
|
-
|
|
251907
|
-
action:
|
|
251908
|
-
checkpointId:
|
|
251977
|
+
z39.object({
|
|
251978
|
+
action: z39.literal("rewind"),
|
|
251979
|
+
checkpointId: z39.string().trim().min(1).max(200).regex(/^[a-zA-Z0-9_-]+$/)
|
|
251909
251980
|
}).strict()
|
|
251910
251981
|
]);
|
|
251911
|
-
var CompletionQuerySchema =
|
|
251982
|
+
var CompletionQuerySchema = z39.string().trim().max(200);
|
|
251912
251983
|
var IMAGE_ATTACHMENT_LIMIT_BYTES = 5 * 1024 * 1024;
|
|
251913
251984
|
var IMAGE_ATTACHMENT_STORE_LIMIT = 16;
|
|
251914
251985
|
var ALLOWED_IMAGE_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -252579,14 +252650,24 @@ function parseWebUiArgs(rawArgs) {
|
|
|
252579
252650
|
}
|
|
252580
252651
|
async function openBrowser(url) {
|
|
252581
252652
|
const { command, args } = resolveBrowserLaunch(url);
|
|
252582
|
-
|
|
252583
|
-
|
|
252584
|
-
|
|
252585
|
-
|
|
252586
|
-
|
|
252587
|
-
|
|
252653
|
+
return new Promise((resolve18) => {
|
|
252654
|
+
const child = spawn2(command, args, {
|
|
252655
|
+
detached: true,
|
|
252656
|
+
stdio: "ignore",
|
|
252657
|
+
windowsHide: true
|
|
252658
|
+
});
|
|
252659
|
+
let settled = false;
|
|
252660
|
+
const finish = (opened) => {
|
|
252661
|
+
if (settled) return;
|
|
252662
|
+
settled = true;
|
|
252663
|
+
clearTimeout(timeout);
|
|
252664
|
+
resolve18(opened);
|
|
252665
|
+
};
|
|
252666
|
+
const timeout = setTimeout(() => finish(false), 2e3);
|
|
252667
|
+
child.once("spawn", () => finish(true));
|
|
252668
|
+
child.once("error", () => finish(false));
|
|
252669
|
+
child.unref();
|
|
252588
252670
|
});
|
|
252589
|
-
child.unref();
|
|
252590
252671
|
}
|
|
252591
252672
|
function resolveBrowserLaunch(url, platform = process.platform) {
|
|
252592
252673
|
if (platform === "win32") {
|
|
@@ -252602,7 +252683,8 @@ async function startOrbitWebUi(options) {
|
|
|
252602
252683
|
if (current?.canReuse(options.port)) {
|
|
252603
252684
|
current.updateOptions(options);
|
|
252604
252685
|
const handle2 = current.getHandle();
|
|
252605
|
-
|
|
252686
|
+
const browserOpened2 = options.open !== false ? await openBrowser(handle2.url) : false;
|
|
252687
|
+
handle2.browserOpened = browserOpened2;
|
|
252606
252688
|
return handle2;
|
|
252607
252689
|
}
|
|
252608
252690
|
if (current?.hasActiveTurn) {
|
|
@@ -252617,7 +252699,8 @@ async function startOrbitWebUi(options) {
|
|
|
252617
252699
|
const runtime = new OrbitWebUiRuntime(options);
|
|
252618
252700
|
const handle = await runtime.start();
|
|
252619
252701
|
activeRuntime = runtime;
|
|
252620
|
-
|
|
252702
|
+
const browserOpened = options.open !== false ? await openBrowser(handle.url) : false;
|
|
252703
|
+
handle.browserOpened = browserOpened;
|
|
252621
252704
|
return handle;
|
|
252622
252705
|
}
|
|
252623
252706
|
async function stopOrbitWebUi() {
|
|
@@ -253457,9 +253540,9 @@ async function handleContextCommand(command, argument, dependencies) {
|
|
|
253457
253540
|
import { execFileSync as execFileSync5 } from "child_process";
|
|
253458
253541
|
import { existsSync as existsSync19, rmSync as rmSync5 } from "fs";
|
|
253459
253542
|
import picocolors13 from "picocolors";
|
|
253460
|
-
import { z as
|
|
253461
|
-
var GitStatusCodeSchema =
|
|
253462
|
-
var GitStatusPathSchema =
|
|
253543
|
+
import { z as z40 } from "zod";
|
|
253544
|
+
var GitStatusCodeSchema = z40.string().length(2).regex(/^[ MADRCU?!]{2}$/);
|
|
253545
|
+
var GitStatusPathSchema = z40.string().min(1).max(32768);
|
|
253463
253546
|
var defaultGitAdapter = {
|
|
253464
253547
|
status: (cwd) => execFileSync5("git", ["status", "--porcelain=v1", "-z"], {
|
|
253465
253548
|
cwd,
|
|
@@ -253957,32 +254040,32 @@ function ensureSessionTitle(loop, prompt) {
|
|
|
253957
254040
|
}
|
|
253958
254041
|
|
|
253959
254042
|
// src/runtime/ModelDiscovery.ts
|
|
253960
|
-
import { z as
|
|
253961
|
-
var ModelEntrySchema =
|
|
253962
|
-
id:
|
|
253963
|
-
model:
|
|
253964
|
-
context_length:
|
|
253965
|
-
context_window:
|
|
253966
|
-
max_context_tokens:
|
|
253967
|
-
max_output_tokens:
|
|
253968
|
-
input_modalities:
|
|
253969
|
-
output_modalities:
|
|
253970
|
-
modalities:
|
|
253971
|
-
architecture:
|
|
253972
|
-
capabilities:
|
|
253973
|
-
supported_parameters:
|
|
253974
|
-
type:
|
|
253975
|
-
kind:
|
|
253976
|
-
task:
|
|
253977
|
-
endpoint:
|
|
253978
|
-
details:
|
|
254043
|
+
import { z as z41 } from "zod";
|
|
254044
|
+
var ModelEntrySchema = z41.object({
|
|
254045
|
+
id: z41.unknown().optional(),
|
|
254046
|
+
model: z41.unknown().optional(),
|
|
254047
|
+
context_length: z41.unknown().optional(),
|
|
254048
|
+
context_window: z41.unknown().optional(),
|
|
254049
|
+
max_context_tokens: z41.unknown().optional(),
|
|
254050
|
+
max_output_tokens: z41.unknown().optional(),
|
|
254051
|
+
input_modalities: z41.unknown().optional(),
|
|
254052
|
+
output_modalities: z41.unknown().optional(),
|
|
254053
|
+
modalities: z41.unknown().optional(),
|
|
254054
|
+
architecture: z41.unknown().optional(),
|
|
254055
|
+
capabilities: z41.unknown().optional(),
|
|
254056
|
+
supported_parameters: z41.unknown().optional(),
|
|
254057
|
+
type: z41.unknown().optional(),
|
|
254058
|
+
kind: z41.unknown().optional(),
|
|
254059
|
+
task: z41.unknown().optional(),
|
|
254060
|
+
endpoint: z41.unknown().optional(),
|
|
254061
|
+
details: z41.unknown().optional()
|
|
253979
254062
|
}).passthrough();
|
|
253980
|
-
var ModelListSchema =
|
|
253981
|
-
|
|
253982
|
-
|
|
253983
|
-
|
|
254063
|
+
var ModelListSchema = z41.union([
|
|
254064
|
+
z41.object({ data: z41.array(ModelEntrySchema).max(1e3) }),
|
|
254065
|
+
z41.object({ models: z41.array(ModelEntrySchema).max(1e3) }),
|
|
254066
|
+
z41.array(ModelEntrySchema).max(1e3)
|
|
253984
254067
|
]);
|
|
253985
|
-
var DiscoveryUrlSchema =
|
|
254068
|
+
var DiscoveryUrlSchema = z41.string().url().max(4096).transform((value) => new URL(value));
|
|
253986
254069
|
var MAX_MODEL_RESPONSE_BYTES = 2 * 1024 * 1024;
|
|
253987
254070
|
async function discoverProviderModels(options) {
|
|
253988
254071
|
const base = DiscoveryUrlSchema.parse(options.baseUrl.trim());
|
|
@@ -254149,9 +254232,9 @@ function normalizeModelEntries(entries) {
|
|
|
254149
254232
|
}
|
|
254150
254233
|
return { models, modelCapabilities };
|
|
254151
254234
|
}
|
|
254152
|
-
var OllamaShowSchema =
|
|
254153
|
-
capabilities:
|
|
254154
|
-
model_info:
|
|
254235
|
+
var OllamaShowSchema = z41.object({
|
|
254236
|
+
capabilities: z41.array(z41.string().max(128)).max(64).optional(),
|
|
254237
|
+
model_info: z41.record(z41.unknown()).optional()
|
|
254155
254238
|
}).passthrough();
|
|
254156
254239
|
async function enrichOllamaCapabilities(base, models, target, fetchImpl, signal) {
|
|
254157
254240
|
const endpoint = new URL(base);
|
|
@@ -254398,9 +254481,9 @@ function isPickerCancellation(error) {
|
|
|
254398
254481
|
|
|
254399
254482
|
// src/runtime/commands/SessionMetadataCommandHandler.ts
|
|
254400
254483
|
import picocolors15 from "picocolors";
|
|
254401
|
-
import { z as
|
|
254402
|
-
var GoalSchema =
|
|
254403
|
-
var SessionTitleSchema =
|
|
254484
|
+
import { z as z45 } from "zod";
|
|
254485
|
+
var GoalSchema = z45.string().trim().min(1).max(4e3);
|
|
254486
|
+
var SessionTitleSchema = z45.string().trim().min(1).max(160);
|
|
254404
254487
|
function handleSessionMetadataCommand(command, argument, dependencies) {
|
|
254405
254488
|
if (command === "/goal") {
|
|
254406
254489
|
handleGoal(argument, dependencies);
|
|
@@ -254465,9 +254548,9 @@ function handleRename(argument, { loop, isZh, printOutput }) {
|
|
|
254465
254548
|
|
|
254466
254549
|
// src/runtime/commands/WorkspaceStateCommandHandler.ts
|
|
254467
254550
|
import picocolors16 from "picocolors";
|
|
254468
|
-
import { z as
|
|
254469
|
-
var TextSchema =
|
|
254470
|
-
var ItemReferenceSchema =
|
|
254551
|
+
import { z as z46 } from "zod";
|
|
254552
|
+
var TextSchema = z46.string().trim().min(1).max(2e3);
|
|
254553
|
+
var ItemReferenceSchema = z46.string().trim().min(1).max(100);
|
|
254471
254554
|
function handleWorkspaceStateCommand(command, argument, dependencies) {
|
|
254472
254555
|
if (command === "/memory") {
|
|
254473
254556
|
handleMemory(argument, dependencies);
|
|
@@ -254643,11 +254726,11 @@ function resolveItemId(reference, items) {
|
|
|
254643
254726
|
// src/commands/update.ts
|
|
254644
254727
|
import readline4 from "readline";
|
|
254645
254728
|
import picocolors17 from "picocolors";
|
|
254646
|
-
import { z as
|
|
254647
|
-
var UpdateCommandOptionsSchema =
|
|
254648
|
-
check:
|
|
254649
|
-
yes:
|
|
254650
|
-
json:
|
|
254729
|
+
import { z as z47 } from "zod";
|
|
254730
|
+
var UpdateCommandOptionsSchema = z47.object({
|
|
254731
|
+
check: z47.boolean().default(false),
|
|
254732
|
+
yes: z47.boolean().default(false),
|
|
254733
|
+
json: z47.boolean().default(false),
|
|
254651
254734
|
channel: UpdateChannelSchema.default("stable")
|
|
254652
254735
|
}).strict();
|
|
254653
254736
|
async function runUpdate(currentVersion, rawOptions, dependencies = {}) {
|
|
@@ -254784,6 +254867,9 @@ var require2 = createRequire2(import.meta.url);
|
|
|
254784
254867
|
function stripAnsi4(value) {
|
|
254785
254868
|
return value.replace(/\u001b\[[0-9;]*m/g, "");
|
|
254786
254869
|
}
|
|
254870
|
+
function terminalHyperlink(label, url) {
|
|
254871
|
+
return `\x1B]8;;${url}\x07${label}\x1B]8;;\x07`;
|
|
254872
|
+
}
|
|
254787
254873
|
var CommandRouter = class {
|
|
254788
254874
|
constructor(cwd, config, providerInstance, setProviderInstance, loop, tui, useFullscreenTui, getCandidates, setCandidates, getLocalState2, saveLocalState, tuiInteraction, multi, updateOrbit = runUpdate) {
|
|
254789
254875
|
this.cwd = cwd;
|
|
@@ -254979,11 +255065,28 @@ var CommandRouter = class {
|
|
|
254979
255065
|
});
|
|
254980
255066
|
const displayUrl = new URL(handle.url);
|
|
254981
255067
|
displayUrl.hash = "";
|
|
254982
|
-
|
|
254983
|
-
|
|
254984
|
-
|
|
255068
|
+
const browserOpened = handle.browserOpened === true;
|
|
255069
|
+
const statusText = browserOpened ? isZh ? "\u2714 Orbit Web UI \u5DF2\u542F\u52A8\u5E76\u81EA\u52A8\u6253\u5F00\u6D4F\u89C8\u5668" : "\u2714 Orbit Web UI started and opened in your browser" : isZh ? "\u26A0\uFE0F Orbit Web UI \u5DF2\u542F\u52A8\uFF1B\u6D4F\u89C8\u5668\u672A\u80FD\u81EA\u52A8\u6253\u5F00" : "\u26A0\uFE0F Orbit Web UI started; the browser did not open automatically";
|
|
255070
|
+
const linkLabel = isZh ? `\u6253\u5F00 Web UI \xB7 ${displayUrl.href}` : `Open Web UI \xB7 ${displayUrl.href}`;
|
|
255071
|
+
if (this.tui?.isActive) {
|
|
255072
|
+
this.tui.addSystemMessage(
|
|
255073
|
+
browserOpened ? picocolors18.green(statusText) : picocolors18.yellow(statusText)
|
|
255074
|
+
);
|
|
255075
|
+
this.tui.setPinnedNotice(linkLabel, handle.url);
|
|
255076
|
+
} else {
|
|
255077
|
+
console.log(
|
|
255078
|
+
browserOpened ? picocolors18.green(statusText) : picocolors18.yellow(statusText)
|
|
255079
|
+
);
|
|
255080
|
+
console.log(
|
|
255081
|
+
` ${terminalHyperlink(picocolors18.cyan(linkLabel), handle.url)}`
|
|
255082
|
+
);
|
|
255083
|
+
}
|
|
255084
|
+
eventBus.emitEvent("info", {
|
|
255085
|
+
message: `${statusText}: ${displayUrl.href}`
|
|
255086
|
+
});
|
|
254985
255087
|
} catch (error) {
|
|
254986
255088
|
const message = error instanceof Error ? error.message : String(error);
|
|
255089
|
+
this.tui?.setPinnedNotice?.(null);
|
|
254987
255090
|
this.printOutput(
|
|
254988
255091
|
isZh ? picocolors18.red(`\u2716 \u65E0\u6CD5\u542F\u52A8 Orbit Web UI: ${message}`) : picocolors18.red(`\u2716 Failed to start Orbit Web UI: ${message}`)
|
|
254989
255092
|
);
|
|
@@ -255832,20 +255935,20 @@ ${picocolors18.green("\u2714")} Switched security mode to: ${picocolors18.green(
|
|
|
255832
255935
|
};
|
|
255833
255936
|
|
|
255834
255937
|
// src/runtime/ReplController.ts
|
|
255835
|
-
var AutocompleteRequestSchema =
|
|
255836
|
-
prefix:
|
|
255837
|
-
suffix:
|
|
255838
|
-
windowId:
|
|
255938
|
+
var AutocompleteRequestSchema = z48.object({
|
|
255939
|
+
prefix: z48.string().max(2e4),
|
|
255940
|
+
suffix: z48.string().max(2e4),
|
|
255941
|
+
windowId: z48.string().max(1e3).optional()
|
|
255839
255942
|
});
|
|
255840
255943
|
var AUTOCOMPLETE_BODY_LIMIT_BYTES = 1e5;
|
|
255841
255944
|
var AUTOCOMPLETE_MAX_CONCURRENCY = 4;
|
|
255842
|
-
var LocalStateSchema =
|
|
255843
|
-
lastSessionId:
|
|
255844
|
-
lastModel:
|
|
255945
|
+
var LocalStateSchema = z48.object({
|
|
255946
|
+
lastSessionId: z48.string().optional(),
|
|
255947
|
+
lastModel: z48.string().optional()
|
|
255845
255948
|
});
|
|
255846
|
-
var AutocompleteEndpointSchema =
|
|
255847
|
-
port:
|
|
255848
|
-
token:
|
|
255949
|
+
var AutocompleteEndpointSchema = z48.object({
|
|
255950
|
+
port: z48.number().int().min(1).max(65535),
|
|
255951
|
+
token: z48.string().min(32).max(256)
|
|
255849
255952
|
});
|
|
255850
255953
|
function getRunOutcomeMessage(outcome) {
|
|
255851
255954
|
if (!outcome || outcome.status === "completed") return void 0;
|
|
@@ -256727,36 +256830,36 @@ function isRecord6(value) {
|
|
|
256727
256830
|
}
|
|
256728
256831
|
|
|
256729
256832
|
// src/commands/LSPServer.ts
|
|
256730
|
-
import { z as
|
|
256833
|
+
import { z as z49 } from "zod";
|
|
256731
256834
|
var MAX_LSP_HEADER_BYTES = 8 * 1024;
|
|
256732
256835
|
var MAX_LSP_BODY_BYTES = 8 * 1024 * 1024;
|
|
256733
|
-
var JsonRpcIdSchema =
|
|
256734
|
-
var JSONRPCMessageSchema =
|
|
256735
|
-
jsonrpc:
|
|
256836
|
+
var JsonRpcIdSchema = z49.union([z49.string(), z49.number(), z49.null()]);
|
|
256837
|
+
var JSONRPCMessageSchema = z49.object({
|
|
256838
|
+
jsonrpc: z49.literal("2.0"),
|
|
256736
256839
|
id: JsonRpcIdSchema.optional(),
|
|
256737
|
-
method:
|
|
256738
|
-
params:
|
|
256840
|
+
method: z49.string().min(1).max(512),
|
|
256841
|
+
params: z49.unknown().optional()
|
|
256739
256842
|
}).strict();
|
|
256740
|
-
var TextDocumentIdentifierSchema =
|
|
256741
|
-
uri:
|
|
256843
|
+
var TextDocumentIdentifierSchema = z49.object({
|
|
256844
|
+
uri: z49.string().min(1).max(16384)
|
|
256742
256845
|
});
|
|
256743
|
-
var DidOpenParamsSchema =
|
|
256846
|
+
var DidOpenParamsSchema = z49.object({
|
|
256744
256847
|
textDocument: TextDocumentIdentifierSchema.extend({
|
|
256745
|
-
text:
|
|
256848
|
+
text: z49.string().max(MAX_LSP_BODY_BYTES)
|
|
256746
256849
|
}).passthrough()
|
|
256747
256850
|
});
|
|
256748
|
-
var DidChangeParamsSchema =
|
|
256851
|
+
var DidChangeParamsSchema = z49.object({
|
|
256749
256852
|
textDocument: TextDocumentIdentifierSchema,
|
|
256750
|
-
contentChanges:
|
|
256853
|
+
contentChanges: z49.array(z49.object({ text: z49.string().max(MAX_LSP_BODY_BYTES) }).passthrough()).min(1).max(100)
|
|
256751
256854
|
});
|
|
256752
|
-
var DidCloseParamsSchema =
|
|
256855
|
+
var DidCloseParamsSchema = z49.object({
|
|
256753
256856
|
textDocument: TextDocumentIdentifierSchema
|
|
256754
256857
|
});
|
|
256755
|
-
var CompletionParamsSchema =
|
|
256858
|
+
var CompletionParamsSchema = z49.object({
|
|
256756
256859
|
textDocument: TextDocumentIdentifierSchema,
|
|
256757
|
-
position:
|
|
256758
|
-
line:
|
|
256759
|
-
character:
|
|
256860
|
+
position: z49.object({
|
|
256861
|
+
line: z49.number().int().nonnegative(),
|
|
256862
|
+
character: z49.number().int().nonnegative()
|
|
256760
256863
|
})
|
|
256761
256864
|
});
|
|
256762
256865
|
var JSONRPCReader = class {
|
|
@@ -257002,7 +257105,7 @@ ${completion}
|
|
|
257002
257105
|
);
|
|
257003
257106
|
}
|
|
257004
257107
|
} catch (error) {
|
|
257005
|
-
if (error instanceof
|
|
257108
|
+
if (error instanceof z49.ZodError) {
|
|
257006
257109
|
sendError(message.id, -32602, "Invalid method parameters.");
|
|
257007
257110
|
return;
|
|
257008
257111
|
}
|
|
@@ -257368,17 +257471,17 @@ async function runLogin(options = {}) {
|
|
|
257368
257471
|
// src/commands/trace.ts
|
|
257369
257472
|
import {
|
|
257370
257473
|
existsSync as existsSync29,
|
|
257371
|
-
lstatSync as
|
|
257474
|
+
lstatSync as lstatSync6,
|
|
257372
257475
|
mkdirSync as mkdirSync14,
|
|
257373
257476
|
renameSync as renameSync9,
|
|
257374
257477
|
rmSync as rmSync7,
|
|
257375
257478
|
writeFileSync as writeFileSync13
|
|
257376
257479
|
} from "fs";
|
|
257377
257480
|
import { dirname as dirname11, resolve as resolve11 } from "path";
|
|
257378
|
-
import { z as
|
|
257379
|
-
var TraceOptionsSchema =
|
|
257380
|
-
full:
|
|
257381
|
-
out:
|
|
257481
|
+
import { z as z50 } from "zod";
|
|
257482
|
+
var TraceOptionsSchema = z50.object({
|
|
257483
|
+
full: z50.boolean().default(false),
|
|
257484
|
+
out: z50.string().trim().min(1).max(4096).optional()
|
|
257382
257485
|
});
|
|
257383
257486
|
function runTraceExport(cwd, sessionId, options = {}) {
|
|
257384
257487
|
const value = TraceOptionsSchema.parse(options);
|
|
@@ -257395,7 +257498,7 @@ function runTraceExport(cwd, sessionId, options = {}) {
|
|
|
257395
257498
|
const outputPath = resolveSafePath(cwd, value.out);
|
|
257396
257499
|
const directory = dirname11(outputPath);
|
|
257397
257500
|
if (existsSync29(directory)) {
|
|
257398
|
-
const stats =
|
|
257501
|
+
const stats = lstatSync6(directory);
|
|
257399
257502
|
if (stats.isSymbolicLink() || !stats.isDirectory()) {
|
|
257400
257503
|
throw new Error("Trace output directory must be a real directory.");
|
|
257401
257504
|
}
|
|
@@ -257422,7 +257525,7 @@ import { exec as execCallback, execFileSync as execFileSync6 } from "child_proce
|
|
|
257422
257525
|
import {
|
|
257423
257526
|
copyFileSync as copyFileSync4,
|
|
257424
257527
|
existsSync as existsSync30,
|
|
257425
|
-
lstatSync as
|
|
257528
|
+
lstatSync as lstatSync7,
|
|
257426
257529
|
mkdirSync as mkdirSync15,
|
|
257427
257530
|
readFileSync as readFileSync28,
|
|
257428
257531
|
renameSync as renameSync10,
|
|
@@ -257433,16 +257536,16 @@ import { basename as basename6, dirname as dirname12, join as join19 } from "pat
|
|
|
257433
257536
|
import { promisify as promisify5 } from "util";
|
|
257434
257537
|
import picocolors23 from "picocolors";
|
|
257435
257538
|
import { parse as parseYaml3 } from "yaml";
|
|
257436
|
-
import { z as
|
|
257539
|
+
import { z as z51 } from "zod";
|
|
257437
257540
|
var exec4 = promisify5(execCallback);
|
|
257438
257541
|
var MAX_SUITE_BYTES = 1024 * 1024;
|
|
257439
257542
|
var MAX_VERIFICATION_OUTPUT = 4e3;
|
|
257440
|
-
var EvalOptionsSchema =
|
|
257441
|
-
provider:
|
|
257442
|
-
model:
|
|
257443
|
-
task:
|
|
257444
|
-
allowCommands:
|
|
257445
|
-
json:
|
|
257543
|
+
var EvalOptionsSchema = z51.object({
|
|
257544
|
+
provider: z51.string().trim().min(1).optional(),
|
|
257545
|
+
model: z51.string().trim().min(1).optional(),
|
|
257546
|
+
task: z51.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/).optional(),
|
|
257547
|
+
allowCommands: z51.boolean().default(false),
|
|
257548
|
+
json: z51.boolean().default(false)
|
|
257446
257549
|
});
|
|
257447
257550
|
async function runEval(cwd, suiteFile, options = {}) {
|
|
257448
257551
|
const value = EvalOptionsSchema.parse(options);
|
|
@@ -257588,7 +257691,7 @@ async function runEval(cwd, suiteFile, options = {}) {
|
|
|
257588
257691
|
}
|
|
257589
257692
|
function loadAcceptanceSuite(cwd, suiteFile) {
|
|
257590
257693
|
const filePath = resolveSafePath(cwd, suiteFile);
|
|
257591
|
-
const stats =
|
|
257694
|
+
const stats = lstatSync7(filePath);
|
|
257592
257695
|
if (stats.isSymbolicLink() || !stats.isFile()) {
|
|
257593
257696
|
throw new Error("Acceptance suite must be a real file.");
|
|
257594
257697
|
}
|
|
@@ -257676,7 +257779,7 @@ function snapshotWorkspaceIntoWorktree(sourceCwd, worktreeCwd) {
|
|
|
257676
257779
|
if (isSensitiveSnapshotPath2(relativePath)) continue;
|
|
257677
257780
|
const sourcePath = resolveSafePath(sourceCwd, relativePath);
|
|
257678
257781
|
const targetPath = resolveSafePath(worktreeCwd, relativePath);
|
|
257679
|
-
const stats =
|
|
257782
|
+
const stats = lstatSync7(sourcePath);
|
|
257680
257783
|
if (stats.isSymbolicLink() || !stats.isFile()) continue;
|
|
257681
257784
|
mkdirSync15(dirname12(targetPath), { recursive: true });
|
|
257682
257785
|
copyFileSync4(sourcePath, targetPath);
|
|
@@ -257736,7 +257839,7 @@ function writeEvaluationReport(cwd, runId, report) {
|
|
|
257736
257839
|
function writeJsonAtomically2(filePath, value) {
|
|
257737
257840
|
const directory = dirname12(filePath);
|
|
257738
257841
|
if (existsSync30(directory)) {
|
|
257739
|
-
const stats =
|
|
257842
|
+
const stats = lstatSync7(directory);
|
|
257740
257843
|
if (stats.isSymbolicLink() || !stats.isDirectory()) {
|
|
257741
257844
|
throw new Error("Evaluation output directory must be a real directory.");
|
|
257742
257845
|
}
|
|
@@ -257765,16 +257868,16 @@ function safeSummary(value) {
|
|
|
257765
257868
|
import readline6 from "readline";
|
|
257766
257869
|
import picocolors24 from "picocolors";
|
|
257767
257870
|
import { resolve as resolve13 } from "path";
|
|
257768
|
-
import { z as
|
|
257871
|
+
import { z as z55 } from "zod";
|
|
257769
257872
|
|
|
257770
257873
|
// src/runtime/CleanupManager.ts
|
|
257771
|
-
import { lstatSync as
|
|
257874
|
+
import { lstatSync as lstatSync8, readdirSync as readdirSync8, rmSync as rmSync9 } from "fs";
|
|
257772
257875
|
import { homedir as homedir11 } from "os";
|
|
257773
257876
|
import { basename as basename7, join as join20, parse as parse5, resolve as resolve12 } from "path";
|
|
257774
|
-
import { z as
|
|
257775
|
-
var CleanupScopeSchema =
|
|
257877
|
+
import { z as z54 } from "zod";
|
|
257878
|
+
var CleanupScopeSchema = z54.enum(["user", "project"]);
|
|
257776
257879
|
function buildCleanupPlan(options) {
|
|
257777
|
-
const scopes =
|
|
257880
|
+
const scopes = z54.array(CleanupScopeSchema).min(1).parse(options.scopes);
|
|
257778
257881
|
const homeDirectory = resolve12(options.homeDirectory ?? homedir11());
|
|
257779
257882
|
const projectDirectory = resolve12(options.projectDirectory ?? options.cwd);
|
|
257780
257883
|
const candidates = scopes.map((scope) => ({
|
|
@@ -257838,7 +257941,7 @@ function inspectPath(targetPath) {
|
|
|
257838
257941
|
const visit = (currentPath) => {
|
|
257839
257942
|
let stat;
|
|
257840
257943
|
try {
|
|
257841
|
-
stat =
|
|
257944
|
+
stat = lstatSync8(currentPath);
|
|
257842
257945
|
} catch (error) {
|
|
257843
257946
|
warnings.push(safeInventoryWarning(currentPath, error));
|
|
257844
257947
|
return;
|
|
@@ -257885,7 +257988,7 @@ function pathIdentity(targetPath) {
|
|
|
257885
257988
|
}
|
|
257886
257989
|
function pathExists(targetPath) {
|
|
257887
257990
|
try {
|
|
257888
|
-
|
|
257991
|
+
lstatSync8(targetPath);
|
|
257889
257992
|
return true;
|
|
257890
257993
|
} catch {
|
|
257891
257994
|
return false;
|
|
@@ -257897,12 +258000,12 @@ function safeInventoryWarning(targetPath, error) {
|
|
|
257897
258000
|
}
|
|
257898
258001
|
|
|
257899
258002
|
// src/commands/clean.ts
|
|
257900
|
-
var CleanCommandOptionsSchema =
|
|
257901
|
-
user:
|
|
257902
|
-
project:
|
|
257903
|
-
all:
|
|
257904
|
-
yes:
|
|
257905
|
-
json:
|
|
258003
|
+
var CleanCommandOptionsSchema = z55.object({
|
|
258004
|
+
user: z55.boolean().default(false),
|
|
258005
|
+
project: z55.union([z55.boolean(), z55.string().min(1).max(4096)]).optional(),
|
|
258006
|
+
all: z55.boolean().default(false),
|
|
258007
|
+
yes: z55.boolean().default(false),
|
|
258008
|
+
json: z55.boolean().default(false)
|
|
257906
258009
|
}).strict();
|
|
257907
258010
|
async function runClean(cwd, rawOptions, dependencies = {}) {
|
|
257908
258011
|
const options = CleanCommandOptionsSchema.parse(rawOptions);
|
|
@@ -258017,12 +258120,12 @@ async function confirmDeletion(prompt) {
|
|
|
258017
258120
|
// src/commands/backup.ts
|
|
258018
258121
|
import { basename as basename8, resolve as resolve15 } from "path";
|
|
258019
258122
|
import picocolors25 from "picocolors";
|
|
258020
|
-
import { z as
|
|
258123
|
+
import { z as z57 } from "zod";
|
|
258021
258124
|
|
|
258022
258125
|
// src/runtime/ProjectBackup.ts
|
|
258023
258126
|
import {
|
|
258024
258127
|
existsSync as existsSync31,
|
|
258025
|
-
lstatSync as
|
|
258128
|
+
lstatSync as lstatSync9,
|
|
258026
258129
|
mkdirSync as mkdirSync16,
|
|
258027
258130
|
readFileSync as readFileSync29,
|
|
258028
258131
|
readdirSync as readdirSync9,
|
|
@@ -258033,23 +258136,23 @@ import {
|
|
|
258033
258136
|
} from "fs";
|
|
258034
258137
|
import { createHash as createHash8, randomUUID as randomUUID10 } from "crypto";
|
|
258035
258138
|
import { dirname as dirname13, isAbsolute as isAbsolute7, join as join21, relative as relative5, resolve as resolve14, sep as sep2 } from "path";
|
|
258036
|
-
import { z as
|
|
258139
|
+
import { z as z56 } from "zod";
|
|
258037
258140
|
var MAX_BACKUP_BYTES = 64 * 1024 * 1024;
|
|
258038
258141
|
var MAX_SERIALIZED_BACKUP_BYTES = 96 * 1024 * 1024;
|
|
258039
258142
|
var MAX_BACKUP_FILES = 1e4;
|
|
258040
258143
|
var SHA256_PATTERN = /^[a-f0-9]{64}$/;
|
|
258041
|
-
var BackupFileSchema =
|
|
258042
|
-
path:
|
|
258043
|
-
size:
|
|
258044
|
-
sha256:
|
|
258045
|
-
content:
|
|
258144
|
+
var BackupFileSchema = z56.object({
|
|
258145
|
+
path: z56.string().min(1).max(4096),
|
|
258146
|
+
size: z56.number().int().min(0).max(MAX_BACKUP_BYTES),
|
|
258147
|
+
sha256: z56.string().regex(SHA256_PATTERN),
|
|
258148
|
+
content: z56.string().max(Math.ceil(MAX_BACKUP_BYTES * 4 / 3) + 8)
|
|
258046
258149
|
});
|
|
258047
|
-
var ProjectBackupBundleSchema =
|
|
258048
|
-
schemaVersion:
|
|
258049
|
-
kind:
|
|
258050
|
-
createdAt:
|
|
258051
|
-
sourceName:
|
|
258052
|
-
files:
|
|
258150
|
+
var ProjectBackupBundleSchema = z56.object({
|
|
258151
|
+
schemaVersion: z56.literal(1),
|
|
258152
|
+
kind: z56.literal("orbit-project-backup"),
|
|
258153
|
+
createdAt: z56.string().datetime(),
|
|
258154
|
+
sourceName: z56.string().min(1).max(512),
|
|
258155
|
+
files: z56.array(BackupFileSchema).max(MAX_BACKUP_FILES)
|
|
258053
258156
|
}).superRefine((bundle, context) => {
|
|
258054
258157
|
let totalBytes = 0;
|
|
258055
258158
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -258057,7 +258160,7 @@ var ProjectBackupBundleSchema = z55.object({
|
|
|
258057
258160
|
totalBytes += file.size;
|
|
258058
258161
|
if (totalBytes > MAX_BACKUP_BYTES) {
|
|
258059
258162
|
context.addIssue({
|
|
258060
|
-
code:
|
|
258163
|
+
code: z56.ZodIssueCode.custom,
|
|
258061
258164
|
message: `Backup exceeds ${MAX_BACKUP_BYTES} bytes.`
|
|
258062
258165
|
});
|
|
258063
258166
|
break;
|
|
@@ -258065,14 +258168,14 @@ var ProjectBackupBundleSchema = z55.object({
|
|
|
258065
258168
|
const normalized = normalizeBundlePath(file.path);
|
|
258066
258169
|
if (!normalized || normalized !== file.path) {
|
|
258067
258170
|
context.addIssue({
|
|
258068
|
-
code:
|
|
258171
|
+
code: z56.ZodIssueCode.custom,
|
|
258069
258172
|
message: `Unsafe backup path: ${file.path}`
|
|
258070
258173
|
});
|
|
258071
258174
|
continue;
|
|
258072
258175
|
}
|
|
258073
258176
|
if (seen.has(normalized.toLowerCase())) {
|
|
258074
258177
|
context.addIssue({
|
|
258075
|
-
code:
|
|
258178
|
+
code: z56.ZodIssueCode.custom,
|
|
258076
258179
|
message: `Duplicate backup path: ${file.path}`
|
|
258077
258180
|
});
|
|
258078
258181
|
}
|
|
@@ -258201,7 +258304,7 @@ function listBackupFiles(root) {
|
|
|
258201
258304
|
const relativePath = relative5(root, absolutePath).split(sep2).join("/");
|
|
258202
258305
|
const topLevel = relativePath.split("/")[0]?.toLowerCase() ?? "";
|
|
258203
258306
|
if (EXCLUDED_TOP_LEVEL.has(topLevel)) continue;
|
|
258204
|
-
const status =
|
|
258307
|
+
const status = lstatSync9(absolutePath);
|
|
258205
258308
|
if (status.isSymbolicLink()) continue;
|
|
258206
258309
|
if (status.isDirectory()) visit(absolutePath);
|
|
258207
258310
|
else if (status.isFile()) output.push(absolutePath);
|
|
@@ -258240,12 +258343,12 @@ function assertDirectoryChainHasNoSymlink(root, target) {
|
|
|
258240
258343
|
throw new Error("Backup restore directory escapes the project.");
|
|
258241
258344
|
}
|
|
258242
258345
|
let current = absoluteRoot;
|
|
258243
|
-
if (existsSync31(current) &&
|
|
258346
|
+
if (existsSync31(current) && lstatSync9(current).isSymbolicLink()) {
|
|
258244
258347
|
throw new Error(`Refusing to restore through symbolic link: ${current}`);
|
|
258245
258348
|
}
|
|
258246
258349
|
for (const part of relativeTarget.split(sep2).filter(Boolean)) {
|
|
258247
258350
|
current = join21(current, part);
|
|
258248
|
-
if (existsSync31(current) &&
|
|
258351
|
+
if (existsSync31(current) && lstatSync9(current).isSymbolicLink()) {
|
|
258249
258352
|
throw new Error(`Refusing to restore through symbolic link: ${current}`);
|
|
258250
258353
|
}
|
|
258251
258354
|
}
|
|
@@ -258282,9 +258385,9 @@ function formatBytes2(bytes) {
|
|
|
258282
258385
|
}
|
|
258283
258386
|
|
|
258284
258387
|
// src/commands/backup.ts
|
|
258285
|
-
var BackupOptionsSchema =
|
|
258286
|
-
output:
|
|
258287
|
-
json:
|
|
258388
|
+
var BackupOptionsSchema = z57.object({
|
|
258389
|
+
output: z57.string().min(1).max(4096).optional(),
|
|
258390
|
+
json: z57.boolean().default(false)
|
|
258288
258391
|
}).strict();
|
|
258289
258392
|
function runBackupCreate(cwd, rawOptions = {}) {
|
|
258290
258393
|
const options = BackupOptionsSchema.parse(rawOptions);
|
|
@@ -258374,7 +258477,7 @@ import picocolors26 from "picocolors";
|
|
|
258374
258477
|
// src/runtime/ExtensionManager.ts
|
|
258375
258478
|
import {
|
|
258376
258479
|
existsSync as existsSync36,
|
|
258377
|
-
lstatSync as
|
|
258480
|
+
lstatSync as lstatSync10,
|
|
258378
258481
|
mkdirSync as mkdirSync17,
|
|
258379
258482
|
readFileSync as readFileSync30,
|
|
258380
258483
|
readdirSync as readdirSync10,
|
|
@@ -258385,20 +258488,20 @@ import {
|
|
|
258385
258488
|
import { createHash as createHash9, randomUUID as randomUUID11 } from "crypto";
|
|
258386
258489
|
import { dirname as dirname14, join as join26, relative as relative6, resolve as resolve16 } from "path";
|
|
258387
258490
|
import { homedir as homedir12 } from "os";
|
|
258388
|
-
import { z as
|
|
258389
|
-
var InstalledExtensionSchema2 =
|
|
258390
|
-
id:
|
|
258391
|
-
displayName:
|
|
258392
|
-
version:
|
|
258393
|
-
digest:
|
|
258394
|
-
installedAt:
|
|
258395
|
-
trusted:
|
|
258396
|
-
path:
|
|
258397
|
-
manifestFile:
|
|
258491
|
+
import { z as z58 } from "zod";
|
|
258492
|
+
var InstalledExtensionSchema2 = z58.object({
|
|
258493
|
+
id: z58.string(),
|
|
258494
|
+
displayName: z58.string(),
|
|
258495
|
+
version: z58.string(),
|
|
258496
|
+
digest: z58.string().regex(/^[a-f0-9]{64}$/),
|
|
258497
|
+
installedAt: z58.string().datetime(),
|
|
258498
|
+
trusted: z58.boolean(),
|
|
258499
|
+
path: z58.string(),
|
|
258500
|
+
manifestFile: z58.string().default("extension.yaml")
|
|
258398
258501
|
});
|
|
258399
|
-
var ExtensionRegistrySchema2 =
|
|
258400
|
-
schemaVersion:
|
|
258401
|
-
extensions:
|
|
258502
|
+
var ExtensionRegistrySchema2 = z58.object({
|
|
258503
|
+
schemaVersion: z58.literal(1),
|
|
258504
|
+
extensions: z58.array(InstalledExtensionSchema2).default([])
|
|
258402
258505
|
});
|
|
258403
258506
|
var ExtensionManager = class {
|
|
258404
258507
|
orbitDir;
|
|
@@ -258415,7 +258518,7 @@ var ExtensionManager = class {
|
|
|
258415
258518
|
return ExtensionRegistrySchema2.parse(
|
|
258416
258519
|
JSON.parse(readFileSync30(this.registryPath, "utf8"))
|
|
258417
258520
|
).extensions.filter(
|
|
258418
|
-
(extension) => this.isManagedExtensionPath(extension) && existsSync36(extension.path) && !
|
|
258521
|
+
(extension) => this.isManagedExtensionPath(extension) && existsSync36(extension.path) && !lstatSync10(extension.path).isSymbolicLink()
|
|
258419
258522
|
);
|
|
258420
258523
|
} catch {
|
|
258421
258524
|
return [];
|
|
@@ -258566,7 +258669,7 @@ function validateContributionFiles(root, manifest) {
|
|
|
258566
258669
|
`Invalid extension contribution path: ${contribution.path}`
|
|
258567
258670
|
);
|
|
258568
258671
|
}
|
|
258569
|
-
if (!existsSync36(target) ||
|
|
258672
|
+
if (!existsSync36(target) || lstatSync10(target).isSymbolicLink()) {
|
|
258570
258673
|
throw new Error(
|
|
258571
258674
|
`Extension contribution is missing or unsafe: ${contribution.path}`
|
|
258572
258675
|
);
|
|
@@ -258574,7 +258677,7 @@ function validateContributionFiles(root, manifest) {
|
|
|
258574
258677
|
}
|
|
258575
258678
|
}
|
|
258576
258679
|
function copyDirectorySafely(source, target) {
|
|
258577
|
-
const stats =
|
|
258680
|
+
const stats = lstatSync10(source);
|
|
258578
258681
|
if (stats.isSymbolicLink())
|
|
258579
258682
|
throw new Error("Extension directories cannot contain symlinks.");
|
|
258580
258683
|
if (stats.isDirectory()) {
|
|
@@ -258612,7 +258715,7 @@ function hashDirectory2(root) {
|
|
|
258612
258715
|
const visit = (directory) => {
|
|
258613
258716
|
for (const entry of readdirSync10(directory).sort()) {
|
|
258614
258717
|
const path6 = join26(directory, entry);
|
|
258615
|
-
const stats =
|
|
258718
|
+
const stats = lstatSync10(path6);
|
|
258616
258719
|
const name = relative6(root, path6).replace(/\\/g, "/");
|
|
258617
258720
|
hash2.update(name);
|
|
258618
258721
|
if (stats.isDirectory()) visit(path6);
|