@orbit-build/cli 0.2.1 → 0.2.2

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.
Files changed (2) hide show
  1. package/dist/index.js +1302 -463
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -58417,8 +58417,8 @@ ${lanes.join("\n")}
58417
58417
  }
58418
58418
  function resolveExternalModuleName(location, moduleReferenceExpression, ignoreErrors) {
58419
58419
  const isClassic = getEmitModuleResolutionKind(compilerOptions) === 1;
58420
- const errorMessage3 = isClassic ? Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option : Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations;
58421
- return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ignoreErrors ? void 0 : errorMessage3, ignoreErrors);
58420
+ const errorMessage4 = isClassic ? Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option : Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations;
58421
+ return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ignoreErrors ? void 0 : errorMessage4, ignoreErrors);
58422
58422
  }
58423
58423
  function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, ignoreErrors = false, isForAugmentation = false) {
58424
58424
  return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, !ignoreErrors ? moduleReferenceExpression : void 0, isForAugmentation) : void 0;
@@ -72788,8 +72788,8 @@ ${lanes.join("\n")}
72788
72788
  if (moduleSymbol.flags & targetMeaning) {
72789
72789
  links.resolvedType = resolveImportSymbolType(node, links, moduleSymbol, targetMeaning);
72790
72790
  } else {
72791
- const errorMessage3 = targetMeaning === 111551 ? Diagnostics.Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here : Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0;
72792
- error2(node, errorMessage3, node.argument.literal.text);
72791
+ const errorMessage4 = targetMeaning === 111551 ? Diagnostics.Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here : Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0;
72792
+ error2(node, errorMessage4, node.argument.literal.text);
72793
72793
  links.resolvedSymbol = unknownSymbol;
72794
72794
  links.resolvedType = errorType;
72795
72795
  }
@@ -74074,7 +74074,7 @@ ${lanes.join("\n")}
74074
74074
  function elaborateElementwise(iterator, source, target, relation, containingMessageChain, errorOutputContainer) {
74075
74075
  let reportedError = false;
74076
74076
  for (const value of iterator) {
74077
- const { errorNode: prop, innerExpression: next, nameType, errorMessage: errorMessage3 } = value;
74077
+ const { errorNode: prop, innerExpression: next, nameType, errorMessage: errorMessage4 } = value;
74078
74078
  let targetPropType = getBestMatchIndexedAccessTypeOrUndefined(source, target, nameType);
74079
74079
  if (!targetPropType || targetPropType.flags & 8388608) continue;
74080
74080
  let sourcePropType = getIndexedAccessTypeOrUndefined(source, nameType);
@@ -74114,9 +74114,9 @@ ${lanes.join("\n")}
74114
74114
  const sourceIsOptional = !!(propName && (getPropertyOfType(source, propName) || unknownSymbol).flags & 16777216);
74115
74115
  targetPropType = removeMissingType(targetPropType, targetIsOptional);
74116
74116
  sourcePropType = removeMissingType(sourcePropType, targetIsOptional && sourceIsOptional);
74117
- const result = checkTypeRelatedTo(specificSource, targetPropType, relation, prop, errorMessage3, containingMessageChain, resultObj);
74117
+ const result = checkTypeRelatedTo(specificSource, targetPropType, relation, prop, errorMessage4, containingMessageChain, resultObj);
74118
74118
  if (result && specificSource !== sourcePropType) {
74119
- checkTypeRelatedTo(sourcePropType, targetPropType, relation, prop, errorMessage3, containingMessageChain, resultObj);
74119
+ checkTypeRelatedTo(sourcePropType, targetPropType, relation, prop, errorMessage4, containingMessageChain, resultObj);
74120
74120
  }
74121
74121
  }
74122
74122
  if (resultObj.errors) {
@@ -74163,7 +74163,7 @@ ${lanes.join("\n")}
74163
74163
  ) : void 0;
74164
74164
  let reportedError = false;
74165
74165
  for (let status = iterator.next(); !status.done; status = iterator.next()) {
74166
- const { errorNode: prop, innerExpression: next, nameType, errorMessage: errorMessage3 } = status.value;
74166
+ const { errorNode: prop, innerExpression: next, nameType, errorMessage: errorMessage4 } = status.value;
74167
74167
  let targetPropType = iterationType;
74168
74168
  const targetIndexedPropType = tupleOrArrayLikeTargetParts !== neverType2 ? getBestMatchIndexedAccessTypeOrUndefined(source, tupleOrArrayLikeTargetParts, nameType) : void 0;
74169
74169
  if (targetIndexedPropType && !(targetIndexedPropType.flags & 8388608)) {
@@ -74207,9 +74207,9 @@ ${lanes.join("\n")}
74207
74207
  const sourceIsOptional = !!(propName && (getPropertyOfType(source, propName) || unknownSymbol).flags & 16777216);
74208
74208
  targetPropType = removeMissingType(targetPropType, targetIsOptional);
74209
74209
  sourcePropType = removeMissingType(sourcePropType, targetIsOptional && sourceIsOptional);
74210
- const result = checkTypeRelatedTo(specificSource, targetPropType, relation, prop, errorMessage3, containingMessageChain, resultObj);
74210
+ const result = checkTypeRelatedTo(specificSource, targetPropType, relation, prop, errorMessage4, containingMessageChain, resultObj);
74211
74211
  if (result && specificSource !== sourcePropType) {
74212
- checkTypeRelatedTo(sourcePropType, targetPropType, relation, prop, errorMessage3, containingMessageChain, resultObj);
74212
+ checkTypeRelatedTo(sourcePropType, targetPropType, relation, prop, errorMessage4, containingMessageChain, resultObj);
74213
74213
  }
74214
74214
  }
74215
74215
  }
@@ -85196,9 +85196,9 @@ ${lanes.join("\n")}
85196
85196
  return void 0;
85197
85197
  }
85198
85198
  const isClassic = getEmitModuleResolutionKind(compilerOptions) === 1;
85199
- const errorMessage3 = isClassic ? Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option : Diagnostics.This_JSX_tag_requires_the_module_path_0_to_exist_but_none_could_be_found_Make_sure_you_have_types_for_the_appropriate_package_installed;
85199
+ const errorMessage4 = isClassic ? Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option : Diagnostics.This_JSX_tag_requires_the_module_path_0_to_exist_but_none_could_be_found_Make_sure_you_have_types_for_the_appropriate_package_installed;
85200
85200
  const specifier = getJSXRuntimeImportSpecifier(file, runtimeImportSpecifier);
85201
- const mod = resolveExternalModule(specifier || location, runtimeImportSpecifier, errorMessage3, location);
85201
+ const mod = resolveExternalModule(specifier || location, runtimeImportSpecifier, errorMessage4, location);
85202
85202
  const result = mod && mod !== unknownSymbol ? getMergedSymbol(resolveSymbol(mod)) : void 0;
85203
85203
  if (links) {
85204
85204
  links.jsxImplicitImportContainer = result || false;
@@ -96832,7 +96832,7 @@ ${lanes.join("\n")}
96832
96832
  if (baseDeclarationFlags & 2 || derivedDeclarationFlags & 2) {
96833
96833
  continue;
96834
96834
  }
96835
- let errorMessage3;
96835
+ let errorMessage4;
96836
96836
  const basePropertyFlags = base.flags & 98308;
96837
96837
  const derivedPropertyFlags = derived.flags & 98308;
96838
96838
  if (basePropertyFlags && derivedPropertyFlags) {
@@ -96861,14 +96861,14 @@ ${lanes.join("\n")}
96861
96861
  continue;
96862
96862
  } else {
96863
96863
  Debug.assert(!!(derived.flags & 98304));
96864
- errorMessage3 = Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor;
96864
+ errorMessage4 = Diagnostics.Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor;
96865
96865
  }
96866
96866
  } else if (base.flags & 98304) {
96867
- errorMessage3 = Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function;
96867
+ errorMessage4 = Diagnostics.Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function;
96868
96868
  } else {
96869
- errorMessage3 = Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function;
96869
+ errorMessage4 = Diagnostics.Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function;
96870
96870
  }
96871
- error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage3, typeToString(baseType), symbolToString(base), typeToString(type));
96871
+ error2(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage4, typeToString(baseType), symbolToString(base), typeToString(type));
96872
96872
  }
96873
96873
  }
96874
96874
  for (const [errorNode, memberInfo] of notImplementedInfo) {
@@ -97871,10 +97871,10 @@ ${lanes.join("\n")}
97871
97871
  }
97872
97872
  return false;
97873
97873
  }
97874
- function checkGrammarModuleElementContext(node, errorMessage3) {
97874
+ function checkGrammarModuleElementContext(node, errorMessage4) {
97875
97875
  const isInAppropriateContext = node.parent.kind === 308 || node.parent.kind === 269 || node.parent.kind === 268;
97876
97876
  if (!isInAppropriateContext) {
97877
- grammarErrorOnFirstToken(node, errorMessage3);
97877
+ grammarErrorOnFirstToken(node, errorMessage4);
97878
97878
  }
97879
97879
  return !isInAppropriateContext;
97880
97880
  }
@@ -136060,14 +136060,14 @@ ${lanes.join("\n")}
136060
136060
  return output;
136061
136061
  }
136062
136062
  function formatDiagnostic(diagnostic, host) {
136063
- const errorMessage3 = `${diagnosticCategoryName(diagnostic)} TS${diagnostic.code}: ${flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine())}${host.getNewLine()}`;
136063
+ const errorMessage4 = `${diagnosticCategoryName(diagnostic)} TS${diagnostic.code}: ${flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine())}${host.getNewLine()}`;
136064
136064
  if (diagnostic.file) {
136065
136065
  const { line, character } = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start);
136066
136066
  const fileName = diagnostic.file.fileName;
136067
136067
  const relativeFileName = convertToRelativePath(fileName, host.getCurrentDirectory(), (fileName2) => host.getCanonicalFileName(fileName2));
136068
- return `${relativeFileName}(${line + 1},${character + 1}): ` + errorMessage3;
136068
+ return `${relativeFileName}(${line + 1},${character + 1}): ` + errorMessage4;
136069
136069
  }
136070
- return errorMessage3;
136070
+ return errorMessage4;
136071
136071
  }
136072
136072
  var ForegroundColorEscapeSequences = /* @__PURE__ */ ((ForegroundColorEscapeSequences2) => {
136073
136073
  ForegroundColorEscapeSequences2["Grey"] = "\x1B[90m";
@@ -212115,15 +212115,15 @@ var makeIssue = (params) => {
212115
212115
  message: issueData.message
212116
212116
  };
212117
212117
  }
212118
- let errorMessage3 = "";
212118
+ let errorMessage4 = "";
212119
212119
  const maps = errorMaps.filter((m2) => !!m2).slice().reverse();
212120
212120
  for (const map of maps) {
212121
- errorMessage3 = map(fullIssue, { data, defaultError: errorMessage3 }).message;
212121
+ errorMessage4 = map(fullIssue, { data, defaultError: errorMessage4 }).message;
212122
212122
  }
212123
212123
  return {
212124
212124
  ...issueData,
212125
212125
  path: fullPath,
212126
- message: errorMessage3
212126
+ message: errorMessage4
212127
212127
  };
212128
212128
  };
212129
212129
  var EMPTY_PATH = [];
@@ -228987,11 +228987,11 @@ var Renderer = class {
228987
228987
  // ../core/dist/index.js
228988
228988
  import { z as z73 } from "zod";
228989
228989
  import { EventEmitter } from "events";
228990
- import { z as z34 } from "zod";
228990
+ import { z as z35 } from "zod";
228991
228991
  import picocolors8 from "picocolors";
228992
228992
  import path4 from "path";
228993
228993
  import fs3 from "fs";
228994
- import { randomUUID as randomUUID32 } from "crypto";
228994
+ import { randomUUID as randomUUID33 } from "crypto";
228995
228995
  import { exec as exec2, execFile as execFile3 } from "child_process";
228996
228996
  import { promisify as promisify3 } from "util";
228997
228997
  import { createHash as createHash23 } from "crypto";
@@ -229875,6 +229875,18 @@ import {
229875
229875
  import { homedir as homedir5 } from "os";
229876
229876
  import { basename as basename4, isAbsolute as isAbsolute22, join as join25, parse as parse2, resolve as resolve24 } from "path";
229877
229877
  import { z as z29 } from "zod";
229878
+ import {
229879
+ existsSync as existsSync35,
229880
+ mkdirSync as mkdirSync32,
229881
+ readFileSync as readFileSync33,
229882
+ readdirSync as readdirSync22,
229883
+ renameSync as renameSync32,
229884
+ rmSync as rmSync32,
229885
+ writeFileSync as writeFileSync32
229886
+ } from "fs";
229887
+ import { basename as basename22, join as join33, resolve as resolve33 } from "path";
229888
+ import { randomUUID as randomUUID32 } from "crypto";
229889
+ import { z as z34 } from "zod";
229878
229890
  var SafeObjectKeySchema = z28.string().refine(
229879
229891
  (key) => !["__proto__", "constructor", "prototype"].includes(key),
229880
229892
  "Unsafe object key."
@@ -231155,6 +231167,192 @@ function isDirectory(targetPath) {
231155
231167
  return false;
231156
231168
  }
231157
231169
  }
231170
+ var AgentIdSchema = z34.string().regex(/^agent_[a-z0-9-]+$/, "Invalid agent id.");
231171
+ var AgentRunIdSchema = z34.string().regex(/^run_[a-z0-9-]+$/, "Invalid agent run id.");
231172
+ var DurableAgentStateSchema = z34.object({
231173
+ id: AgentIdSchema,
231174
+ role: z34.string().min(1).max(80),
231175
+ task: z34.string().min(1).max(8e3),
231176
+ status: z34.enum([
231177
+ "pending",
231178
+ "running",
231179
+ "completed",
231180
+ "failed",
231181
+ "aborted",
231182
+ "blocked"
231183
+ ]),
231184
+ model: z34.string().min(1).max(200),
231185
+ budgetUsd: z34.number().finite().nonnegative(),
231186
+ costUsd: z34.number().finite().nonnegative().default(0),
231187
+ access: z34.object({
231188
+ mode: z34.enum(["read", "write"]),
231189
+ scopes: z34.array(z34.string().min(1).max(1e3)).min(1).max(100)
231190
+ }),
231191
+ startedAt: z34.string().datetime().optional(),
231192
+ endedAt: z34.string().datetime().optional(),
231193
+ error: z34.string().max(4e3).optional()
231194
+ });
231195
+ var AgentRunSchema = z34.object({
231196
+ schemaVersion: z34.literal(1),
231197
+ id: AgentRunIdSchema,
231198
+ task: z34.string().min(1).max(2e4),
231199
+ status: z34.enum(["running", "completed", "failed", "aborted"]),
231200
+ budgetUsd: z34.number().finite().nonnegative(),
231201
+ costUsd: z34.number().finite().nonnegative().default(0),
231202
+ createdAt: z34.string().datetime(),
231203
+ updatedAt: z34.string().datetime(),
231204
+ agents: z34.array(DurableAgentStateSchema).max(128)
231205
+ });
231206
+ var AgentRunStore = class {
231207
+ constructor(cwd) {
231208
+ this.cwd = cwd;
231209
+ this.directory = resolve33(cwd, ".orbit", "agent-runs");
231210
+ }
231211
+ cwd;
231212
+ directory;
231213
+ initialized = false;
231214
+ initialize() {
231215
+ mkdirSync32(this.directory, { recursive: true, mode: 448 });
231216
+ this.initialized = true;
231217
+ }
231218
+ createRun(input) {
231219
+ this.assertInitialized();
231220
+ const now = (/* @__PURE__ */ new Date()).toISOString();
231221
+ const run = AgentRunSchema.parse({
231222
+ schemaVersion: 1,
231223
+ id: generateId("run"),
231224
+ task: input.task,
231225
+ status: "running",
231226
+ budgetUsd: input.budgetUsd,
231227
+ costUsd: 0,
231228
+ createdAt: now,
231229
+ updatedAt: now,
231230
+ agents: []
231231
+ });
231232
+ this.write(run);
231233
+ return run;
231234
+ }
231235
+ addAgent(runId, input) {
231236
+ const run = this.requireRun(runId);
231237
+ const agent = DurableAgentStateSchema.parse({
231238
+ id: generateId("agent"),
231239
+ ...input,
231240
+ status: "pending",
231241
+ costUsd: 0
231242
+ });
231243
+ this.write({
231244
+ ...run,
231245
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
231246
+ agents: [...run.agents, agent]
231247
+ });
231248
+ return agent;
231249
+ }
231250
+ updateAgent(runId, agentId, patch) {
231251
+ AgentIdSchema.parse(agentId);
231252
+ const run = this.requireRun(runId);
231253
+ let updated;
231254
+ const agents = run.agents.map((agent) => {
231255
+ if (agent.id !== agentId) return agent;
231256
+ updated = DurableAgentStateSchema.parse({ ...agent, ...patch });
231257
+ return updated;
231258
+ });
231259
+ if (!updated) throw new Error(`Agent not found: ${agentId}`);
231260
+ this.write({
231261
+ ...run,
231262
+ costUsd: agents.reduce((sum, agent) => sum + agent.costUsd, 0),
231263
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
231264
+ agents
231265
+ });
231266
+ return updated;
231267
+ }
231268
+ finishRun(runId, status) {
231269
+ const run = this.requireRun(runId);
231270
+ const updated = AgentRunSchema.parse({
231271
+ ...run,
231272
+ status,
231273
+ costUsd: run.agents.reduce((sum, agent) => sum + agent.costUsd, 0),
231274
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
231275
+ });
231276
+ this.write(updated);
231277
+ return updated;
231278
+ }
231279
+ getRun(runId) {
231280
+ AgentRunIdSchema.parse(runId);
231281
+ const file = this.resolveRunFile(runId);
231282
+ if (!existsSync35(file)) return void 0;
231283
+ return this.read(file);
231284
+ }
231285
+ listRuns(limit = 20) {
231286
+ if (!existsSync35(this.directory)) return [];
231287
+ return readdirSync22(this.directory).filter((name) => /^run_[a-z0-9-]+\.json$/.test(name)).flatMap((name) => {
231288
+ try {
231289
+ return [
231290
+ this.read(
231291
+ resolveSafePath(this.cwd, join33(".orbit", "agent-runs", name))
231292
+ )
231293
+ ];
231294
+ } catch {
231295
+ return [];
231296
+ }
231297
+ }).sort((left, right) => right.updatedAt.localeCompare(left.updatedAt)).slice(0, Math.max(1, Math.min(100, limit)));
231298
+ }
231299
+ requireRun(runId) {
231300
+ this.assertInitialized();
231301
+ const run = this.getRun(runId);
231302
+ if (!run) throw new Error(`Agent run not found: ${runId}`);
231303
+ return run;
231304
+ }
231305
+ read(file) {
231306
+ try {
231307
+ return AgentRunSchema.parse(JSON.parse(readFileSync33(file, "utf8")));
231308
+ } catch (error) {
231309
+ throw new Error(
231310
+ `Invalid agent run ${basename22(file)}: ${error instanceof Error ? error.message : String(error)}`
231311
+ );
231312
+ }
231313
+ }
231314
+ write(run) {
231315
+ this.assertInitialized();
231316
+ const validated = AgentRunSchema.parse(run);
231317
+ const file = this.resolveRunFile(validated.id);
231318
+ const temporary = `${file}.${process.pid}.${randomUUID32()}.tmp`;
231319
+ const previous = `${file}.${process.pid}.${randomUUID32()}.bak`;
231320
+ writeFileSync32(temporary, JSON.stringify(validated, null, 2), {
231321
+ encoding: "utf8",
231322
+ mode: 384,
231323
+ flag: "wx"
231324
+ });
231325
+ let movedPrevious = false;
231326
+ try {
231327
+ if (existsSync35(file)) {
231328
+ renameSync32(file, previous);
231329
+ movedPrevious = true;
231330
+ }
231331
+ renameSync32(temporary, file);
231332
+ if (movedPrevious) rmSync32(previous, { force: true });
231333
+ } catch (error) {
231334
+ if (movedPrevious && !existsSync35(file) && existsSync35(previous)) {
231335
+ renameSync32(previous, file);
231336
+ }
231337
+ throw error;
231338
+ } finally {
231339
+ rmSync32(temporary, { force: true });
231340
+ if (existsSync35(file)) rmSync32(previous, { force: true });
231341
+ }
231342
+ }
231343
+ resolveRunFile(runId) {
231344
+ AgentRunIdSchema.parse(runId);
231345
+ return resolveSafePath(
231346
+ this.cwd,
231347
+ join33(".orbit", "agent-runs", `${runId}.json`)
231348
+ );
231349
+ }
231350
+ assertInitialized() {
231351
+ if (!this.initialized) {
231352
+ throw new Error("AgentRunStore.initialize() must be called first.");
231353
+ }
231354
+ }
231355
+ };
231158
231356
 
231159
231357
  // ../core/dist/index.js
231160
231358
  import { randomUUID as randomUUID24 } from "crypto";
@@ -231179,7 +231377,7 @@ import { promisify as promisify2 } from "util";
231179
231377
  import { z as z83 } from "zod";
231180
231378
  import fs4 from "fs";
231181
231379
  import path52 from "path";
231182
- import { existsSync as existsSync35, statSync as statSync4 } from "fs";
231380
+ import { existsSync as existsSync36, statSync as statSync4 } from "fs";
231183
231381
  import { z as z93 } from "zod";
231184
231382
  import { z as z103 } from "zod";
231185
231383
  function createInitialState(sessionId, task, maxAttempts = 8) {
@@ -232042,234 +232240,234 @@ function cleanRuntimeLabel(value, fallback) {
232042
232240
  return clean || fallback;
232043
232241
  }
232044
232242
  var ORBIT_EVENT_SCHEMA_VERSION = 1;
232045
- var ModelRequestEventSchema = z34.object({
232046
- type: z34.literal("model_request"),
232047
- payload: z34.object({
232048
- model: z34.string(),
232049
- messages: z34.array(z34.unknown())
232243
+ var ModelRequestEventSchema = z35.object({
232244
+ type: z35.literal("model_request"),
232245
+ payload: z35.object({
232246
+ model: z35.string(),
232247
+ messages: z35.array(z35.unknown())
232050
232248
  })
232051
232249
  });
232052
- var ModelResponseEventSchema = z34.object({
232053
- type: z34.literal("model_response"),
232054
- payload: z34.object({
232055
- model: z34.string(),
232056
- requestedModel: z34.string().optional(),
232057
- resolvedModel: z34.string().optional(),
232058
- providerRequestId: z34.string().optional(),
232059
- text: z34.string().optional(),
232060
- reasoning_content: z34.string().optional(),
232061
- usage: z34.object({
232062
- inputTokens: z34.number(),
232063
- outputTokens: z34.number(),
232064
- cacheReadTokens: z34.number().optional(),
232065
- cacheWriteTokens: z34.number().optional()
232250
+ var ModelResponseEventSchema = z35.object({
232251
+ type: z35.literal("model_response"),
232252
+ payload: z35.object({
232253
+ model: z35.string(),
232254
+ requestedModel: z35.string().optional(),
232255
+ resolvedModel: z35.string().optional(),
232256
+ providerRequestId: z35.string().optional(),
232257
+ text: z35.string().optional(),
232258
+ reasoning_content: z35.string().optional(),
232259
+ usage: z35.object({
232260
+ inputTokens: z35.number(),
232261
+ outputTokens: z35.number(),
232262
+ cacheReadTokens: z35.number().optional(),
232263
+ cacheWriteTokens: z35.number().optional()
232066
232264
  }).optional(),
232067
- toolCalls: z34.array(z34.unknown()).optional()
232265
+ toolCalls: z35.array(z35.unknown()).optional()
232068
232266
  })
232069
232267
  });
232070
- var AgentStartEventSchema = z34.object({
232071
- type: z34.literal("agent_start"),
232072
- payload: z34.object({
232073
- taskId: z34.string(),
232074
- task: z34.string()
232268
+ var AgentStartEventSchema = z35.object({
232269
+ type: z35.literal("agent_start"),
232270
+ payload: z35.object({
232271
+ taskId: z35.string(),
232272
+ task: z35.string()
232075
232273
  })
232076
232274
  });
232077
- var AgentSpawnEventSchema = z34.object({
232078
- type: z34.literal("agent_spawn"),
232079
- payload: z34.object({
232080
- parentId: z34.string(),
232081
- childId: z34.string(),
232082
- role: z34.string(),
232083
- task: z34.string()
232275
+ var AgentSpawnEventSchema = z35.object({
232276
+ type: z35.literal("agent_spawn"),
232277
+ payload: z35.object({
232278
+ parentId: z35.string(),
232279
+ childId: z35.string(),
232280
+ role: z35.string(),
232281
+ task: z35.string()
232084
232282
  })
232085
232283
  });
232086
- var AgentStatusEventSchema = z34.object({
232087
- type: z34.literal("agent_status"),
232088
- payload: z34.object({
232089
- taskId: z34.string(),
232090
- status: z34.string(),
232091
- detail: z34.string().optional()
232284
+ var AgentStatusEventSchema = z35.object({
232285
+ type: z35.literal("agent_status"),
232286
+ payload: z35.object({
232287
+ taskId: z35.string(),
232288
+ status: z35.string(),
232289
+ detail: z35.string().optional()
232092
232290
  })
232093
232291
  });
232094
- var AgentCompletedEventSchema = z34.object({
232095
- type: z34.literal("agent_completed"),
232096
- payload: z34.object({
232097
- taskId: z34.string(),
232098
- success: z34.boolean(),
232099
- result: z34.unknown().optional(),
232100
- error: z34.string().optional()
232292
+ var AgentCompletedEventSchema = z35.object({
232293
+ type: z35.literal("agent_completed"),
232294
+ payload: z35.object({
232295
+ taskId: z35.string(),
232296
+ success: z35.boolean(),
232297
+ result: z35.unknown().optional(),
232298
+ error: z35.string().optional()
232101
232299
  })
232102
232300
  });
232103
- var UiTurnStartedEventSchema = z34.object({
232104
- type: z34.literal("ui_turn_started"),
232105
- payload: z34.object({
232106
- turnId: z34.string(),
232107
- source: z34.enum(["terminal", "web"]),
232108
- prompt: z34.string()
232301
+ var UiTurnStartedEventSchema = z35.object({
232302
+ type: z35.literal("ui_turn_started"),
232303
+ payload: z35.object({
232304
+ turnId: z35.string(),
232305
+ source: z35.enum(["terminal", "web"]),
232306
+ prompt: z35.string()
232109
232307
  })
232110
232308
  });
232111
- var UiTurnCompletedEventSchema = z34.object({
232112
- type: z34.literal("ui_turn_completed"),
232113
- payload: z34.object({
232114
- turnId: z34.string(),
232115
- source: z34.enum(["terminal", "web"]),
232116
- status: z34.enum(["completed", "failed", "aborted"]),
232117
- message: z34.string().optional()
232309
+ var UiTurnCompletedEventSchema = z35.object({
232310
+ type: z35.literal("ui_turn_completed"),
232311
+ payload: z35.object({
232312
+ turnId: z35.string(),
232313
+ source: z35.enum(["terminal", "web"]),
232314
+ status: z35.enum(["completed", "failed", "aborted"]),
232315
+ message: z35.string().optional()
232118
232316
  })
232119
232317
  });
232120
- var LoopStartEventSchema = z34.object({
232121
- type: z34.literal("loop_start"),
232122
- payload: z34.object({
232123
- attempt: z34.number()
232318
+ var LoopStartEventSchema = z35.object({
232319
+ type: z35.literal("loop_start"),
232320
+ payload: z35.object({
232321
+ attempt: z35.number()
232124
232322
  })
232125
232323
  });
232126
- var ModelDeltaEventSchema = z34.object({
232127
- type: z34.literal("model_delta"),
232128
- payload: z34.object({
232129
- text: z34.string()
232324
+ var ModelDeltaEventSchema = z35.object({
232325
+ type: z35.literal("model_delta"),
232326
+ payload: z35.object({
232327
+ text: z35.string()
232130
232328
  })
232131
232329
  });
232132
- var ThinkingDeltaEventSchema = z34.object({
232133
- type: z34.literal("thinking_delta"),
232134
- payload: z34.object({
232135
- text: z34.string()
232330
+ var ThinkingDeltaEventSchema = z35.object({
232331
+ type: z35.literal("thinking_delta"),
232332
+ payload: z35.object({
232333
+ text: z35.string()
232136
232334
  })
232137
232335
  });
232138
- var CostUpdateEventSchema = z34.object({
232139
- type: z34.literal("cost_update"),
232140
- payload: z34.object({
232141
- turnCost: z34.number(),
232142
- sessionCost: z34.number(),
232143
- totalInputTokens: z34.number(),
232144
- totalCacheReadTokens: z34.number(),
232145
- totalOutputTokens: z34.number()
232336
+ var CostUpdateEventSchema = z35.object({
232337
+ type: z35.literal("cost_update"),
232338
+ payload: z35.object({
232339
+ turnCost: z35.number(),
232340
+ sessionCost: z35.number(),
232341
+ totalInputTokens: z35.number(),
232342
+ totalCacheReadTokens: z35.number(),
232343
+ totalOutputTokens: z35.number()
232146
232344
  })
232147
232345
  });
232148
- var CacheUpdateEventSchema = z34.object({
232149
- type: z34.literal("cache_update"),
232150
- payload: z34.object({
232151
- slabHash: z34.string(),
232152
- slabTokenEstimate: z34.number(),
232153
- hitTokens: z34.number(),
232154
- missTokens: z34.number(),
232155
- inputTokens: z34.number(),
232156
- hitRate: z34.number(),
232157
- degraded: z34.boolean()
232346
+ var CacheUpdateEventSchema = z35.object({
232347
+ type: z35.literal("cache_update"),
232348
+ payload: z35.object({
232349
+ slabHash: z35.string(),
232350
+ slabTokenEstimate: z35.number(),
232351
+ hitTokens: z35.number(),
232352
+ missTokens: z35.number(),
232353
+ inputTokens: z35.number(),
232354
+ hitRate: z35.number(),
232355
+ degraded: z35.boolean()
232158
232356
  })
232159
232357
  });
232160
- var ModelRoutingEventSchema = z34.object({
232161
- type: z34.literal("model_routing"),
232162
- payload: z34.object({
232163
- model: z34.string(),
232164
- lane: z34.enum(["locked", "fallback", "fast", "balanced", "quality"]),
232165
- reason: z34.string(),
232166
- confidence: z34.enum(["high", "medium"])
232358
+ var ModelRoutingEventSchema = z35.object({
232359
+ type: z35.literal("model_routing"),
232360
+ payload: z35.object({
232361
+ model: z35.string(),
232362
+ lane: z35.enum(["locked", "fallback", "fast", "balanced", "quality"]),
232363
+ reason: z35.string(),
232364
+ confidence: z35.enum(["high", "medium"])
232167
232365
  })
232168
232366
  });
232169
- var ToolProposalEventSchema = z34.object({
232170
- type: z34.literal("tool_proposal"),
232171
- payload: z34.object({
232172
- toolCallId: z34.string().optional(),
232173
- toolName: z34.string(),
232174
- arguments: z34.unknown(),
232175
- explanation: z34.string().optional()
232367
+ var ToolProposalEventSchema = z35.object({
232368
+ type: z35.literal("tool_proposal"),
232369
+ payload: z35.object({
232370
+ toolCallId: z35.string().optional(),
232371
+ toolName: z35.string(),
232372
+ arguments: z35.unknown(),
232373
+ explanation: z35.string().optional()
232176
232374
  })
232177
232375
  });
232178
- var ToolApprovalEventSchema = z34.object({
232179
- type: z34.literal("tool_approval"),
232180
- payload: z34.object({
232181
- toolCallId: z34.string().optional(),
232182
- approved: z34.boolean(),
232183
- reason: z34.string().optional()
232376
+ var ToolApprovalEventSchema = z35.object({
232377
+ type: z35.literal("tool_approval"),
232378
+ payload: z35.object({
232379
+ toolCallId: z35.string().optional(),
232380
+ approved: z35.boolean(),
232381
+ reason: z35.string().optional()
232184
232382
  })
232185
232383
  });
232186
- var ToolResultEventSchema = z34.object({
232187
- type: z34.literal("tool_result"),
232188
- payload: z34.object({
232189
- toolCallId: z34.string().optional(),
232190
- toolName: z34.string(),
232191
- result: z34.unknown().optional(),
232192
- error: z34.string().optional()
232384
+ var ToolResultEventSchema = z35.object({
232385
+ type: z35.literal("tool_result"),
232386
+ payload: z35.object({
232387
+ toolCallId: z35.string().optional(),
232388
+ toolName: z35.string(),
232389
+ result: z35.unknown().optional(),
232390
+ error: z35.string().optional()
232193
232391
  })
232194
232392
  });
232195
- var WebApprovalRequestedEventSchema = z34.object({
232196
- type: z34.literal("web_approval_requested"),
232197
- payload: z34.object({
232198
- approvalId: z34.string(),
232199
- kind: z34.enum(["tool", "change", "action"]),
232200
- title: z34.string(),
232201
- toolCallId: z34.string().optional()
232393
+ var WebApprovalRequestedEventSchema = z35.object({
232394
+ type: z35.literal("web_approval_requested"),
232395
+ payload: z35.object({
232396
+ approvalId: z35.string(),
232397
+ kind: z35.enum(["tool", "change", "action"]),
232398
+ title: z35.string(),
232399
+ toolCallId: z35.string().optional()
232202
232400
  })
232203
232401
  });
232204
- var WebApprovalResolvedEventSchema = z34.object({
232205
- type: z34.literal("web_approval_resolved"),
232206
- payload: z34.object({
232207
- approvalId: z34.string(),
232208
- approved: z34.boolean()
232402
+ var WebApprovalResolvedEventSchema = z35.object({
232403
+ type: z35.literal("web_approval_resolved"),
232404
+ payload: z35.object({
232405
+ approvalId: z35.string(),
232406
+ approved: z35.boolean()
232209
232407
  })
232210
232408
  });
232211
- var FileChangeEventSchema = z34.object({
232212
- type: z34.literal("file_change"),
232213
- payload: z34.object({
232214
- filePath: z34.string(),
232215
- type: z34.enum(["write", "edit", "create", "delete"]),
232216
- explanation: z34.string().optional()
232409
+ var FileChangeEventSchema = z35.object({
232410
+ type: z35.literal("file_change"),
232411
+ payload: z35.object({
232412
+ filePath: z35.string(),
232413
+ type: z35.enum(["write", "edit", "create", "delete"]),
232414
+ explanation: z35.string().optional()
232217
232415
  })
232218
232416
  });
232219
- var CheckpointCreatedEventSchema = z34.object({
232220
- type: z34.literal("checkpoint_created"),
232221
- payload: z34.object({
232222
- checkpointId: z34.string(),
232223
- timestamp: z34.string(),
232224
- message: z34.string().optional()
232417
+ var CheckpointCreatedEventSchema = z35.object({
232418
+ type: z35.literal("checkpoint_created"),
232419
+ payload: z35.object({
232420
+ checkpointId: z35.string(),
232421
+ timestamp: z35.string(),
232422
+ message: z35.string().optional()
232225
232423
  })
232226
232424
  });
232227
- var VerificationStartedEventSchema = z34.object({
232228
- type: z34.literal("verification_started"),
232229
- payload: z34.object({
232230
- type: z34.string()
232425
+ var VerificationStartedEventSchema = z35.object({
232426
+ type: z35.literal("verification_started"),
232427
+ payload: z35.object({
232428
+ type: z35.string()
232231
232429
  })
232232
232430
  });
232233
- var VerificationEndedEventSchema = z34.object({
232234
- type: z34.literal("verification_ended"),
232235
- payload: z34.object({
232236
- success: z34.boolean(),
232237
- results: z34.unknown().optional()
232431
+ var VerificationEndedEventSchema = z35.object({
232432
+ type: z35.literal("verification_ended"),
232433
+ payload: z35.object({
232434
+ success: z35.boolean(),
232435
+ results: z35.unknown().optional()
232238
232436
  })
232239
232437
  });
232240
- var SessionForkEventSchema = z34.object({
232241
- type: z34.literal("session_fork"),
232242
- payload: z34.object({
232243
- parentSessionId: z34.string(),
232244
- childSessionId: z34.string()
232438
+ var SessionForkEventSchema = z35.object({
232439
+ type: z35.literal("session_fork"),
232440
+ payload: z35.object({
232441
+ parentSessionId: z35.string(),
232442
+ childSessionId: z35.string()
232245
232443
  })
232246
232444
  });
232247
- var SessionEndedEventSchema = z34.object({
232248
- type: z34.literal("session_ended"),
232249
- payload: z34.object({
232250
- sessionId: z34.string()
232445
+ var SessionEndedEventSchema = z35.object({
232446
+ type: z35.literal("session_ended"),
232447
+ payload: z35.object({
232448
+ sessionId: z35.string()
232251
232449
  })
232252
232450
  });
232253
- var InfoEventSchema = z34.object({
232254
- type: z34.literal("info"),
232255
- payload: z34.object({
232256
- message: z34.string()
232451
+ var InfoEventSchema = z35.object({
232452
+ type: z35.literal("info"),
232453
+ payload: z35.object({
232454
+ message: z35.string()
232257
232455
  })
232258
232456
  });
232259
- var WarningEventSchema = z34.object({
232260
- type: z34.literal("warning"),
232261
- payload: z34.object({
232262
- message: z34.string()
232457
+ var WarningEventSchema = z35.object({
232458
+ type: z35.literal("warning"),
232459
+ payload: z35.object({
232460
+ message: z35.string()
232263
232461
  })
232264
232462
  });
232265
- var ErrorEventSchema = z34.object({
232266
- type: z34.literal("error"),
232267
- payload: z34.object({
232268
- message: z34.string(),
232269
- stack: z34.string().optional()
232463
+ var ErrorEventSchema = z35.object({
232464
+ type: z35.literal("error"),
232465
+ payload: z35.object({
232466
+ message: z35.string(),
232467
+ stack: z35.string().optional()
232270
232468
  })
232271
232469
  });
232272
- var OrbitEventSchema = z34.discriminatedUnion("type", [
232470
+ var OrbitEventSchema = z35.discriminatedUnion("type", [
232273
232471
  ModelRequestEventSchema,
232274
232472
  ModelResponseEventSchema,
232275
232473
  AgentStartEventSchema,
@@ -232299,10 +232497,10 @@ var OrbitEventSchema = z34.discriminatedUnion("type", [
232299
232497
  WarningEventSchema,
232300
232498
  ErrorEventSchema
232301
232499
  ]);
232302
- var OrbitEventEnvelopeSchema = z34.object({
232303
- schemaVersion: z34.literal(ORBIT_EVENT_SCHEMA_VERSION),
232304
- eventId: z34.string().min(1),
232305
- timestamp: z34.string().datetime()
232500
+ var OrbitEventEnvelopeSchema = z35.object({
232501
+ schemaVersion: z35.literal(ORBIT_EVENT_SCHEMA_VERSION),
232502
+ eventId: z35.string().min(1),
232503
+ timestamp: z35.string().datetime()
232306
232504
  }).and(OrbitEventSchema);
232307
232505
  var EventBus = class extends EventEmitter {
232308
232506
  sequence = 0;
@@ -235389,7 +235587,7 @@ ${diff.substring(0, 2e4)}`
235389
235587
  output: 'Unsafe hook placeholder "{file}" is no longer supported. Read the ORBIT_FILE environment variable instead.'
235390
235588
  };
235391
235589
  }
235392
- const toolCallId = `hook_${randomUUID32()}`;
235590
+ const toolCallId = `hook_${randomUUID33()}`;
235393
235591
  eventBus.emitEvent("tool_proposal", {
235394
235592
  toolCallId,
235395
235593
  toolName: "hook",
@@ -235503,7 +235701,7 @@ ${diff.substring(0, 2e4)}`
235503
235701
  const now = (/* @__PURE__ */ new Date()).toISOString();
235504
235702
  const plan = this.sessionManager.getTaskPlan();
235505
235703
  const item = {
235506
- id: `step_${randomUUID32()}`,
235704
+ id: `step_${randomUUID33()}`,
235507
235705
  text: text.trim(),
235508
235706
  status: "pending",
235509
235707
  createdAt: now,
@@ -236299,6 +236497,90 @@ function abortError(signal) {
236299
236497
  function toError2(error) {
236300
236498
  return error instanceof Error ? error : new Error(String(error));
236301
236499
  }
236500
+ var AgentRunTracker = class {
236501
+ constructor(cwd, task, budgetUsd, warn) {
236502
+ this.cwd = cwd;
236503
+ this.task = task;
236504
+ this.budgetUsd = budgetUsd;
236505
+ this.warn = warn;
236506
+ }
236507
+ cwd;
236508
+ task;
236509
+ budgetUsd;
236510
+ warn;
236511
+ store;
236512
+ run;
236513
+ initialize() {
236514
+ try {
236515
+ const store = new AgentRunStore(this.cwd);
236516
+ store.initialize();
236517
+ this.store = store;
236518
+ this.run = store.createRun({
236519
+ task: this.task,
236520
+ budgetUsd: this.budgetUsd
236521
+ });
236522
+ } catch (error) {
236523
+ this.warn(`Agent run state will be memory-only: ${errorMessage(error)}`);
236524
+ }
236525
+ }
236526
+ add(input) {
236527
+ if (!this.store || !this.run) return void 0;
236528
+ try {
236529
+ return this.store.addAgent(this.run.id, {
236530
+ role: input.role,
236531
+ task: input.task,
236532
+ model: input.model,
236533
+ budgetUsd: this.budgetUsd * input.budgetFraction,
236534
+ access: { mode: input.mode, scopes: input.scopes }
236535
+ });
236536
+ } catch (error) {
236537
+ this.warn(
236538
+ `Failed to persist ${input.role} state: ${errorMessage(error)}`
236539
+ );
236540
+ return void 0;
236541
+ }
236542
+ }
236543
+ markRunning(agent) {
236544
+ this.update(agent, {
236545
+ status: "running",
236546
+ startedAt: (/* @__PURE__ */ new Date()).toISOString()
236547
+ });
236548
+ }
236549
+ markFinished(agent, costUsd, outcome) {
236550
+ this.update(agent, {
236551
+ status: outcome.status === "completed" ? "completed" : outcome.status === "aborted" ? "aborted" : "failed",
236552
+ costUsd,
236553
+ endedAt: (/* @__PURE__ */ new Date()).toISOString(),
236554
+ error: outcome.status === "failed" ? outcome.error.message : outcome.status === "aborted" ? outcome.message : void 0
236555
+ });
236556
+ }
236557
+ markFailed(agent, costUsd, error) {
236558
+ this.update(agent, {
236559
+ status: "failed",
236560
+ costUsd,
236561
+ endedAt: (/* @__PURE__ */ new Date()).toISOString(),
236562
+ error: errorMessage(error)
236563
+ });
236564
+ }
236565
+ finish(outcome) {
236566
+ if (!this.store || !this.run) return;
236567
+ const status = outcome.status === "completed" ? "completed" : outcome.status === "aborted" ? "aborted" : "failed";
236568
+ try {
236569
+ this.run = this.store.finishRun(this.run.id, status);
236570
+ } catch {
236571
+ }
236572
+ }
236573
+ update(agent, patch) {
236574
+ if (!agent || !this.store || !this.run) return;
236575
+ try {
236576
+ this.store.updateAgent(this.run.id, agent.id, patch);
236577
+ } catch {
236578
+ }
236579
+ }
236580
+ };
236581
+ function errorMessage(error) {
236582
+ return error instanceof Error ? error.message : String(error);
236583
+ }
236302
236584
  var ReviewVerdictSchema = z93.object({
236303
236585
  verdict: z93.enum(["approved", "rejected"]),
236304
236586
  feedback: z93.string().default("")
@@ -236310,19 +236592,33 @@ var Orchestrator = class {
236310
236592
  this.provider = provider;
236311
236593
  this.task = task;
236312
236594
  this.interaction = interaction;
236595
+ this.agentRunTracker = new AgentRunTracker(
236596
+ cwd,
236597
+ task,
236598
+ config.budgetLimit,
236599
+ (message) => this.interaction.showText(` \u26A0\uFE0F ${message}`)
236600
+ );
236313
236601
  }
236314
236602
  cwd;
236315
236603
  config;
236316
236604
  provider;
236317
236605
  task;
236318
236606
  interaction;
236319
- activeLoops = /* @__PURE__ */ new Set();
236607
+ activeLoops = /* @__PURE__ */ new Map();
236320
236608
  activeTaskScheduler;
236609
+ agentRunTracker;
236321
236610
  aborted = false;
236322
236611
  abort(mode = "prompt") {
236323
236612
  this.aborted = true;
236324
236613
  this.activeTaskScheduler?.abort("Orchestration was interrupted.");
236325
- for (const loop of this.activeLoops) loop.abort(mode);
236614
+ for (const loop of this.activeLoops.values()) loop.abort(mode);
236615
+ }
236616
+ /** Cancel one active child without discarding unrelated agent state. */
236617
+ abortAgent(agentId) {
236618
+ const loop = this.activeLoops.get(agentId);
236619
+ if (!loop) return false;
236620
+ loop.abort("immediate");
236621
+ return true;
236326
236622
  }
236327
236623
  async run() {
236328
236624
  if (this.aborted) {
@@ -236335,11 +236631,16 @@ var Orchestrator = class {
236335
236631
  taskId: "multi-agent-session",
236336
236632
  task: this.task
236337
236633
  });
236634
+ this.agentRunTracker.initialize();
236338
236635
  this.interaction.showText("\n\u25CF Starting Multi-Agent Orchestration Flow...");
236339
236636
  const planner = await this.runPlanner();
236340
- if (planner.outcome.status !== "completed") return planner.outcome;
236637
+ if (planner.outcome.status !== "completed") {
236638
+ return this.finalizeOutcome(planner.outcome);
236639
+ }
236341
236640
  if (this.aborted) {
236342
- return this.abortedOutcome(0, "Orchestration was interrupted.");
236641
+ return this.finalizeOutcome(
236642
+ this.abortedOutcome(0, "Orchestration was interrupted.")
236643
+ );
236343
236644
  }
236344
236645
  const planText = planner.plan;
236345
236646
  this.persistPlan(planText);
@@ -236356,7 +236657,7 @@ var Orchestrator = class {
236356
236657
  worktree = worktrees.createWorktree(worktreeId, {
236357
236658
  snapshotWorkingTree: true
236358
236659
  });
236359
- if (!existsSync35(worktree.path) || !statSync4(worktree.path).isDirectory()) {
236660
+ if (!existsSync36(worktree.path) || !statSync4(worktree.path).isDirectory()) {
236360
236661
  throw new Error(
236361
236662
  `Worktree manager returned a missing directory: ${worktree.path}`
236362
236663
  );
@@ -236375,7 +236676,7 @@ var Orchestrator = class {
236375
236676
  }
236376
236677
  agentCwd = this.cwd;
236377
236678
  this.interaction.showText(
236378
- ` \u26A0\uFE0F Worktree unavailable; falling back to the main workspace: ${errorMessage(error)}`
236679
+ ` \u26A0\uFE0F Worktree unavailable; falling back to the main workspace: ${errorMessage2(error)}`
236379
236680
  );
236380
236681
  }
236381
236682
  } else {
@@ -236395,10 +236696,14 @@ var Orchestrator = class {
236395
236696
  attempt,
236396
236697
  maxAttempts
236397
236698
  );
236398
- if (coderOutcome.status !== "completed") return coderOutcome;
236699
+ if (coderOutcome.status !== "completed") {
236700
+ return this.finalizeOutcome(coderOutcome);
236701
+ }
236399
236702
  if (this.aborted) break;
236400
236703
  const review = await this.runReviewer(agentCwd, attempt, maxAttempts);
236401
- if (review.outcome.status !== "completed") return review.outcome;
236704
+ if (review.outcome.status !== "completed") {
236705
+ return this.finalizeOutcome(review.outcome);
236706
+ }
236402
236707
  if (review.verdict !== "approved") {
236403
236708
  feedback = review.feedback || "Reviewer rejected the implementation.";
236404
236709
  this.interaction.showText(
@@ -236416,7 +236721,7 @@ var Orchestrator = class {
236416
236721
  mergeFailed = true;
236417
236722
  mergeFailureMessage = mergeResult.error || mergeResult.conflictFiles?.join(", ") || "unknown merge error";
236418
236723
  this.interaction.showText(
236419
- ` \u2716 Merge failed; worktree was preserved at ${worktree.path}: ${errorMessage(mergeFailureMessage)}`
236724
+ ` \u2716 Merge failed; worktree was preserved at ${worktree.path}: ${errorMessage2(mergeFailureMessage)}`
236420
236725
  );
236421
236726
  break;
236422
236727
  }
@@ -236436,7 +236741,7 @@ var Orchestrator = class {
236436
236741
  worktrees.discardWorktree(worktree);
236437
236742
  } catch (error) {
236438
236743
  this.interaction.showText(
236439
- ` \u26A0\uFE0F Failed to clean temporary worktree: ${errorMessage(error)}`
236744
+ ` \u26A0\uFE0F Failed to clean temporary worktree: ${errorMessage2(error)}`
236440
236745
  );
236441
236746
  }
236442
236747
  }
@@ -236448,27 +236753,39 @@ var Orchestrator = class {
236448
236753
  );
236449
236754
  }
236450
236755
  if (completed) {
236451
- return {
236756
+ return this.finalizeOutcome({
236452
236757
  status: "completed",
236453
236758
  sessionId: "multi-agent-session",
236454
236759
  attempts: completedAttempts
236455
- };
236760
+ });
236456
236761
  }
236457
236762
  if (this.aborted) {
236458
- return this.abortedOutcome(
236459
- completedAttempts,
236460
- "Orchestration was interrupted."
236763
+ return this.finalizeOutcome(
236764
+ this.abortedOutcome(
236765
+ completedAttempts,
236766
+ "Orchestration was interrupted."
236767
+ )
236461
236768
  );
236462
236769
  }
236463
- return this.failedOutcome(
236464
- completedAttempts || maxAttempts,
236465
- mergeFailed ? `Failed to merge the reviewed worktree: ${errorMessage(mergeFailureMessage)}` : `Orchestration stopped after ${maxAttempts} rejected review attempts.`
236770
+ return this.finalizeOutcome(
236771
+ this.failedOutcome(
236772
+ completedAttempts || maxAttempts,
236773
+ mergeFailed ? `Failed to merge the reviewed worktree: ${errorMessage2(mergeFailureMessage)}` : `Orchestration stopped after ${maxAttempts} rejected review attempts.`
236774
+ )
236466
236775
  );
236467
236776
  }
236468
236777
  async runPlanner() {
236469
236778
  this.interaction.showText(
236470
236779
  "\n[Phase 1: Planning] Initializing Planner Agent..."
236471
236780
  );
236781
+ const tracked = this.addTrackedAgent(
236782
+ "planner",
236783
+ `Plan: ${this.task}`,
236784
+ this.config.models.planner,
236785
+ 0.15,
236786
+ "read",
236787
+ ["workspace"]
236788
+ );
236472
236789
  const loop = AgentLoop.initialize(
236473
236790
  this.cwd,
236474
236791
  this.config,
@@ -236493,15 +236810,22 @@ Do not modify files. Return the plan as plain text.`,
236493
236810
  disableMcp: true
236494
236811
  }
236495
236812
  );
236496
- this.activeLoops.add(loop);
236813
+ const activeId = tracked?.id || "planner";
236814
+ this.activeLoops.set(activeId, loop);
236815
+ this.markAgentRunning(tracked);
236816
+ let outcome;
236497
236817
  try {
236498
- const outcome = await loop.run();
236818
+ outcome = await loop.run();
236499
236819
  return {
236500
236820
  plan: lastAssistantText(loop) || "No plan generated.",
236501
236821
  outcome
236502
236822
  };
236823
+ } catch (error) {
236824
+ this.markAgentFailed(tracked, loop, error);
236825
+ throw error;
236503
236826
  } finally {
236504
- this.activeLoops.delete(loop);
236827
+ if (outcome) this.markAgentFinished(tracked, loop, outcome);
236828
+ this.activeLoops.delete(activeId);
236505
236829
  }
236506
236830
  }
236507
236831
  async runCoder(cwd, plan, feedback, attempt, maxAttempts) {
@@ -236515,6 +236839,14 @@ ${feedback}
236515
236839
  Original plan:
236516
236840
  ${plan}` : `Implement the following plan:
236517
236841
  ${plan}`;
236842
+ const tracked = this.addTrackedAgent(
236843
+ `coder:${attempt}`,
236844
+ prompt,
236845
+ this.config.models.coder,
236846
+ 0.45 / maxAttempts,
236847
+ "write",
236848
+ ["workspace"]
236849
+ );
236518
236850
  const loop = AgentLoop.initialize(
236519
236851
  cwd,
236520
236852
  this.config,
@@ -236538,11 +236870,19 @@ Make precise changes in the current isolated workspace. Do not commit or merge.`
236538
236870
  disableMcp: true
236539
236871
  }
236540
236872
  );
236541
- this.activeLoops.add(loop);
236873
+ const activeId = tracked?.id || `coder-${attempt}`;
236874
+ this.activeLoops.set(activeId, loop);
236875
+ this.markAgentRunning(tracked);
236876
+ let outcome;
236542
236877
  try {
236543
- return await loop.run();
236878
+ outcome = await loop.run();
236879
+ return outcome;
236880
+ } catch (error) {
236881
+ this.markAgentFailed(tracked, loop, error);
236882
+ throw error;
236544
236883
  } finally {
236545
- this.activeLoops.delete(loop);
236884
+ if (outcome) this.markAgentFinished(tracked, loop, outcome);
236885
+ this.activeLoops.delete(activeId);
236546
236886
  }
236547
236887
  }
236548
236888
  async runReviewer(cwd, attempt, maxAttempts) {
@@ -236565,6 +236905,7 @@ Make precise changes in the current isolated workspace. Do not commit or merge.`
236565
236905
  cwd,
236566
236906
  "correctness",
236567
236907
  "Review correctness, regressions, tests, and verification evidence.",
236908
+ maxAttempts,
236568
236909
  signal
236569
236910
  )
236570
236911
  },
@@ -236576,6 +236917,7 @@ Make precise changes in the current isolated workspace. Do not commit or merge.`
236576
236917
  cwd,
236577
236918
  "security",
236578
236919
  "Review security, workspace boundaries, credential handling, and destructive edge cases.",
236920
+ maxAttempts,
236579
236921
  signal
236580
236922
  )
236581
236923
  }
@@ -236621,8 +236963,16 @@ Make precise changes in the current isolated workspace. Do not commit or merge.`
236621
236963
  )
236622
236964
  );
236623
236965
  }
236624
- async runReviewerPerspective(cwd, perspective, instruction, signal) {
236625
- const childId = generateId(`review-${perspective}`);
236966
+ async runReviewerPerspective(cwd, perspective, instruction, maxAttempts, signal) {
236967
+ const tracked = this.addTrackedAgent(
236968
+ `reviewer:${perspective}`,
236969
+ instruction,
236970
+ this.config.models.reviewer,
236971
+ 0.2 / maxAttempts,
236972
+ "read",
236973
+ ["workspace"]
236974
+ );
236975
+ const childId = tracked?.id || generateId(`review-${perspective}`);
236626
236976
  eventBus.emitEvent("agent_spawn", {
236627
236977
  parentId: "multi-agent-session",
236628
236978
  childId,
@@ -236657,9 +237007,11 @@ Your final response must be one JSON object with this exact shape:
236657
237007
  const abortLoop = () => loop.abort("immediate");
236658
237008
  if (signal?.aborted) abortLoop();
236659
237009
  signal?.addEventListener("abort", abortLoop, { once: true });
236660
- this.activeLoops.add(loop);
237010
+ this.activeLoops.set(childId, loop);
237011
+ this.markAgentRunning(tracked);
237012
+ let outcome;
236661
237013
  try {
236662
- const outcome = await loop.run();
237014
+ outcome = await loop.run();
236663
237015
  eventBus.emitEvent("agent_completed", {
236664
237016
  taskId: childId,
236665
237017
  success: outcome.status === "completed",
@@ -236667,17 +237019,42 @@ Your final response must be one JSON object with this exact shape:
236667
237019
  });
236668
237020
  return { ...parseReviewVerdict(lastAssistantText(loop)), outcome };
236669
237021
  } catch (error) {
237022
+ this.markAgentFailed(tracked, loop, error);
236670
237023
  eventBus.emitEvent("agent_completed", {
236671
237024
  taskId: childId,
236672
237025
  success: false,
236673
- error: errorMessage(error)
237026
+ error: errorMessage2(error)
236674
237027
  });
236675
237028
  throw error;
236676
237029
  } finally {
237030
+ if (outcome) this.markAgentFinished(tracked, loop, outcome);
236677
237031
  signal?.removeEventListener("abort", abortLoop);
236678
- this.activeLoops.delete(loop);
237032
+ this.activeLoops.delete(childId);
236679
237033
  }
236680
237034
  }
237035
+ addTrackedAgent(role, task, model, budgetFraction, mode, scopes) {
237036
+ return this.agentRunTracker.add({
237037
+ role,
237038
+ task,
237039
+ model,
237040
+ budgetFraction,
237041
+ mode,
237042
+ scopes
237043
+ });
237044
+ }
237045
+ markAgentRunning(agent) {
237046
+ this.agentRunTracker.markRunning(agent);
237047
+ }
237048
+ markAgentFinished(agent, loop, outcome) {
237049
+ this.agentRunTracker.markFinished(agent, loop.getSessionCost(), outcome);
237050
+ }
237051
+ markAgentFailed(agent, loop, error) {
237052
+ this.agentRunTracker.markFailed(agent, loop.getSessionCost(), error);
237053
+ }
237054
+ finalizeOutcome(outcome) {
237055
+ this.agentRunTracker.finish(outcome);
237056
+ return outcome;
237057
+ }
236681
237058
  abortedOutcome(attempts, message) {
236682
237059
  return {
236683
237060
  status: "aborted",
@@ -236694,7 +237071,7 @@ Your final response must be one JSON object with this exact shape:
236694
237071
  attempts,
236695
237072
  error: {
236696
237073
  code: "execution_error",
236697
- message: errorMessage(message)
237074
+ message: errorMessage2(message)
236698
237075
  }
236699
237076
  };
236700
237077
  }
@@ -236706,7 +237083,7 @@ Your final response must be one JSON object with this exact shape:
236706
237083
  this.interaction.showText(" \u2714 Plan saved to .orbit/task.md");
236707
237084
  } catch (error) {
236708
237085
  this.interaction.showText(
236709
- ` \u26A0\uFE0F Failed to persist plan: ${errorMessage(error)}`
237086
+ ` \u26A0\uFE0F Failed to persist plan: ${errorMessage2(error)}`
236710
237087
  );
236711
237088
  }
236712
237089
  }
@@ -236733,11 +237110,11 @@ function parseReviewVerdict(text) {
236733
237110
  } catch (error) {
236734
237111
  return {
236735
237112
  verdict: "rejected",
236736
- feedback: `Invalid reviewer JSON: ${errorMessage(error)}`
237113
+ feedback: `Invalid reviewer JSON: ${errorMessage2(error)}`
236737
237114
  };
236738
237115
  }
236739
237116
  }
236740
- function errorMessage(error) {
237117
+ function errorMessage2(error) {
236741
237118
  const raw = error instanceof Error ? error.message : String(error);
236742
237119
  return redactSecrets(raw).replace(/[\u0000-\u001f\u007f-\u009f]/g, " ").replace(/\s+/g, " ").trim().slice(0, 2e3);
236743
237120
  }
@@ -237301,6 +237678,16 @@ var SLASH_COMMAND_DEFINITIONS = [
237301
237678
  },
237302
237679
  webSuggested: true
237303
237680
  },
237681
+ {
237682
+ command: "/review",
237683
+ usage: "[preset|commit <ref>|branch <ref>|custom <policy>]",
237684
+ category: "git",
237685
+ description: {
237686
+ en: "Run an evidence-first code review with focused presets",
237687
+ zh: "\u4F7F\u7528\u4E13\u9879\u9884\u8BBE\u6267\u884C\u57FA\u4E8E\u8BC1\u636E\u7684\u4EE3\u7801\u5BA1\u67E5"
237688
+ },
237689
+ webSuggested: true
237690
+ },
237304
237691
  {
237305
237692
  command: "/exit",
237306
237693
  usage: "",
@@ -238306,13 +238693,13 @@ function renderPromptScreen(state, viewport, theme = MORANDI) {
238306
238693
 
238307
238694
  // src/runtime/UpdateManager.ts
238308
238695
  import { execFile as execFile4, execFileSync as execFileSync4 } from "child_process";
238309
- import { z as z35 } from "zod";
238310
- var SemanticVersionSchema = z35.string().trim().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/);
238311
- var UpdateChannelSchema = z35.enum(["stable", "beta"]);
238312
- var UpdateCheckSchema = z35.object({
238696
+ import { z as z36 } from "zod";
238697
+ var SemanticVersionSchema = z36.string().trim().regex(/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/);
238698
+ var UpdateChannelSchema = z36.enum(["stable", "beta"]);
238699
+ var UpdateCheckSchema = z36.object({
238313
238700
  currentVersion: SemanticVersionSchema,
238314
238701
  latestVersion: SemanticVersionSchema,
238315
- updateAvailable: z35.boolean()
238702
+ updateAvailable: z36.boolean()
238316
238703
  });
238317
238704
  var UpdateManager = class {
238318
238705
  executable;
@@ -238396,9 +238783,9 @@ var UpdateManager = class {
238396
238783
  ],
238397
238784
  { timeoutMs: this.timeoutMs, inheritOutput: false }
238398
238785
  );
238399
- const parsed = z35.object({
238400
- dependencies: z35.object({
238401
- "@orbit-build/cli": z35.object({ version: SemanticVersionSchema })
238786
+ const parsed = z36.object({
238787
+ dependencies: z36.object({
238788
+ "@orbit-build/cli": z36.object({ version: SemanticVersionSchema })
238402
238789
  })
238403
238790
  }).parse(JSON.parse(raw));
238404
238791
  return parsed.dependencies["@orbit-build/cli"].version;
@@ -240689,7 +241076,7 @@ import { dirname as dirname10, resolve as resolve10 } from "path";
240689
241076
  import { homedir as homedir10 } from "os";
240690
241077
  import http2 from "http";
240691
241078
  import { randomBytes as randomBytes2, randomUUID as randomUUID9, timingSafeEqual as timingSafeEqual2 } from "crypto";
240692
- import { z as z48 } from "zod";
241079
+ import { z as z50 } from "zod";
240693
241080
 
240694
241081
  // src/runtime/CommandRouter.ts
240695
241082
  import picocolors18 from "picocolors";
@@ -240699,11 +241086,11 @@ import { existsSync as existsSync16, readFileSync as readFileSync19, readdirSync
240699
241086
  import { basename as basename5, extname as extname2, join as join16 } from "path";
240700
241087
  import { homedir as homedir8 } from "os";
240701
241088
  import { parse as parse3 } from "yaml";
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()
241089
+ import { z as z37 } from "zod";
241090
+ var CommandMetadataSchema = z37.object({
241091
+ description: z37.string().max(240).optional(),
241092
+ argumentHint: z37.string().max(120).optional(),
241093
+ "argument-hint": z37.string().max(120).optional()
240707
241094
  });
240708
241095
  var VALID_COMMAND_NAME = /^[a-z0-9][a-z0-9-_]{0,47}$/i;
240709
241096
  var MAX_COMMAND_FILE_BYTES = 256 * 1024;
@@ -240846,20 +241233,20 @@ import { createRequire as createRequire2 } from "module";
240846
241233
  // src/runtime/webui/WebUiRuntime.ts
240847
241234
  import http from "http";
240848
241235
  import { randomBytes, randomUUID as randomUUID7 } from "crypto";
240849
- import { z as z39 } from "zod";
241236
+ import { z as z40 } from "zod";
240850
241237
 
240851
241238
  // src/runtime/AutocompleteCandidates.ts
240852
241239
  import glob6 from "fast-glob";
240853
241240
  import { existsSync as existsSync17, readFileSync as readFileSync20, readdirSync as readdirSync7 } from "fs";
240854
241241
  import { homedir as homedir9 } from "os";
240855
241242
  import { dirname as dirname9, join as join17, resolve as resolve7 } from "path";
240856
- import { z as z37 } from "zod";
240857
- var symbolIndexSchema = z37.object({
240858
- files: z37.record(
240859
- z37.object({
240860
- symbols: z37.array(
240861
- z37.object({
240862
- name: z37.string().min(1)
241243
+ import { z as z38 } from "zod";
241244
+ var symbolIndexSchema = z38.object({
241245
+ files: z38.record(
241246
+ z38.object({
241247
+ symbols: z38.array(
241248
+ z38.object({
241249
+ name: z38.string().min(1)
240863
241250
  })
240864
241251
  ).optional()
240865
241252
  })
@@ -241061,6 +241448,34 @@ var WEB_UI_CLIENT_BINDINGS_SCRIPT = String.raw` elements.composer.addEventListe
241061
241448
  if (!button || state.busy) return;
241062
241449
  void submitTurn('/memory remove ' + button.dataset.memoryRemove);
241063
241450
  });
241451
+ elements.reviewPresets.addEventListener('click', (event) => {
241452
+ const button = event.target.closest('[data-review-preset]');
241453
+ if (!button) return;
241454
+ const command = '/review ' + button.dataset.reviewPreset;
241455
+ setInspector(false);
241456
+ if (state.busy) {
241457
+ queuePrompt(command);
241458
+ return;
241459
+ }
241460
+ void submitTurn(command);
241461
+ });
241462
+ elements.agentRunList.addEventListener('click', async (event) => {
241463
+ const button = event.target.closest('[data-agent-abort]');
241464
+ if (!button || button.disabled) return;
241465
+ button.disabled = true;
241466
+ try {
241467
+ await api('/api/agent', {
241468
+ method: 'POST',
241469
+ headers: { 'Content-Type': 'application/json' },
241470
+ body: JSON.stringify({ action: 'abort', agentId: button.dataset.agentAbort }),
241471
+ });
241472
+ showToast(copy.agentAborted, 'success');
241473
+ await loadStatus();
241474
+ } catch (error) {
241475
+ button.disabled = false;
241476
+ showToast(error.message || String(error), 'error');
241477
+ }
241478
+ });
241064
241479
  elements.changesList.addEventListener('click', (event) => {
241065
241480
  const button = event.target.closest('[data-rollback-file]');
241066
241481
  if (!button) return;
@@ -241990,6 +242405,9 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
241990
242405
  noChanges: '当前对话还没有文件改动。',
241991
242406
  noCheckpoints: '暂无可恢复检查点。',
241992
242407
  noVerification: '暂无验证结果。',
242408
+ noAgents: '当前工作区还没有委派智能体。',
242409
+ abortAgent: '终止智能体',
242410
+ agentAborted: '已发送智能体终止请求',
241993
242411
  queued: '已加入待发送队列',
241994
242412
  queueMessage: '加入队列',
241995
242413
  removeQueued: '移除待发送消息',
@@ -242093,6 +242511,9 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
242093
242511
  noChanges: 'No file changes in this chat.',
242094
242512
  noCheckpoints: 'No restorable checkpoints.',
242095
242513
  noVerification: 'No verification results.',
242514
+ noAgents: 'No delegated agents for this workspace.',
242515
+ abortAgent: 'Abort agent',
242516
+ agentAborted: 'Agent abort requested',
242096
242517
  queued: 'Added to follow-up queue',
242097
242518
  queueMessage: 'Queue message',
242098
242519
  removeQueued: 'Remove queued message',
@@ -242243,6 +242664,9 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
242243
242664
  runtime: byId('runtime'),
242244
242665
  planReview: byId('planReview'),
242245
242666
  planCount: byId('planCount'),
242667
+ agentRunList: byId('agentRunList'),
242668
+ agentRunCount: byId('agentRunCount'),
242669
+ reviewPresets: byId('reviewPresets'),
242246
242670
  memoryReview: byId('memoryReview'),
242247
242671
  memoryCount: byId('memoryCount'),
242248
242672
  toolHistory: byId('toolHistory'),
@@ -243842,10 +244266,63 @@ var WEB_UI_CLIENT_SESSION_SCRIPT = String.raw` const controlCommands = ${WEB_UI
243842
244266
  elements.contextMeter.title = meterDetail;
243843
244267
  elements.contextMeter.setAttribute('aria-label', copy.contextWindow + ': ' + meterDetail);
243844
244268
  renderWorkspaceState(data);
244269
+ renderAgentRuns(data.agentRuns);
243845
244270
  renderChangeReview(data.review || {});
243846
244271
  renderToolHistory(data.review || {});
243847
244272
  }
243848
244273
 
244274
+ function renderAgentRuns(value) {
244275
+ const runs = Array.isArray(value) ? value : [];
244276
+ const agents = runs.flatMap((run) =>
244277
+ (Array.isArray(run.agents) ? run.agents : []).map((agent) => ({
244278
+ ...agent,
244279
+ runStatus: run.status,
244280
+ })),
244281
+ );
244282
+ elements.agentRunCount.textContent = String(agents.length);
244283
+ elements.agentRunList.replaceChildren();
244284
+ if (!agents.length) {
244285
+ const empty = document.createElement('p');
244286
+ empty.className = 'review-empty';
244287
+ empty.textContent = copy.noAgents;
244288
+ elements.agentRunList.append(empty);
244289
+ return;
244290
+ }
244291
+ for (const agent of agents.slice(0, 24)) {
244292
+ const card = document.createElement('article');
244293
+ card.className = 'agent-card is-' + String(agent.status || 'pending');
244294
+ const heading = document.createElement('div');
244295
+ heading.className = 'agent-card-heading';
244296
+ const title = document.createElement('strong');
244297
+ title.textContent = agent.role || 'agent';
244298
+ const status = document.createElement('span');
244299
+ status.className = 'agent-status';
244300
+ status.textContent = agent.status || 'pending';
244301
+ heading.append(title, status);
244302
+ const task = document.createElement('p');
244303
+ task.textContent = agent.task || '';
244304
+ task.title = agent.task || '';
244305
+ const meta = document.createElement('div');
244306
+ meta.className = 'agent-meta';
244307
+ meta.textContent = [
244308
+ agent.model,
244309
+ agent.access,
244310
+ '$' + Number(agent.costUsd || 0).toFixed(4) + ' / $' + Number(agent.budgetUsd || 0).toFixed(2),
244311
+ ].filter(Boolean).join(' · ');
244312
+ card.append(heading, task, meta);
244313
+ if (agent.status === 'running') {
244314
+ const abort = document.createElement('button');
244315
+ abort.type = 'button';
244316
+ abort.className = 'agent-abort';
244317
+ abort.dataset.agentAbort = agent.id;
244318
+ abort.textContent = copy.abortAgent;
244319
+ abort.setAttribute('aria-label', copy.abortAgent + ': ' + (agent.role || 'agent'));
244320
+ card.append(abort);
244321
+ }
244322
+ elements.agentRunList.append(card);
244323
+ }
244324
+ }
244325
+
243849
244326
  function renderToolHistory(review) {
243850
244327
  const tools = Array.isArray(review.toolCalls) ? review.toolCalls : [];
243851
244328
  elements.toolHistoryCount.textContent = String(tools.length);
@@ -245054,7 +245531,7 @@ var WEB_UI_FAVICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4
245054
245531
 
245055
245532
  // src/runtime/webui/WebUiSecurity.ts
245056
245533
  import { timingSafeEqual } from "crypto";
245057
- import { z as z38 } from "zod";
245534
+ import { z as z39 } from "zod";
245058
245535
  function sanitizeWebEventPayload(type, payload) {
245059
245536
  if (!isRecord3(payload)) return void 0;
245060
245537
  switch (type) {
@@ -245247,7 +245724,7 @@ function sanitizeBaseUrl(value) {
245247
245724
  }
245248
245725
  }
245249
245726
  function webRequestErrorStatus(error) {
245250
- if (error instanceof z38.ZodError) return 400;
245727
+ if (error instanceof z39.ZodError) return 400;
245251
245728
  if (error instanceof Error && error.message === "Request body too large.") {
245252
245729
  return 413;
245253
245730
  }
@@ -245308,6 +245785,71 @@ function isRecord3(value) {
245308
245785
  return typeof value === "object" && value !== null;
245309
245786
  }
245310
245787
 
245788
+ // src/runtime/webui/WebUiAgentData.ts
245789
+ function summarizeWebUiAgentRuns(value) {
245790
+ if (!Array.isArray(value)) return [];
245791
+ return value.slice(0, 12).flatMap((candidate) => {
245792
+ if (!isRecord4(candidate) || !Array.isArray(candidate.agents)) return [];
245793
+ const id = boundedString(candidate.id, 128);
245794
+ if (!/^run_[a-z0-9-]+$/.test(id)) return [];
245795
+ return [
245796
+ {
245797
+ id,
245798
+ task: redactSecrets(boundedString(candidate.task, 2e3)),
245799
+ status: boundedEnum(candidate.status, [
245800
+ "running",
245801
+ "completed",
245802
+ "failed",
245803
+ "aborted"
245804
+ ]),
245805
+ budgetUsd: finiteNumber(candidate.budgetUsd),
245806
+ costUsd: finiteNumber(candidate.costUsd),
245807
+ updatedAt: boundedString(candidate.updatedAt, 64),
245808
+ agents: candidate.agents.slice(0, 64).flatMap((agent) => {
245809
+ if (!isRecord4(agent)) return [];
245810
+ const agentId = boundedString(agent.id, 128);
245811
+ if (!/^agent_[a-z0-9-]+$/.test(agentId)) return [];
245812
+ return [
245813
+ {
245814
+ id: agentId,
245815
+ role: redactSecrets(boundedString(agent.role, 80)),
245816
+ task: redactSecrets(boundedString(agent.task, 1e3)),
245817
+ status: boundedEnum(agent.status, [
245818
+ "pending",
245819
+ "running",
245820
+ "completed",
245821
+ "failed",
245822
+ "aborted",
245823
+ "blocked"
245824
+ ]),
245825
+ model: redactSecrets(boundedString(agent.model, 200)),
245826
+ budgetUsd: finiteNumber(agent.budgetUsd),
245827
+ costUsd: finiteNumber(agent.costUsd),
245828
+ access: isRecord4(agent.access) && agent.access.mode === "write" ? "write" : "read",
245829
+ scopes: isRecord4(agent.access) && Array.isArray(agent.access.scopes) ? agent.access.scopes.slice(0, 20).map((scope) => redactSecrets(boundedString(scope, 300))) : [],
245830
+ startedAt: boundedString(agent.startedAt, 64),
245831
+ endedAt: boundedString(agent.endedAt, 64),
245832
+ error: redactSecrets(boundedString(agent.error, 1e3))
245833
+ }
245834
+ ];
245835
+ })
245836
+ }
245837
+ ];
245838
+ });
245839
+ }
245840
+ function finiteNumber(value) {
245841
+ return typeof value === "number" && Number.isFinite(value) ? value : 0;
245842
+ }
245843
+ function boundedString(value, maxLength) {
245844
+ return typeof value === "string" ? value.slice(0, maxLength) : "";
245845
+ }
245846
+ function boundedEnum(value, values) {
245847
+ return typeof value === "string" && values.includes(value) ? value : "unknown";
245848
+ }
245849
+ function isRecord4(value) {
245850
+ return typeof value === "object" && value !== null;
245851
+ }
245852
+
245311
245853
  // src/runtime/webui/WebUiData.ts
245312
245854
  function filterWebUiCompletionFiles(files, rawQuery, limit = 60) {
245313
245855
  const query = rawQuery.trim().toLocaleLowerCase();
@@ -245331,7 +245873,7 @@ function summarizeWebUiContextFiles(value, limit = 24) {
245331
245873
  const seen = /* @__PURE__ */ new Set();
245332
245874
  if (Array.isArray(value)) {
245333
245875
  for (const candidate of value) {
245334
- if (!isRecord4(candidate)) continue;
245876
+ if (!isRecord5(candidate)) continue;
245335
245877
  const path6 = normalizeSafeWebUiPath(candidate.path);
245336
245878
  if (!path6 || seen.has(path6)) continue;
245337
245879
  seen.add(path6);
@@ -245398,9 +245940,13 @@ function collectWebUiStatus(options, activeTurn) {
245398
245940
  lastOpenedAt: typeof project.lastOpenedAt === "string" ? project.lastOpenedAt.slice(0, 64) : "",
245399
245941
  available: project.available === true
245400
245942
  }));
245943
+ const agentRuns = summarizeWebUiAgentRuns(
245944
+ safeCall(() => options.getAgentRuns?.()) || []
245945
+ );
245401
245946
  return {
245402
245947
  workspace: cwd,
245403
245948
  projects,
245949
+ agentRuns,
245404
245950
  provider: {
245405
245951
  id: providerId,
245406
245952
  type: provider.type || "unknown",
@@ -245485,12 +246031,12 @@ function collectWebUiStatus(options, activeTurn) {
245485
246031
  maxFiles: config.context.maxFilesToIndex,
245486
246032
  compactThreshold: config.context.compactThreshold,
245487
246033
  model: contextStatus?.model || activeModel2,
245488
- maxContextTokens: finiteNumber(contextStatus?.maxContextTokens),
245489
- compactAtTokens: finiteNumber(contextStatus?.compactAtTokens),
245490
- estimatedHistoryTokens: finiteNumber(
246034
+ maxContextTokens: finiteNumber2(contextStatus?.maxContextTokens),
246035
+ compactAtTokens: finiteNumber2(contextStatus?.compactAtTokens),
246036
+ estimatedHistoryTokens: finiteNumber2(
245491
246037
  contextStatus?.estimatedHistoryTokens
245492
246038
  ),
245493
- utilization: finiteNumber(contextStatus?.utilization)
246039
+ utilization: finiteNumber2(contextStatus?.utilization)
245494
246040
  },
245495
246041
  turn: activeTurn ? {
245496
246042
  active: true,
@@ -245507,12 +246053,12 @@ function collectWebUiStatus(options, activeTurn) {
245507
246053
  };
245508
246054
  }
245509
246055
  function summarizeWebUiReview(value) {
245510
- const record = isRecord4(value) ? value : {};
246056
+ const record = isRecord5(value) ? value : {};
245511
246057
  const rawChanges = Array.isArray(record.fileChanges) ? record.fileChanges : [];
245512
246058
  const rawToolCalls = Array.isArray(record.toolCalls) ? record.toolCalls : [];
245513
246059
  const rawCheckpoints = Array.isArray(record.checkpoints) ? record.checkpoints : [];
245514
246060
  const rawVerification = Array.isArray(record.verification) ? record.verification : [];
245515
- const fileChanges = rawChanges.filter(isRecord4).slice(-80).reverse().map((change) => ({
246061
+ const fileChanges = rawChanges.filter(isRecord5).slice(-80).reverse().map((change) => ({
245516
246062
  id: safeLabel(typeof change.id === "string" ? change.id : "", 200),
245517
246063
  path: normalizeSafeWebUiPath(change.path) || "unknown",
245518
246064
  diff: redactSecrets(stripAnsi3(String(change.diff || ""))).slice(
@@ -245524,7 +246070,7 @@ function summarizeWebUiReview(value) {
245524
246070
  100
245525
246071
  )
245526
246072
  })).filter((change) => change.id && change.path !== "unknown");
245527
- const checkpoints = rawCheckpoints.filter(isRecord4).slice(-40).reverse().map((checkpoint) => ({
246073
+ const checkpoints = rawCheckpoints.filter(isRecord5).slice(-40).reverse().map((checkpoint) => ({
245528
246074
  id: safeLabel(
245529
246075
  typeof checkpoint.id === "string" ? checkpoint.id : "",
245530
246076
  200
@@ -245539,7 +246085,7 @@ function summarizeWebUiReview(value) {
245539
246085
  ),
245540
246086
  files: (Array.isArray(checkpoint.files) ? checkpoint.files : []).map((path6) => normalizeSafeWebUiPath(path6)).filter((path6) => Boolean(path6)).slice(0, 50)
245541
246087
  })).filter((checkpoint) => checkpoint.id);
245542
- const verification = rawVerification.filter(isRecord4).slice(-20).reverse().map((entry) => ({
246088
+ const verification = rawVerification.filter(isRecord5).slice(-20).reverse().map((entry) => ({
245543
246089
  timestamp: safeLabel(
245544
246090
  typeof entry.timestamp === "string" ? entry.timestamp : "",
245545
246091
  100
@@ -245547,7 +246093,7 @@ function summarizeWebUiReview(value) {
245547
246093
  success: typeof entry.success === "boolean" ? entry.success : void 0,
245548
246094
  detail: typeof entry.detail === "string" ? redactSecrets(stripAnsi3(entry.detail)).slice(0, 2e3) : void 0
245549
246095
  }));
245550
- const toolCalls = rawToolCalls.filter(isRecord4).slice(-100).reverse().map((tool) => {
246096
+ const toolCalls = rawToolCalls.filter(isRecord5).slice(-100).reverse().map((tool) => {
245551
246097
  const startedAt = safeLabel(
245552
246098
  typeof tool.startedAt === "string" ? tool.startedAt : "",
245553
246099
  100
@@ -245580,7 +246126,7 @@ function summarizeWebUiReview(value) {
245580
246126
  return { fileChanges, toolCalls, checkpoints, verification };
245581
246127
  }
245582
246128
  function collectWebUiApproval(value) {
245583
- if (!isRecord4(value)) return void 0;
246129
+ if (!isRecord5(value)) return void 0;
245584
246130
  if (typeof value.id !== "string" || !["tool", "change", "action"].includes(String(value.kind))) {
245585
246131
  return void 0;
245586
246132
  }
@@ -245607,7 +246153,7 @@ function safeApprovalText(value, maxLength, preserveLines) {
245607
246153
  }
245608
246154
  function normalizeSessions(sessions, activeId) {
245609
246155
  if (!Array.isArray(sessions)) return [];
245610
- return sessions.filter(isRecord4).map((session) => ({
246156
+ return sessions.filter(isRecord5).map((session) => ({
245611
246157
  id: typeof session.id === "string" ? session.id : "",
245612
246158
  title: typeof session.title === "string" && session.title.trim() ? redactSecrets(session.title.trim()).slice(0, 160) : "Untitled task",
245613
246159
  model: typeof session.model === "string" ? session.model : "",
@@ -245660,8 +246206,8 @@ function buildModelOptions(options, activeModel2) {
245660
246206
  return safeCall(() => options.loop?.getModelOverride?.()) ? [discovered[0], automatic, ...discovered.slice(1)] : [automatic, ...discovered];
245661
246207
  }
245662
246208
  function normalizeMessage(message, index) {
245663
- const record = isRecord4(message) ? message : {};
245664
- const metadata = isRecord4(record.metadata) ? record.metadata : {};
246209
+ const record = isRecord5(message) ? message : {};
246210
+ const metadata = isRecord5(record.metadata) ? record.metadata : {};
245665
246211
  const role = record.role === "user" || record.role === "assistant" || record.role === "tool" ? record.role : "assistant";
245666
246212
  const blocks = normalizeMessageBlocks(record.content);
245667
246213
  return {
@@ -245680,7 +246226,7 @@ function normalizeMessageBlocks(content) {
245680
246226
  if (!Array.isArray(content)) return [];
245681
246227
  const blocks = [];
245682
246228
  for (const candidate of content) {
245683
- if (!isRecord4(candidate)) continue;
246229
+ if (!isRecord5(candidate)) continue;
245684
246230
  if (candidate.type === "text" && typeof candidate.text === "string") {
245685
246231
  blocks.push({ type: "text", text: candidate.text });
245686
246232
  continue;
@@ -245697,7 +246243,7 @@ function normalizeMessageBlocks(content) {
245697
246243
  });
245698
246244
  continue;
245699
246245
  }
245700
- if (candidate.type === "tool_call" && isRecord4(candidate.toolCall)) {
246246
+ if (candidate.type === "tool_call" && isRecord5(candidate.toolCall)) {
245701
246247
  blocks.push({
245702
246248
  type: "tool",
245703
246249
  id: typeof candidate.toolCall.id === "string" ? candidate.toolCall.id : "",
@@ -245707,7 +246253,7 @@ function normalizeMessageBlocks(content) {
245707
246253
  });
245708
246254
  continue;
245709
246255
  }
245710
- if (candidate.type === "tool_result" && isRecord4(candidate.toolResult)) {
246256
+ if (candidate.type === "tool_result" && isRecord5(candidate.toolResult)) {
245711
246257
  const isError = candidate.toolResult.isError === true;
245712
246258
  blocks.push({
245713
246259
  type: "tool",
@@ -245775,9 +246321,9 @@ function toolDetail(value, options = {}) {
245775
246321
  return detail ? { detail } : {};
245776
246322
  }
245777
246323
  function isInternalWebMessage(message) {
245778
- if (!isRecord4(message)) return true;
246324
+ if (!isRecord5(message)) return true;
245779
246325
  if (message.role === "system") return true;
245780
- const metadata = isRecord4(message.metadata) ? message.metadata : {};
246326
+ const metadata = isRecord5(message.metadata) ? message.metadata : {};
245781
246327
  return metadata.kind === "orbit_volatile_context" || metadata.kind === "history_compaction_summary";
245782
246328
  }
245783
246329
  function safeCall(fn) {
@@ -245787,13 +246333,13 @@ function safeCall(fn) {
245787
246333
  return void 0;
245788
246334
  }
245789
246335
  }
245790
- function finiteNumber(value) {
246336
+ function finiteNumber2(value) {
245791
246337
  return typeof value === "number" && Number.isFinite(value) ? value : 0;
245792
246338
  }
245793
246339
  function stripAnsi3(value) {
245794
246340
  return value.replace(/\u001b\[[0-9;]*m/g, "");
245795
246341
  }
245796
- function isRecord4(value) {
246342
+ function isRecord5(value) {
245797
246343
  return typeof value === "object" && value !== null;
245798
246344
  }
245799
246345
 
@@ -246109,6 +246655,16 @@ var COPY = {
246109
246655
  runtime: "Runtime",
246110
246656
  projectMemory: "Project memory",
246111
246657
  taskPlan: "Task plan",
246658
+ agentRuns: "Agent runs",
246659
+ noAgents: "No delegated agents for this workspace.",
246660
+ abortAgent: "Abort agent",
246661
+ reviewProject: "Review project",
246662
+ reviewProjectBody: "Launch an evidence-first, read-only review with a focused preset.",
246663
+ reviewComprehensive: "Comprehensive",
246664
+ reviewSecurity: "Security",
246665
+ reviewTests: "Tests",
246666
+ reviewPerformance: "Performance",
246667
+ reviewAccessibility: "Accessibility",
246112
246668
  noMemory: "No explicit project memory.",
246113
246669
  noPlan: "No plan steps for this chat.",
246114
246670
  noActivity: "Activity will appear here while Orbit works.",
@@ -246222,6 +246778,16 @@ var COPY = {
246222
246778
  runtime: "\u8FD0\u884C\u72B6\u6001",
246223
246779
  projectMemory: "\u9879\u76EE\u8BB0\u5FC6",
246224
246780
  taskPlan: "\u4EFB\u52A1\u8BA1\u5212",
246781
+ agentRuns: "\u667A\u80FD\u4F53\u8FD0\u884C",
246782
+ noAgents: "\u5F53\u524D\u5DE5\u4F5C\u533A\u8FD8\u6CA1\u6709\u59D4\u6D3E\u667A\u80FD\u4F53\u3002",
246783
+ abortAgent: "\u7EC8\u6B62\u667A\u80FD\u4F53",
246784
+ reviewProject: "\u9879\u76EE\u5BA1\u67E5",
246785
+ reviewProjectBody: "\u9009\u62E9\u91CD\u70B9\uFF0C\u542F\u52A8\u57FA\u4E8E\u8BC1\u636E\u7684\u53EA\u8BFB\u5BA1\u67E5\u3002",
246786
+ reviewComprehensive: "\u5168\u9762",
246787
+ reviewSecurity: "\u5B89\u5168",
246788
+ reviewTests: "\u6D4B\u8BD5",
246789
+ reviewPerformance: "\u6027\u80FD",
246790
+ reviewAccessibility: "\u65E0\u969C\u788D",
246225
246791
  noMemory: "\u6682\u65E0\u663E\u5F0F\u9879\u76EE\u8BB0\u5FC6\u3002",
246226
246792
  noPlan: "\u5F53\u524D\u5BF9\u8BDD\u6682\u65E0\u8BA1\u5212\u6B65\u9AA4\u3002",
246227
246793
  noActivity: "Orbit \u5DE5\u4F5C\u65F6\uFF0C\u6B65\u9AA4\u548C\u5DE5\u5177\u72B6\u6001\u4F1A\u663E\u793A\u5728\u8FD9\u91CC\u3002",
@@ -246566,6 +247132,10 @@ function renderWebUiPage(language) {
246566
247132
  <div class="section-heading"><h3>${copy.taskPlan}</h3><span id="planCount">0</span></div>
246567
247133
  <div class="review-list" id="planReview"><p class="review-empty">${copy.noPlan}</p></div>
246568
247134
  </section>
247135
+ <section class="detail-section">
247136
+ <div class="section-heading"><h3>${copy.agentRuns}</h3><span id="agentRunCount">0</span></div>
247137
+ <div class="agent-run-list" id="agentRunList"><p class="review-empty">${copy.noAgents}</p></div>
247138
+ </section>
246569
247139
  <section class="detail-section">
246570
247140
  <div class="section-heading"><h3>${copy.projectMemory}</h3><span id="memoryCount">0</span></div>
246571
247141
  <div class="review-list" id="memoryReview"><p class="review-empty">${copy.noMemory}</p></div>
@@ -246587,6 +247157,17 @@ function renderWebUiPage(language) {
246587
247157
  </section>
246588
247158
 
246589
247159
  <section class="tab-panel" id="changesPanel" role="tabpanel" aria-labelledby="changesTab" hidden>
247160
+ <section class="detail-section review-launcher">
247161
+ <div class="section-heading"><h3>${copy.reviewProject}</h3><span>READ ONLY</span></div>
247162
+ <p>${copy.reviewProjectBody}</p>
247163
+ <div class="review-preset-grid" id="reviewPresets">
247164
+ <button type="button" data-review-preset="comprehensive">${copy.reviewComprehensive}</button>
247165
+ <button type="button" data-review-preset="security">${copy.reviewSecurity}</button>
247166
+ <button type="button" data-review-preset="tests">${copy.reviewTests}</button>
247167
+ <button type="button" data-review-preset="performance">${copy.reviewPerformance}</button>
247168
+ <button type="button" data-review-preset="accessibility">${copy.reviewAccessibility}</button>
247169
+ </div>
247170
+ </section>
246590
247171
  <section class="detail-section changes-summary-section">
246591
247172
  <div class="section-heading"><h3>${copy.changedFiles}</h3><span id="changeCount">0</span></div>
246592
247173
  <div class="changes-list" id="changesList" data-testid="changes-list"><p class="review-empty">${copy.noChanges}</p></div>
@@ -249495,6 +250076,123 @@ var WEB_UI_INSPECTOR_STYLES = String.raw`
249495
250076
  background: var(--danger-soft);
249496
250077
  }
249497
250078
 
250079
+ .review-launcher > p {
250080
+ margin: -4px 0 11px;
250081
+ color: var(--muted);
250082
+ font-size: 10px;
250083
+ line-height: 1.5;
250084
+ }
250085
+
250086
+ .review-preset-grid {
250087
+ display: grid;
250088
+ grid-template-columns: repeat(2, minmax(0, 1fr));
250089
+ gap: 6px;
250090
+ }
250091
+
250092
+ .review-preset-grid button {
250093
+ min-height: 34px;
250094
+ padding: 7px 9px;
250095
+ color: var(--ink-strong);
250096
+ background: var(--surface-subtle);
250097
+ border: 1px solid var(--border);
250098
+ border-radius: 8px;
250099
+ font-size: 10px;
250100
+ font-weight: 650;
250101
+ text-align: left;
250102
+ }
250103
+
250104
+ .review-preset-grid button:first-child {
250105
+ grid-column: 1 / -1;
250106
+ color: var(--accent-strong);
250107
+ border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
250108
+ }
250109
+
250110
+ .review-preset-grid button:hover {
250111
+ background: var(--surface-hover);
250112
+ border-color: var(--border-strong);
250113
+ }
250114
+
250115
+ .agent-run-list {
250116
+ display: grid;
250117
+ gap: 7px;
250118
+ }
250119
+
250120
+ .agent-card {
250121
+ display: grid;
250122
+ gap: 5px;
250123
+ padding: 9px;
250124
+ background: var(--surface-subtle);
250125
+ border: 1px solid var(--border);
250126
+ border-radius: 9px;
250127
+ }
250128
+
250129
+ .agent-card.is-running {
250130
+ border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
250131
+ }
250132
+
250133
+ .agent-card-heading {
250134
+ display: flex;
250135
+ align-items: center;
250136
+ justify-content: space-between;
250137
+ gap: 8px;
250138
+ }
250139
+
250140
+ .agent-card-heading strong {
250141
+ overflow: hidden;
250142
+ color: var(--ink-strong);
250143
+ font-size: 10px;
250144
+ text-overflow: ellipsis;
250145
+ white-space: nowrap;
250146
+ }
250147
+
250148
+ .agent-status {
250149
+ color: var(--faint);
250150
+ font: 8px/1.4 var(--font-mono);
250151
+ letter-spacing: 0.05em;
250152
+ text-transform: uppercase;
250153
+ }
250154
+
250155
+ .agent-card.is-running .agent-status {
250156
+ color: var(--accent-strong);
250157
+ }
250158
+
250159
+ .agent-card.is-failed .agent-status,
250160
+ .agent-card.is-aborted .agent-status {
250161
+ color: var(--danger);
250162
+ }
250163
+
250164
+ .agent-card p {
250165
+ margin: 0;
250166
+ overflow: hidden;
250167
+ color: var(--muted);
250168
+ font-size: 10px;
250169
+ line-height: 1.45;
250170
+ text-overflow: ellipsis;
250171
+ white-space: nowrap;
250172
+ }
250173
+
250174
+ .agent-meta {
250175
+ overflow: hidden;
250176
+ color: var(--faint);
250177
+ font: 8px/1.45 var(--font-mono);
250178
+ text-overflow: ellipsis;
250179
+ white-space: nowrap;
250180
+ }
250181
+
250182
+ .agent-abort {
250183
+ justify-self: start;
250184
+ padding: 4px 7px;
250185
+ color: var(--danger);
250186
+ background: var(--danger-soft);
250187
+ border: 0;
250188
+ border-radius: 6px;
250189
+ font-size: 9px;
250190
+ }
250191
+
250192
+ .agent-abort:disabled {
250193
+ opacity: 0.45;
250194
+ }
250195
+
249498
250196
  .text-button {
249499
250197
  padding: 3px 0;
249500
250198
  color: var(--faint);
@@ -251927,56 +252625,60 @@ var WEB_UI_STYLE_SECTIONS = [
251927
252625
  var WEB_UI_STYLES = WEB_UI_STYLE_SECTIONS.join("");
251928
252626
 
251929
252627
  // src/runtime/webui/WebUiRuntime.ts
251930
- var WebTurnIdSchema = z39.string().trim().min(8).max(100).regex(/^[a-zA-Z0-9_-]+$/);
251931
- var ChatRequestSchema = z39.object({
251932
- prompt: z39.string().trim().min(1).max(1e5),
252628
+ var WebTurnIdSchema = z40.string().trim().min(8).max(100).regex(/^[a-zA-Z0-9_-]+$/);
252629
+ var ChatRequestSchema = z40.object({
252630
+ prompt: z40.string().trim().min(1).max(1e5),
251933
252631
  turnId: WebTurnIdSchema.optional(),
251934
- attachmentIds: z39.array(WebTurnIdSchema).max(4).optional()
252632
+ attachmentIds: z40.array(WebTurnIdSchema).max(4).optional()
251935
252633
  }).strict();
251936
- var CancelRequestSchema = z39.object({ turnId: WebTurnIdSchema.nullish() }).strict();
251937
- var ApprovalDecisionSchema = z39.object({
252634
+ var CancelRequestSchema = z40.object({ turnId: WebTurnIdSchema.nullish() }).strict();
252635
+ var ApprovalDecisionSchema = z40.object({
251938
252636
  id: WebTurnIdSchema,
251939
- approved: z39.boolean()
252637
+ approved: z40.boolean()
251940
252638
  }).strict();
251941
- var SettingsPatchSchema = z39.object({
251942
- provider: z39.string().trim().min(1).max(256).optional(),
251943
- model: z39.string().trim().min(1).max(200).optional(),
251944
- permissionMode: z39.enum(["strict", "normal", "auto", "plan"]).optional(),
251945
- webSearchEnabled: z39.boolean().optional(),
251946
- webSearchProvider: z39.enum(["auto", "searxng", "tavily", "bing", "duckduckgo"]).optional(),
251947
- webSearchMaxResults: z39.number().int().min(1).max(20).optional()
252639
+ var SettingsPatchSchema = z40.object({
252640
+ provider: z40.string().trim().min(1).max(256).optional(),
252641
+ model: z40.string().trim().min(1).max(200).optional(),
252642
+ permissionMode: z40.enum(["strict", "normal", "auto", "plan"]).optional(),
252643
+ webSearchEnabled: z40.boolean().optional(),
252644
+ webSearchProvider: z40.enum(["auto", "searxng", "tavily", "bing", "duckduckgo"]).optional(),
252645
+ webSearchMaxResults: z40.number().int().min(1).max(20).optional()
251948
252646
  }).strict();
251949
- var SessionActionSchema = z39.discriminatedUnion("action", [
251950
- z39.object({ action: z39.literal("new") }).strict(),
252647
+ var SessionActionSchema = z40.discriminatedUnion("action", [
252648
+ z40.object({ action: z40.literal("new") }).strict(),
251951
252649
  ...["resume", "archive", "restore", "delete"].map(
251952
- (action) => z39.object({
251953
- action: z39.literal(action),
251954
- sessionId: z39.string().trim().min(1).max(200).regex(/^[a-zA-Z0-9_-]+$/)
252650
+ (action) => z40.object({
252651
+ action: z40.literal(action),
252652
+ sessionId: z40.string().trim().min(1).max(200).regex(/^[a-zA-Z0-9_-]+$/)
251955
252653
  }).strict()
251956
252654
  )
251957
252655
  ]);
251958
- var ProjectActionSchema = z39.discriminatedUnion("action", [
251959
- z39.object({ action: z39.literal("pick") }).strict(),
251960
- z39.object({
251961
- action: z39.enum(["open", "create"]),
251962
- path: z39.string().trim().min(1).max(4096)
252656
+ var ProjectActionSchema = z40.discriminatedUnion("action", [
252657
+ z40.object({ action: z40.literal("pick") }).strict(),
252658
+ z40.object({
252659
+ action: z40.enum(["open", "create"]),
252660
+ path: z40.string().trim().min(1).max(4096)
251963
252661
  }).strict(),
251964
- z39.object({
251965
- action: z39.literal("remove"),
251966
- projectId: z39.string().trim().min(1).max(64).regex(/^[a-zA-Z0-9_-]+$/)
252662
+ z40.object({
252663
+ action: z40.literal("remove"),
252664
+ projectId: z40.string().trim().min(1).max(64).regex(/^[a-zA-Z0-9_-]+$/)
251967
252665
  }).strict()
251968
252666
  ]);
251969
- var ReviewActionSchema = z39.discriminatedUnion("action", [
251970
- z39.object({
251971
- action: z39.literal("rollback-file"),
251972
- path: z39.string().trim().min(1).max(4096)
252667
+ var ReviewActionSchema = z40.discriminatedUnion("action", [
252668
+ z40.object({
252669
+ action: z40.literal("rollback-file"),
252670
+ path: z40.string().trim().min(1).max(4096)
251973
252671
  }).strict(),
251974
- z39.object({
251975
- action: z39.literal("rewind"),
251976
- checkpointId: z39.string().trim().min(1).max(200).regex(/^[a-zA-Z0-9_-]+$/)
252672
+ z40.object({
252673
+ action: z40.literal("rewind"),
252674
+ checkpointId: z40.string().trim().min(1).max(200).regex(/^[a-zA-Z0-9_-]+$/)
251977
252675
  }).strict()
251978
252676
  ]);
251979
- var CompletionQuerySchema = z39.string().trim().max(200);
252677
+ var AgentActionSchema = z40.object({
252678
+ action: z40.literal("abort"),
252679
+ agentId: z40.string().regex(/^agent_[a-z0-9-]+$/).max(128)
252680
+ }).strict();
252681
+ var CompletionQuerySchema = z40.string().trim().max(200);
251980
252682
  var IMAGE_ATTACHMENT_LIMIT_BYTES = 5 * 1024 * 1024;
251981
252683
  var IMAGE_ATTACHMENT_STORE_LIMIT = 16;
251982
252684
  var ALLOWED_IMAGE_TYPES = /* @__PURE__ */ new Set([
@@ -252265,6 +252967,10 @@ var OrbitWebUiRuntime = class {
252265
252967
  await this.handleReview(req, res, options);
252266
252968
  return;
252267
252969
  }
252970
+ if (req.method === "POST" && url.pathname === "/api/agent") {
252971
+ await this.handleAgentAction(req, res, options);
252972
+ return;
252973
+ }
252268
252974
  if (req.method === "POST" && url.pathname === "/api/cancel") {
252269
252975
  await this.handleCancel(req, res, options);
252270
252976
  return;
@@ -252359,6 +253065,25 @@ var OrbitWebUiRuntime = class {
252359
253065
  });
252360
253066
  }
252361
253067
  }
253068
+ async handleAgentAction(req, res, options) {
253069
+ if (!options.controlAgent) {
253070
+ sendJson(res, 409, {
253071
+ ok: false,
253072
+ message: "Agent controls are not available."
253073
+ });
253074
+ return;
253075
+ }
253076
+ try {
253077
+ const action = AgentActionSchema.parse(await readJsonBody(req));
253078
+ const result = sanitizeActionResult(await options.controlAgent(action));
253079
+ sendJson(res, result.ok ? 200 : 409, result);
253080
+ } catch (error) {
253081
+ sendJson(res, webRequestErrorStatus(error), {
253082
+ ok: false,
253083
+ message: safeWebMessage(error)
253084
+ });
253085
+ }
253086
+ }
252362
253087
  async handleApproval(req, res, options) {
252363
253088
  if (!options.respondToApproval) {
252364
253089
  sendJson(res, 409, {
@@ -252861,7 +253586,7 @@ Running shell command: ${shellCommand}...`)
252861
253586
  import picocolors11 from "picocolors";
252862
253587
 
252863
253588
  // src/runtime/ConfigObjectPath.ts
252864
- function isRecord5(value) {
253589
+ function isRecord6(value) {
252865
253590
  return typeof value === "object" && value !== null && !Array.isArray(value);
252866
253591
  }
252867
253592
  var blockedSegments = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
@@ -252877,7 +253602,7 @@ function getNestedProperty(root, path6) {
252877
253602
  if (!parts) return void 0;
252878
253603
  let current = root;
252879
253604
  for (const part of parts) {
252880
- if (!isRecord5(current) || !Object.hasOwn(current, part)) return void 0;
253605
+ if (!isRecord6(current) || !Object.hasOwn(current, part)) return void 0;
252881
253606
  current = current[part];
252882
253607
  }
252883
253608
  return current;
@@ -252888,7 +253613,7 @@ function setNestedProperty(root, path6, value) {
252888
253613
  let current = root;
252889
253614
  for (const part of parts.slice(0, -1)) {
252890
253615
  const child = current[part];
252891
- if (!isRecord5(child)) {
253616
+ if (!isRecord6(child)) {
252892
253617
  current[part] = {};
252893
253618
  }
252894
253619
  current = current[part];
@@ -253173,7 +253898,7 @@ function wildcardExpression(pattern) {
253173
253898
  const escaped = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*/g, "__DOUBLE_STAR__").replace(/\*/g, "[^/]*").replace(/__DOUBLE_STAR__\/?/g, "(?:|.*/)");
253174
253899
  return new RegExp(`^${escaped}$`, "i");
253175
253900
  }
253176
- function errorMessage2(error) {
253901
+ function errorMessage3(error) {
253177
253902
  return error instanceof Error ? error.message : String(error);
253178
253903
  }
253179
253904
  function addContextFile(loop, path6, readOnly, reason) {
@@ -253238,7 +253963,7 @@ async function handleInteractiveAdd(readOnly, dependencies, candidateFiles) {
253238
253963
  );
253239
253964
  } catch (error) {
253240
253965
  printOutput(
253241
- isZh ? picocolors12.red(`\u9009\u62E9\u6587\u4EF6\u5931\u8D25: ${errorMessage2(error)}`) : picocolors12.red(`Failed to select files: ${errorMessage2(error)}`)
253966
+ isZh ? picocolors12.red(`\u9009\u62E9\u6587\u4EF6\u5931\u8D25: ${errorMessage3(error)}`) : picocolors12.red(`Failed to select files: ${errorMessage3(error)}`)
253242
253967
  );
253243
253968
  } finally {
253244
253969
  tui.syncFromLoop(loop);
@@ -253288,7 +254013,7 @@ async function handleAdd(argument, dependencies) {
253288
254013
  } catch (error) {
253289
254014
  printOutput(
253290
254015
  picocolors12.red(
253291
- isZh ? `\u8DEF\u5F84\u5DF2\u88AB\u5B89\u5168\u7B56\u7565\u963B\u6B62: ${errorMessage2(error)}` : `Path blocked by workspace safety policy: ${errorMessage2(error)}`
254016
+ isZh ? `\u8DEF\u5F84\u5DF2\u88AB\u5B89\u5168\u7B56\u7565\u963B\u6B62: ${errorMessage3(error)}` : `Path blocked by workspace safety policy: ${errorMessage3(error)}`
253292
254017
  )
253293
254018
  );
253294
254019
  return HANDLED_COMMAND;
@@ -253369,7 +254094,7 @@ ${matched.map((file) => ` \u2022 ${file}`).join("\n")}`
253369
254094
  tui.syncFromLoop(loop);
253370
254095
  } catch (error) {
253371
254096
  printOutput(
253372
- isZh ? picocolors12.red(`\u6DFB\u52A0\u5931\u8D25: ${errorMessage2(error)}`) : picocolors12.red(`Failed to add: ${errorMessage2(error)}`)
254097
+ isZh ? picocolors12.red(`\u6DFB\u52A0\u5931\u8D25: ${errorMessage3(error)}`) : picocolors12.red(`Failed to add: ${errorMessage3(error)}`)
253373
254098
  );
253374
254099
  }
253375
254100
  return HANDLED_COMMAND;
@@ -253405,7 +254130,7 @@ async function handleDrop(argument, dependencies) {
253405
254130
  }
253406
254131
  } catch (error) {
253407
254132
  printOutput(
253408
- isZh ? picocolors12.red(`\u79FB\u9664\u6587\u4EF6\u5931\u8D25: ${errorMessage2(error)}`) : picocolors12.red(`Failed to remove files: ${errorMessage2(error)}`)
254133
+ isZh ? picocolors12.red(`\u79FB\u9664\u6587\u4EF6\u5931\u8D25: ${errorMessage3(error)}`) : picocolors12.red(`Failed to remove files: ${errorMessage3(error)}`)
253409
254134
  );
253410
254135
  } finally {
253411
254136
  tui.syncFromLoop(loop);
@@ -253469,7 +254194,7 @@ async function handleCompact(dependencies) {
253469
254194
  } catch (error) {
253470
254195
  printOutput(
253471
254196
  picocolors12.red(
253472
- isZh ? `\u2716 \u4E0A\u4E0B\u6587\u538B\u7F29\u5931\u8D25\uFF1A${errorMessage2(error)}` : `\u2716 Context compaction failed: ${errorMessage2(error)}`
254197
+ isZh ? `\u2716 \u4E0A\u4E0B\u6587\u538B\u7F29\u5931\u8D25\uFF1A${errorMessage3(error)}` : `\u2716 Context compaction failed: ${errorMessage3(error)}`
253473
254198
  )
253474
254199
  );
253475
254200
  } finally {
@@ -253498,9 +254223,9 @@ async function handleContextCommand(command, argument, dependencies) {
253498
254223
  import { execFileSync as execFileSync5 } from "child_process";
253499
254224
  import { existsSync as existsSync19, rmSync as rmSync5 } from "fs";
253500
254225
  import picocolors13 from "picocolors";
253501
- import { z as z40 } from "zod";
253502
- var GitStatusCodeSchema = z40.string().length(2).regex(/^[ MADRCU?!]{2}$/);
253503
- var GitStatusPathSchema = z40.string().min(1).max(32768);
254226
+ import { z as z41 } from "zod";
254227
+ var GitStatusCodeSchema = z41.string().length(2).regex(/^[ MADRCU?!]{2}$/);
254228
+ var GitStatusPathSchema = z41.string().min(1).max(32768);
253504
254229
  var defaultGitAdapter = {
253505
254230
  status: (cwd) => execFileSync5("git", ["status", "--porcelain=v1", "-z"], {
253506
254231
  cwd,
@@ -253998,32 +254723,32 @@ function ensureSessionTitle(loop, prompt) {
253998
254723
  }
253999
254724
 
254000
254725
  // src/runtime/ModelDiscovery.ts
254001
- import { z as z41 } from "zod";
254002
- var ModelEntrySchema = z41.object({
254003
- id: z41.unknown().optional(),
254004
- model: z41.unknown().optional(),
254005
- context_length: z41.unknown().optional(),
254006
- context_window: z41.unknown().optional(),
254007
- max_context_tokens: z41.unknown().optional(),
254008
- max_output_tokens: z41.unknown().optional(),
254009
- input_modalities: z41.unknown().optional(),
254010
- output_modalities: z41.unknown().optional(),
254011
- modalities: z41.unknown().optional(),
254012
- architecture: z41.unknown().optional(),
254013
- capabilities: z41.unknown().optional(),
254014
- supported_parameters: z41.unknown().optional(),
254015
- type: z41.unknown().optional(),
254016
- kind: z41.unknown().optional(),
254017
- task: z41.unknown().optional(),
254018
- endpoint: z41.unknown().optional(),
254019
- details: z41.unknown().optional()
254726
+ import { z as z45 } from "zod";
254727
+ var ModelEntrySchema = z45.object({
254728
+ id: z45.unknown().optional(),
254729
+ model: z45.unknown().optional(),
254730
+ context_length: z45.unknown().optional(),
254731
+ context_window: z45.unknown().optional(),
254732
+ max_context_tokens: z45.unknown().optional(),
254733
+ max_output_tokens: z45.unknown().optional(),
254734
+ input_modalities: z45.unknown().optional(),
254735
+ output_modalities: z45.unknown().optional(),
254736
+ modalities: z45.unknown().optional(),
254737
+ architecture: z45.unknown().optional(),
254738
+ capabilities: z45.unknown().optional(),
254739
+ supported_parameters: z45.unknown().optional(),
254740
+ type: z45.unknown().optional(),
254741
+ kind: z45.unknown().optional(),
254742
+ task: z45.unknown().optional(),
254743
+ endpoint: z45.unknown().optional(),
254744
+ details: z45.unknown().optional()
254020
254745
  }).passthrough();
254021
- var ModelListSchema = z41.union([
254022
- z41.object({ data: z41.array(ModelEntrySchema).max(1e3) }),
254023
- z41.object({ models: z41.array(ModelEntrySchema).max(1e3) }),
254024
- z41.array(ModelEntrySchema).max(1e3)
254746
+ var ModelListSchema = z45.union([
254747
+ z45.object({ data: z45.array(ModelEntrySchema).max(1e3) }),
254748
+ z45.object({ models: z45.array(ModelEntrySchema).max(1e3) }),
254749
+ z45.array(ModelEntrySchema).max(1e3)
254025
254750
  ]);
254026
- var DiscoveryUrlSchema = z41.string().url().max(4096).transform((value) => new URL(value));
254751
+ var DiscoveryUrlSchema = z45.string().url().max(4096).transform((value) => new URL(value));
254027
254752
  var MAX_MODEL_RESPONSE_BYTES = 2 * 1024 * 1024;
254028
254753
  async function discoverProviderModels(options) {
254029
254754
  const base = DiscoveryUrlSchema.parse(options.baseUrl.trim());
@@ -254190,9 +254915,9 @@ function normalizeModelEntries(entries) {
254190
254915
  }
254191
254916
  return { models, modelCapabilities };
254192
254917
  }
254193
- var OllamaShowSchema = z41.object({
254194
- capabilities: z41.array(z41.string().max(128)).max(64).optional(),
254195
- model_info: z41.record(z41.unknown()).optional()
254918
+ var OllamaShowSchema = z45.object({
254919
+ capabilities: z45.array(z45.string().max(128)).max(64).optional(),
254920
+ model_info: z45.record(z45.unknown()).optional()
254196
254921
  }).passthrough();
254197
254922
  async function enrichOllamaCapabilities(base, models, target, fetchImpl, signal) {
254198
254923
  const endpoint = new URL(base);
@@ -254439,9 +255164,9 @@ function isPickerCancellation(error) {
254439
255164
 
254440
255165
  // src/runtime/commands/SessionMetadataCommandHandler.ts
254441
255166
  import picocolors15 from "picocolors";
254442
- import { z as z45 } from "zod";
254443
- var GoalSchema = z45.string().trim().min(1).max(4e3);
254444
- var SessionTitleSchema = z45.string().trim().min(1).max(160);
255167
+ import { z as z46 } from "zod";
255168
+ var GoalSchema = z46.string().trim().min(1).max(4e3);
255169
+ var SessionTitleSchema = z46.string().trim().min(1).max(160);
254445
255170
  function handleSessionMetadataCommand(command, argument, dependencies) {
254446
255171
  if (command === "/goal") {
254447
255172
  handleGoal(argument, dependencies);
@@ -254506,9 +255231,9 @@ function handleRename(argument, { loop, isZh, printOutput }) {
254506
255231
 
254507
255232
  // src/runtime/commands/WorkspaceStateCommandHandler.ts
254508
255233
  import picocolors16 from "picocolors";
254509
- import { z as z46 } from "zod";
254510
- var TextSchema = z46.string().trim().min(1).max(2e3);
254511
- var ItemReferenceSchema = z46.string().trim().min(1).max(100);
255234
+ import { z as z47 } from "zod";
255235
+ var TextSchema = z47.string().trim().min(1).max(2e3);
255236
+ var ItemReferenceSchema = z47.string().trim().min(1).max(100);
254512
255237
  function handleWorkspaceStateCommand(command, argument, dependencies) {
254513
255238
  if (command === "/memory") {
254514
255239
  handleMemory(argument, dependencies);
@@ -254684,11 +255409,11 @@ function resolveItemId(reference, items) {
254684
255409
  // src/commands/update.ts
254685
255410
  import readline4 from "readline";
254686
255411
  import picocolors17 from "picocolors";
254687
- import { z as z47 } from "zod";
254688
- var UpdateCommandOptionsSchema = z47.object({
254689
- check: z47.boolean().default(false),
254690
- yes: z47.boolean().default(false),
254691
- json: z47.boolean().default(false),
255412
+ import { z as z48 } from "zod";
255413
+ var UpdateCommandOptionsSchema = z48.object({
255414
+ check: z48.boolean().default(false),
255415
+ yes: z48.boolean().default(false),
255416
+ json: z48.boolean().default(false),
254692
255417
  channel: UpdateChannelSchema.default("stable")
254693
255418
  }).strict();
254694
255419
  async function runUpdate(currentVersion, rawOptions, dependencies = {}) {
@@ -254820,6 +255545,92 @@ async function confirmUpdate(prompt) {
254820
255545
  }
254821
255546
  }
254822
255547
 
255548
+ // src/runtime/review/ReviewCommand.ts
255549
+ import { z as z49 } from "zod";
255550
+ var ReviewPresetSchema = z49.enum([
255551
+ "comprehensive",
255552
+ "security",
255553
+ "tests",
255554
+ "performance",
255555
+ "accessibility"
255556
+ ]);
255557
+ var ReviewScopeSchema = z49.discriminatedUnion("kind", [
255558
+ z49.object({ kind: z49.literal("working-tree") }),
255559
+ z49.object({ kind: z49.literal("commit"), ref: z49.string().min(1).max(200) }),
255560
+ z49.object({ kind: z49.literal("branch"), ref: z49.string().min(1).max(200) })
255561
+ ]);
255562
+ var SAFE_GIT_REF = /^[A-Za-z0-9][A-Za-z0-9._/@{}~^:+-]{0,199}$/;
255563
+ function parseReviewCommand(rawArguments) {
255564
+ const input = rawArguments.trim();
255565
+ if (!input) {
255566
+ return {
255567
+ preset: "comprehensive",
255568
+ scope: { kind: "working-tree" }
255569
+ };
255570
+ }
255571
+ const [first = "", ...rest] = input.split(/\s+/);
255572
+ const preset = ReviewPresetSchema.safeParse(first);
255573
+ if (preset.success) {
255574
+ return {
255575
+ preset: preset.data,
255576
+ scope: { kind: "working-tree" }
255577
+ };
255578
+ }
255579
+ if (first === "commit" || first === "branch") {
255580
+ const ref = rest.shift() || "";
255581
+ if (!SAFE_GIT_REF.test(ref)) {
255582
+ throw new Error(
255583
+ "Review refs may only contain standard Git ref characters."
255584
+ );
255585
+ }
255586
+ const requestedPreset = rest.shift() || "comprehensive";
255587
+ if (rest.length > 0) {
255588
+ throw new Error("Too many /review arguments.");
255589
+ }
255590
+ return {
255591
+ preset: ReviewPresetSchema.parse(requestedPreset),
255592
+ scope: ReviewScopeSchema.parse({ kind: first, ref })
255593
+ };
255594
+ }
255595
+ if (first === "custom") {
255596
+ const customInstructions = input.slice("custom".length).trim();
255597
+ if (!customInstructions || customInstructions.length > 4e3) {
255598
+ throw new Error(
255599
+ "Custom review instructions must contain 1 to 4000 characters."
255600
+ );
255601
+ }
255602
+ return {
255603
+ preset: "comprehensive",
255604
+ scope: { kind: "working-tree" },
255605
+ customInstructions
255606
+ };
255607
+ }
255608
+ throw new Error(
255609
+ "Usage: /review [comprehensive|security|tests|performance|accessibility|commit <ref> [preset]|branch <ref> [preset]|custom <instructions>]"
255610
+ );
255611
+ }
255612
+ function buildReviewPrompt(request) {
255613
+ const scope = request.scope.kind === "working-tree" ? "the current uncommitted working tree against HEAD" : request.scope.kind === "commit" ? `commit ${request.scope.ref}` : `the current branch against ${request.scope.ref}`;
255614
+ const focus = {
255615
+ comprehensive: "correctness, security, regressions, tests, maintainability, performance, and accessibility where applicable",
255616
+ security: "exploitable security defects, unsafe trust boundaries, credential exposure, path traversal, injection, and permission bypasses",
255617
+ tests: "missing coverage, false-positive tests, flaky behavior, unverified failure paths, and release-contract gaps",
255618
+ performance: "startup latency, repeated I/O, memory growth, hot-loop work, cache invalidation, and avoidable serialization",
255619
+ accessibility: "keyboard navigation, focus management, semantic roles, readable status announcements, contrast assumptions, and responsive interaction"
255620
+ };
255621
+ const custom2 = request.customInstructions ? `
255622
+ Additional review policy:
255623
+ ${request.customInstructions}` : "";
255624
+ return [
255625
+ `Perform a dedicated ${request.preset} code review of ${scope}.`,
255626
+ `Prioritize ${focus[request.preset]}.`,
255627
+ "Inspect the relevant diff and surrounding code before reaching conclusions.",
255628
+ "Report only actionable findings. For each finding include severity (P0-P3), file and line, evidence, impact, and a precise remediation.",
255629
+ "Then provide a concise verification plan. Do not modify files unless the user explicitly asks for fixes.",
255630
+ custom2
255631
+ ].filter(Boolean).join("\n");
255632
+ }
255633
+
254823
255634
  // src/runtime/CommandRouter.ts
254824
255635
  var require2 = createRequire2(import.meta.url);
254825
255636
  function stripAnsi4(value) {
@@ -254900,6 +255711,23 @@ var CommandRouter = class {
254900
255711
  );
254901
255712
  }
254902
255713
  }
255714
+ if (/^\/review(?:\s|$)/i.test(trimmed)) {
255715
+ try {
255716
+ const rawArguments = trimmed.replace(/^\/review\b/i, "").trim();
255717
+ const request = parseReviewCommand(rawArguments);
255718
+ trimmed = buildReviewPrompt(request);
255719
+ tui.addLog(
255720
+ config.language === "zh" ? `\u5DF2\u542F\u52A8 ${request.preset} \u4EE3\u7801\u5BA1\u67E5` : `Started ${request.preset} code review`
255721
+ );
255722
+ } catch (error) {
255723
+ this.printOutput(
255724
+ picocolors18.red(
255725
+ `\u2716 ${error instanceof Error ? error.message : String(error)}`
255726
+ )
255727
+ );
255728
+ return { shouldExit: false, processed: true };
255729
+ }
255730
+ }
254903
255731
  const shellResult = await handleShellCommand(trimmed, {
254904
255732
  cwd,
254905
255733
  config,
@@ -254978,6 +255806,7 @@ var CommandRouter = class {
254978
255806
  loop,
254979
255807
  port,
254980
255808
  getProjects: () => new ProjectRegistry().list().slice(0, 20),
255809
+ getAgentRuns: () => new AgentRunStore(cwd).listRuns(12),
254981
255810
  submitPrompt: (prompt, attachments) => this.submitWebPrompt(prompt, attachments),
254982
255811
  cancelPrompt: () => this.cancelWebPrompt(),
254983
255812
  updateSettings: (patch) => this.updateWebUiSettings(patch),
@@ -254998,6 +255827,16 @@ var CommandRouter = class {
254998
255827
  message: ok ? `Restored ${action.path}.` : `No restorable checkpoint was found for ${action.path}.`
254999
255828
  };
255000
255829
  },
255830
+ controlAgent: (action) => {
255831
+ const runnable = this.webUiRunnable;
255832
+ if (action.action === "abort" && runnable instanceof Orchestrator && runnable.abortAgent(action.agentId)) {
255833
+ return { ok: true, message: "Agent cancellation requested." };
255834
+ }
255835
+ return {
255836
+ ok: false,
255837
+ message: "The selected agent is no longer running."
255838
+ };
255839
+ },
255001
255840
  exportTrace: (includeHistory) => loop.exportSessionTrace(includeHistory),
255002
255841
  openProject: async (action) => {
255003
255842
  if (action.action === "pick") {
@@ -255891,20 +256730,20 @@ ${picocolors18.green("\u2714")} Switched security mode to: ${picocolors18.green(
255891
256730
  };
255892
256731
 
255893
256732
  // src/runtime/ReplController.ts
255894
- var AutocompleteRequestSchema = z48.object({
255895
- prefix: z48.string().max(2e4),
255896
- suffix: z48.string().max(2e4),
255897
- windowId: z48.string().max(1e3).optional()
256733
+ var AutocompleteRequestSchema = z50.object({
256734
+ prefix: z50.string().max(2e4),
256735
+ suffix: z50.string().max(2e4),
256736
+ windowId: z50.string().max(1e3).optional()
255898
256737
  });
255899
256738
  var AUTOCOMPLETE_BODY_LIMIT_BYTES = 1e5;
255900
256739
  var AUTOCOMPLETE_MAX_CONCURRENCY = 4;
255901
- var LocalStateSchema = z48.object({
255902
- lastSessionId: z48.string().optional(),
255903
- lastModel: z48.string().optional()
256740
+ var LocalStateSchema = z50.object({
256741
+ lastSessionId: z50.string().optional(),
256742
+ lastModel: z50.string().optional()
255904
256743
  });
255905
- var AutocompleteEndpointSchema = z48.object({
255906
- port: z48.number().int().min(1).max(65535),
255907
- token: z48.string().min(32).max(256)
256744
+ var AutocompleteEndpointSchema = z50.object({
256745
+ port: z50.number().int().min(1).max(65535),
256746
+ token: z50.string().min(32).max(256)
255908
256747
  });
255909
256748
  function getRunOutcomeMessage(outcome) {
255910
256749
  if (!outcome || outcome.status === "completed") return void 0;
@@ -256715,7 +257554,7 @@ function configureJsonlOutput() {
256715
257554
  schemaVersion: ORBIT_EVENT_SCHEMA_VERSION,
256716
257555
  sequence: ++sequence,
256717
257556
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
256718
- ...isRecord6(sanitized) ? sanitized : { type: "unknown", payload: {} }
257557
+ ...isRecord7(sanitized) ? sanitized : { type: "unknown", payload: {} }
256719
257558
  })
256720
257559
  );
256721
257560
  };
@@ -256729,8 +257568,8 @@ function configureJsonlOutput() {
256729
257568
  };
256730
257569
  }
256731
257570
  function sanitizeJsonlEvent(event) {
256732
- if (!isRecord6(event) || typeof event.type !== "string") return {};
256733
- const payload = isRecord6(event.payload) ? event.payload : {};
257571
+ if (!isRecord7(event) || typeof event.type !== "string") return {};
257572
+ const payload = isRecord7(event.payload) ? event.payload : {};
256734
257573
  const metadata = {
256735
257574
  ...typeof event.eventId === "string" ? { eventId: event.eventId } : {},
256736
257575
  ...typeof event.timestamp === "string" ? { timestamp: event.timestamp } : {}
@@ -256775,46 +257614,46 @@ function sanitizeJsonlEvent(event) {
256775
257614
  function redactJsonValue(value) {
256776
257615
  if (typeof value === "string") return redactSecrets(value);
256777
257616
  if (Array.isArray(value)) return value.map(redactJsonValue);
256778
- if (!isRecord6(value)) return value;
257617
+ if (!isRecord7(value)) return value;
256779
257618
  return Object.fromEntries(
256780
257619
  Object.entries(value).map(([key, item]) => [key, redactJsonValue(item)])
256781
257620
  );
256782
257621
  }
256783
- function isRecord6(value) {
257622
+ function isRecord7(value) {
256784
257623
  return typeof value === "object" && value !== null;
256785
257624
  }
256786
257625
 
256787
257626
  // src/commands/LSPServer.ts
256788
- import { z as z49 } from "zod";
257627
+ import { z as z51 } from "zod";
256789
257628
  var MAX_LSP_HEADER_BYTES = 8 * 1024;
256790
257629
  var MAX_LSP_BODY_BYTES = 8 * 1024 * 1024;
256791
- var JsonRpcIdSchema = z49.union([z49.string(), z49.number(), z49.null()]);
256792
- var JSONRPCMessageSchema = z49.object({
256793
- jsonrpc: z49.literal("2.0"),
257630
+ var JsonRpcIdSchema = z51.union([z51.string(), z51.number(), z51.null()]);
257631
+ var JSONRPCMessageSchema = z51.object({
257632
+ jsonrpc: z51.literal("2.0"),
256794
257633
  id: JsonRpcIdSchema.optional(),
256795
- method: z49.string().min(1).max(512),
256796
- params: z49.unknown().optional()
257634
+ method: z51.string().min(1).max(512),
257635
+ params: z51.unknown().optional()
256797
257636
  }).strict();
256798
- var TextDocumentIdentifierSchema = z49.object({
256799
- uri: z49.string().min(1).max(16384)
257637
+ var TextDocumentIdentifierSchema = z51.object({
257638
+ uri: z51.string().min(1).max(16384)
256800
257639
  });
256801
- var DidOpenParamsSchema = z49.object({
257640
+ var DidOpenParamsSchema = z51.object({
256802
257641
  textDocument: TextDocumentIdentifierSchema.extend({
256803
- text: z49.string().max(MAX_LSP_BODY_BYTES)
257642
+ text: z51.string().max(MAX_LSP_BODY_BYTES)
256804
257643
  }).passthrough()
256805
257644
  });
256806
- var DidChangeParamsSchema = z49.object({
257645
+ var DidChangeParamsSchema = z51.object({
256807
257646
  textDocument: TextDocumentIdentifierSchema,
256808
- contentChanges: z49.array(z49.object({ text: z49.string().max(MAX_LSP_BODY_BYTES) }).passthrough()).min(1).max(100)
257647
+ contentChanges: z51.array(z51.object({ text: z51.string().max(MAX_LSP_BODY_BYTES) }).passthrough()).min(1).max(100)
256809
257648
  });
256810
- var DidCloseParamsSchema = z49.object({
257649
+ var DidCloseParamsSchema = z51.object({
256811
257650
  textDocument: TextDocumentIdentifierSchema
256812
257651
  });
256813
- var CompletionParamsSchema = z49.object({
257652
+ var CompletionParamsSchema = z51.object({
256814
257653
  textDocument: TextDocumentIdentifierSchema,
256815
- position: z49.object({
256816
- line: z49.number().int().nonnegative(),
256817
- character: z49.number().int().nonnegative()
257654
+ position: z51.object({
257655
+ line: z51.number().int().nonnegative(),
257656
+ character: z51.number().int().nonnegative()
256818
257657
  })
256819
257658
  });
256820
257659
  var JSONRPCReader = class {
@@ -257060,7 +257899,7 @@ ${completion}
257060
257899
  );
257061
257900
  }
257062
257901
  } catch (error) {
257063
- if (error instanceof z49.ZodError) {
257902
+ if (error instanceof z51.ZodError) {
257064
257903
  sendError(message.id, -32602, "Invalid method parameters.");
257065
257904
  return;
257066
257905
  }
@@ -257433,10 +258272,10 @@ import {
257433
258272
  writeFileSync as writeFileSync13
257434
258273
  } from "fs";
257435
258274
  import { dirname as dirname11, resolve as resolve11 } from "path";
257436
- import { z as z50 } from "zod";
257437
- var TraceOptionsSchema = z50.object({
257438
- full: z50.boolean().default(false),
257439
- out: z50.string().trim().min(1).max(4096).optional()
258275
+ import { z as z54 } from "zod";
258276
+ var TraceOptionsSchema = z54.object({
258277
+ full: z54.boolean().default(false),
258278
+ out: z54.string().trim().min(1).max(4096).optional()
257440
258279
  });
257441
258280
  function runTraceExport(cwd, sessionId, options = {}) {
257442
258281
  const value = TraceOptionsSchema.parse(options);
@@ -257491,16 +258330,16 @@ import { basename as basename6, dirname as dirname12, join as join19 } from "pat
257491
258330
  import { promisify as promisify5 } from "util";
257492
258331
  import picocolors23 from "picocolors";
257493
258332
  import { parse as parseYaml3 } from "yaml";
257494
- import { z as z51 } from "zod";
258333
+ import { z as z55 } from "zod";
257495
258334
  var exec4 = promisify5(execCallback);
257496
258335
  var MAX_SUITE_BYTES = 1024 * 1024;
257497
258336
  var MAX_VERIFICATION_OUTPUT = 4e3;
257498
- var EvalOptionsSchema = z51.object({
257499
- provider: z51.string().trim().min(1).optional(),
257500
- model: z51.string().trim().min(1).optional(),
257501
- task: z51.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/).optional(),
257502
- allowCommands: z51.boolean().default(false),
257503
- json: z51.boolean().default(false)
258337
+ var EvalOptionsSchema = z55.object({
258338
+ provider: z55.string().trim().min(1).optional(),
258339
+ model: z55.string().trim().min(1).optional(),
258340
+ task: z55.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/).optional(),
258341
+ allowCommands: z55.boolean().default(false),
258342
+ json: z55.boolean().default(false)
257504
258343
  });
257505
258344
  async function runEval(cwd, suiteFile, options = {}) {
257506
258345
  const value = EvalOptionsSchema.parse(options);
@@ -257823,16 +258662,16 @@ function safeSummary(value) {
257823
258662
  import readline6 from "readline";
257824
258663
  import picocolors24 from "picocolors";
257825
258664
  import { resolve as resolve13 } from "path";
257826
- import { z as z55 } from "zod";
258665
+ import { z as z57 } from "zod";
257827
258666
 
257828
258667
  // src/runtime/CleanupManager.ts
257829
258668
  import { lstatSync as lstatSync8, readdirSync as readdirSync8, rmSync as rmSync9 } from "fs";
257830
258669
  import { homedir as homedir11 } from "os";
257831
258670
  import { basename as basename7, join as join20, parse as parse5, resolve as resolve12 } from "path";
257832
- import { z as z54 } from "zod";
257833
- var CleanupScopeSchema = z54.enum(["user", "project"]);
258671
+ import { z as z56 } from "zod";
258672
+ var CleanupScopeSchema = z56.enum(["user", "project"]);
257834
258673
  function buildCleanupPlan(options) {
257835
- const scopes = z54.array(CleanupScopeSchema).min(1).parse(options.scopes);
258674
+ const scopes = z56.array(CleanupScopeSchema).min(1).parse(options.scopes);
257836
258675
  const homeDirectory = resolve12(options.homeDirectory ?? homedir11());
257837
258676
  const projectDirectory = resolve12(options.projectDirectory ?? options.cwd);
257838
258677
  const candidates = scopes.map((scope) => ({
@@ -257955,12 +258794,12 @@ function safeInventoryWarning(targetPath, error) {
257955
258794
  }
257956
258795
 
257957
258796
  // src/commands/clean.ts
257958
- var CleanCommandOptionsSchema = z55.object({
257959
- user: z55.boolean().default(false),
257960
- project: z55.union([z55.boolean(), z55.string().min(1).max(4096)]).optional(),
257961
- all: z55.boolean().default(false),
257962
- yes: z55.boolean().default(false),
257963
- json: z55.boolean().default(false)
258797
+ var CleanCommandOptionsSchema = z57.object({
258798
+ user: z57.boolean().default(false),
258799
+ project: z57.union([z57.boolean(), z57.string().min(1).max(4096)]).optional(),
258800
+ all: z57.boolean().default(false),
258801
+ yes: z57.boolean().default(false),
258802
+ json: z57.boolean().default(false)
257964
258803
  }).strict();
257965
258804
  async function runClean(cwd, rawOptions, dependencies = {}) {
257966
258805
  const options = CleanCommandOptionsSchema.parse(rawOptions);
@@ -258075,7 +258914,7 @@ async function confirmDeletion(prompt) {
258075
258914
  // src/commands/backup.ts
258076
258915
  import { basename as basename8, resolve as resolve15 } from "path";
258077
258916
  import picocolors25 from "picocolors";
258078
- import { z as z57 } from "zod";
258917
+ import { z as z59 } from "zod";
258079
258918
 
258080
258919
  // src/runtime/ProjectBackup.ts
258081
258920
  import {
@@ -258091,23 +258930,23 @@ import {
258091
258930
  } from "fs";
258092
258931
  import { createHash as createHash8, randomUUID as randomUUID10 } from "crypto";
258093
258932
  import { dirname as dirname13, isAbsolute as isAbsolute7, join as join21, relative as relative5, resolve as resolve14, sep as sep2 } from "path";
258094
- import { z as z56 } from "zod";
258933
+ import { z as z58 } from "zod";
258095
258934
  var MAX_BACKUP_BYTES = 64 * 1024 * 1024;
258096
258935
  var MAX_SERIALIZED_BACKUP_BYTES = 96 * 1024 * 1024;
258097
258936
  var MAX_BACKUP_FILES = 1e4;
258098
258937
  var SHA256_PATTERN = /^[a-f0-9]{64}$/;
258099
- var BackupFileSchema = z56.object({
258100
- path: z56.string().min(1).max(4096),
258101
- size: z56.number().int().min(0).max(MAX_BACKUP_BYTES),
258102
- sha256: z56.string().regex(SHA256_PATTERN),
258103
- content: z56.string().max(Math.ceil(MAX_BACKUP_BYTES * 4 / 3) + 8)
258938
+ var BackupFileSchema = z58.object({
258939
+ path: z58.string().min(1).max(4096),
258940
+ size: z58.number().int().min(0).max(MAX_BACKUP_BYTES),
258941
+ sha256: z58.string().regex(SHA256_PATTERN),
258942
+ content: z58.string().max(Math.ceil(MAX_BACKUP_BYTES * 4 / 3) + 8)
258104
258943
  });
258105
- var ProjectBackupBundleSchema = z56.object({
258106
- schemaVersion: z56.literal(1),
258107
- kind: z56.literal("orbit-project-backup"),
258108
- createdAt: z56.string().datetime(),
258109
- sourceName: z56.string().min(1).max(512),
258110
- files: z56.array(BackupFileSchema).max(MAX_BACKUP_FILES)
258944
+ var ProjectBackupBundleSchema = z58.object({
258945
+ schemaVersion: z58.literal(1),
258946
+ kind: z58.literal("orbit-project-backup"),
258947
+ createdAt: z58.string().datetime(),
258948
+ sourceName: z58.string().min(1).max(512),
258949
+ files: z58.array(BackupFileSchema).max(MAX_BACKUP_FILES)
258111
258950
  }).superRefine((bundle, context) => {
258112
258951
  let totalBytes = 0;
258113
258952
  const seen = /* @__PURE__ */ new Set();
@@ -258115,7 +258954,7 @@ var ProjectBackupBundleSchema = z56.object({
258115
258954
  totalBytes += file.size;
258116
258955
  if (totalBytes > MAX_BACKUP_BYTES) {
258117
258956
  context.addIssue({
258118
- code: z56.ZodIssueCode.custom,
258957
+ code: z58.ZodIssueCode.custom,
258119
258958
  message: `Backup exceeds ${MAX_BACKUP_BYTES} bytes.`
258120
258959
  });
258121
258960
  break;
@@ -258123,14 +258962,14 @@ var ProjectBackupBundleSchema = z56.object({
258123
258962
  const normalized = normalizeBundlePath(file.path);
258124
258963
  if (!normalized || normalized !== file.path) {
258125
258964
  context.addIssue({
258126
- code: z56.ZodIssueCode.custom,
258965
+ code: z58.ZodIssueCode.custom,
258127
258966
  message: `Unsafe backup path: ${file.path}`
258128
258967
  });
258129
258968
  continue;
258130
258969
  }
258131
258970
  if (seen.has(normalized.toLowerCase())) {
258132
258971
  context.addIssue({
258133
- code: z56.ZodIssueCode.custom,
258972
+ code: z58.ZodIssueCode.custom,
258134
258973
  message: `Duplicate backup path: ${file.path}`
258135
258974
  });
258136
258975
  }
@@ -258340,9 +259179,9 @@ function formatBytes2(bytes) {
258340
259179
  }
258341
259180
 
258342
259181
  // src/commands/backup.ts
258343
- var BackupOptionsSchema = z57.object({
258344
- output: z57.string().min(1).max(4096).optional(),
258345
- json: z57.boolean().default(false)
259182
+ var BackupOptionsSchema = z59.object({
259183
+ output: z59.string().min(1).max(4096).optional(),
259184
+ json: z59.boolean().default(false)
258346
259185
  }).strict();
258347
259186
  function runBackupCreate(cwd, rawOptions = {}) {
258348
259187
  const options = BackupOptionsSchema.parse(rawOptions);
@@ -258431,7 +259270,7 @@ import picocolors26 from "picocolors";
258431
259270
 
258432
259271
  // src/runtime/ExtensionManager.ts
258433
259272
  import {
258434
- existsSync as existsSync36,
259273
+ existsSync as existsSync37,
258435
259274
  lstatSync as lstatSync10,
258436
259275
  mkdirSync as mkdirSync17,
258437
259276
  readFileSync as readFileSync30,
@@ -258443,20 +259282,20 @@ import {
258443
259282
  import { createHash as createHash9, randomUUID as randomUUID11 } from "crypto";
258444
259283
  import { dirname as dirname14, join as join26, relative as relative6, resolve as resolve16 } from "path";
258445
259284
  import { homedir as homedir12 } from "os";
258446
- import { z as z58 } from "zod";
258447
- var InstalledExtensionSchema2 = z58.object({
258448
- id: z58.string(),
258449
- displayName: z58.string(),
258450
- version: z58.string(),
258451
- digest: z58.string().regex(/^[a-f0-9]{64}$/),
258452
- installedAt: z58.string().datetime(),
258453
- trusted: z58.boolean(),
258454
- path: z58.string(),
258455
- manifestFile: z58.string().default("extension.yaml")
259285
+ import { z as z60 } from "zod";
259286
+ var InstalledExtensionSchema2 = z60.object({
259287
+ id: z60.string(),
259288
+ displayName: z60.string(),
259289
+ version: z60.string(),
259290
+ digest: z60.string().regex(/^[a-f0-9]{64}$/),
259291
+ installedAt: z60.string().datetime(),
259292
+ trusted: z60.boolean(),
259293
+ path: z60.string(),
259294
+ manifestFile: z60.string().default("extension.yaml")
258456
259295
  });
258457
- var ExtensionRegistrySchema2 = z58.object({
258458
- schemaVersion: z58.literal(1),
258459
- extensions: z58.array(InstalledExtensionSchema2).default([])
259296
+ var ExtensionRegistrySchema2 = z60.object({
259297
+ schemaVersion: z60.literal(1),
259298
+ extensions: z60.array(InstalledExtensionSchema2).default([])
258460
259299
  });
258461
259300
  var ExtensionManager = class {
258462
259301
  orbitDir;
@@ -258468,12 +259307,12 @@ var ExtensionManager = class {
258468
259307
  this.registryPath = join26(this.orbitDir, "extensions.json");
258469
259308
  }
258470
259309
  list() {
258471
- if (!existsSync36(this.registryPath)) return [];
259310
+ if (!existsSync37(this.registryPath)) return [];
258472
259311
  try {
258473
259312
  return ExtensionRegistrySchema2.parse(
258474
259313
  JSON.parse(readFileSync30(this.registryPath, "utf8"))
258475
259314
  ).extensions.filter(
258476
- (extension) => this.isManagedExtensionPath(extension) && existsSync36(extension.path) && !lstatSync10(extension.path).isSymbolicLink()
259315
+ (extension) => this.isManagedExtensionPath(extension) && existsSync37(extension.path) && !lstatSync10(extension.path).isSymbolicLink()
258477
259316
  );
258478
259317
  } catch {
258479
259318
  return [];
@@ -258500,7 +259339,7 @@ var ExtensionManager = class {
258500
259339
  try {
258501
259340
  copyDirectorySafely(sourceRoot, staging);
258502
259341
  const digest = hashDirectory2(staging);
258503
- if (existsSync36(target)) rmSync11(target, { recursive: true, force: true });
259342
+ if (existsSync37(target)) rmSync11(target, { recursive: true, force: true });
258504
259343
  renameSync12(staging, target);
258505
259344
  materializePromptContributions(target, manifest, this.orbitDir);
258506
259345
  const installed = {
@@ -258521,7 +259360,7 @@ var ExtensionManager = class {
258521
259360
  this.writeRegistry(registry);
258522
259361
  return installed;
258523
259362
  } finally {
258524
- if (existsSync36(staging))
259363
+ if (existsSync37(staging))
258525
259364
  rmSync11(staging, { recursive: true, force: true });
258526
259365
  }
258527
259366
  }
@@ -258624,7 +259463,7 @@ function validateContributionFiles(root, manifest) {
258624
259463
  `Invalid extension contribution path: ${contribution.path}`
258625
259464
  );
258626
259465
  }
258627
- if (!existsSync36(target) || lstatSync10(target).isSymbolicLink()) {
259466
+ if (!existsSync37(target) || lstatSync10(target).isSymbolicLink()) {
258628
259467
  throw new Error(
258629
259468
  `Extension contribution is missing or unsafe: ${contribution.path}`
258630
259469
  );
@@ -258763,7 +259602,7 @@ function removeExtension(id) {
258763
259602
  }
258764
259603
 
258765
259604
  // src/index.ts
258766
- import { existsSync as existsSync37, realpathSync as realpathSync4, statSync as statSync8 } from "fs";
259605
+ import { existsSync as existsSync38, realpathSync as realpathSync4, statSync as statSync8 } from "fs";
258767
259606
  import { resolve as resolve17 } from "path";
258768
259607
  var program = new Command();
258769
259608
  function applyOutcomeExitCode(outcome) {
@@ -258958,7 +259797,7 @@ program.command("webui").description("start Orbit as a browser-first local codin
258958
259797
  overrides.permissions = { mode: "auto" };
258959
259798
  }
258960
259799
  const requestedCwd = resolve17(localOptions.cwd || process.cwd());
258961
- if (!existsSync37(requestedCwd) || !statSync8(requestedCwd).isDirectory()) {
259800
+ if (!existsSync38(requestedCwd) || !statSync8(requestedCwd).isDirectory()) {
258962
259801
  throw new Error(
258963
259802
  `Web UI project directory does not exist: ${requestedCwd}`
258964
259803
  );