@orbit-build/cli 1.0.1 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +558 -83
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -239394,6 +239394,8 @@ var SkillNameSchema = z32.string().trim().min(1).max(64).regex(/^[a-z0-9][a-z0-9
|
|
|
239394
239394
|
var AgentProfileSchema = z32.object({
|
|
239395
239395
|
schemaVersion: z32.literal(AGENT_PROFILE_SCHEMA_VERSION).default(1),
|
|
239396
239396
|
name: ProfileNameSchema,
|
|
239397
|
+
/** Optional parent profile resolved from the same discovered catalog. */
|
|
239398
|
+
extends: ProfileNameSchema.optional(),
|
|
239397
239399
|
displayName: z32.string().trim().min(1).max(120).optional(),
|
|
239398
239400
|
description: z32.string().trim().max(2e3).default(""),
|
|
239399
239401
|
provider: z32.string().trim().min(1).max(256).optional(),
|
|
@@ -239403,6 +239405,7 @@ var AgentProfileSchema = z32.object({
|
|
|
239403
239405
|
disallowedTools: z32.array(ToolNameSchema).max(256).default([]),
|
|
239404
239406
|
skills: z32.array(SkillNameSchema).max(32).default([]),
|
|
239405
239407
|
maxTurns: z32.number().int().min(1).max(1e3).optional(),
|
|
239408
|
+
effort: z32.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
239406
239409
|
systemPrompt: z32.string().trim().max(2e4).optional(),
|
|
239407
239410
|
isolation: z32.enum(["workspace", "worktree"]).default("workspace"),
|
|
239408
239411
|
memory: z32.enum(["project", "none"]).default("project")
|
|
@@ -239493,7 +239496,9 @@ function discoverAgentProfiles(cwd, settings2) {
|
|
|
239493
239496
|
MAX_AGENT_PROFILE_FILE_BYTES
|
|
239494
239497
|
);
|
|
239495
239498
|
if (raw === void 0) continue;
|
|
239496
|
-
const
|
|
239499
|
+
const document2 = parse(raw);
|
|
239500
|
+
const declaredFields = isRecord(document2) ? Object.keys(document2) : [];
|
|
239501
|
+
const parsed = AgentProfileSchema.safeParse(document2);
|
|
239497
239502
|
if (!parsed.success) {
|
|
239498
239503
|
diagnostics.push({
|
|
239499
239504
|
path: normalizeDiagnosticPath(filePath),
|
|
@@ -239519,7 +239524,8 @@ function discoverAgentProfiles(cwd, settings2) {
|
|
|
239519
239524
|
loaded.push({
|
|
239520
239525
|
...profile,
|
|
239521
239526
|
path: normalizeDiagnosticPath(filePath),
|
|
239522
|
-
source: isProjectProfile(cwd, directory) ? "project" : "user"
|
|
239527
|
+
source: isProjectProfile(cwd, directory) ? "project" : "user",
|
|
239528
|
+
declaredFields
|
|
239523
239529
|
});
|
|
239524
239530
|
} catch (error) {
|
|
239525
239531
|
diagnostics.push({
|
|
@@ -239539,10 +239545,7 @@ function discoverAgentProfiles(cwd, settings2) {
|
|
|
239539
239545
|
}
|
|
239540
239546
|
function resolveAgentProfile(catalog, name, config, options = {}) {
|
|
239541
239547
|
const normalized = name.trim().toLowerCase();
|
|
239542
|
-
const profile = catalog
|
|
239543
|
-
(candidate) => candidate.name.toLowerCase() === normalized
|
|
239544
|
-
);
|
|
239545
|
-
if (!profile) throw new Error(`Agent profile not found: ${name}`);
|
|
239548
|
+
const profile = resolveInheritedProfile(catalog, normalized, []);
|
|
239546
239549
|
if (profile.provider) {
|
|
239547
239550
|
const violation = validateManagedRuntimeChange(config, {
|
|
239548
239551
|
provider: profile.provider
|
|
@@ -239576,6 +239579,53 @@ function resolveAgentProfile(catalog, name, config, options = {}) {
|
|
|
239576
239579
|
}
|
|
239577
239580
|
return profile;
|
|
239578
239581
|
}
|
|
239582
|
+
function resolveInheritedProfile(catalog, normalizedName, stack) {
|
|
239583
|
+
const profile = catalog.profiles.find(
|
|
239584
|
+
(candidate) => candidate.name.toLowerCase() === normalizedName
|
|
239585
|
+
);
|
|
239586
|
+
if (!profile) throw new Error(`Agent profile not found: ${normalizedName}`);
|
|
239587
|
+
if (stack.includes(normalizedName)) {
|
|
239588
|
+
throw new Error(
|
|
239589
|
+
`Agent profile inheritance cycle detected: ${[...stack, normalizedName].join(" -> ")}.`
|
|
239590
|
+
);
|
|
239591
|
+
}
|
|
239592
|
+
if (stack.length >= 8) {
|
|
239593
|
+
throw new Error(
|
|
239594
|
+
`Agent profile inheritance exceeds the maximum depth of 8: ${[...stack, normalizedName].join(" -> ")}.`
|
|
239595
|
+
);
|
|
239596
|
+
}
|
|
239597
|
+
if (!profile.extends) return profile;
|
|
239598
|
+
const parent = resolveInheritedProfile(
|
|
239599
|
+
catalog,
|
|
239600
|
+
profile.extends.toLowerCase(),
|
|
239601
|
+
[...stack, normalizedName]
|
|
239602
|
+
);
|
|
239603
|
+
const childFields = new Set(profile.declaredFields ?? []);
|
|
239604
|
+
const inherited = {
|
|
239605
|
+
...parent,
|
|
239606
|
+
...profile,
|
|
239607
|
+
description: childFields.has("description") ? profile.description : parent.description,
|
|
239608
|
+
displayName: childFields.has("displayName") ? profile.displayName : parent.displayName,
|
|
239609
|
+
provider: childFields.has("provider") ? profile.provider : parent.provider,
|
|
239610
|
+
model: childFields.has("model") ? profile.model : parent.model,
|
|
239611
|
+
permissionMode: childFields.has("permissionMode") ? profile.permissionMode : parent.permissionMode,
|
|
239612
|
+
allowedTools: childFields.has("allowedTools") ? profile.allowedTools : parent.allowedTools,
|
|
239613
|
+
disallowedTools: childFields.has("disallowedTools") ? profile.disallowedTools : parent.disallowedTools,
|
|
239614
|
+
skills: childFields.has("skills") ? profile.skills : parent.skills,
|
|
239615
|
+
maxTurns: childFields.has("maxTurns") ? profile.maxTurns : parent.maxTurns,
|
|
239616
|
+
effort: childFields.has("effort") ? profile.effort : parent.effort,
|
|
239617
|
+
systemPrompt: childFields.has("systemPrompt") ? profile.systemPrompt : parent.systemPrompt,
|
|
239618
|
+
isolation: childFields.has("isolation") ? profile.isolation : parent.isolation,
|
|
239619
|
+
memory: childFields.has("memory") ? profile.memory : parent.memory,
|
|
239620
|
+
declaredFields: [
|
|
239621
|
+
.../* @__PURE__ */ new Set([
|
|
239622
|
+
...parent.declaredFields ?? [],
|
|
239623
|
+
...profile.declaredFields ?? []
|
|
239624
|
+
])
|
|
239625
|
+
]
|
|
239626
|
+
};
|
|
239627
|
+
return inherited;
|
|
239628
|
+
}
|
|
239579
239629
|
function permissionRank2(mode) {
|
|
239580
239630
|
return { auto: 0, normal: 1, strict: 2, plan: 3 }[mode];
|
|
239581
239631
|
}
|
|
@@ -239599,6 +239649,9 @@ function formatProfileIssues(error) {
|
|
|
239599
239649
|
function safeMessage(error) {
|
|
239600
239650
|
return error instanceof Error ? error.message : String(error);
|
|
239601
239651
|
}
|
|
239652
|
+
function isRecord(value) {
|
|
239653
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
239654
|
+
}
|
|
239602
239655
|
var ORBIT_CONFIG_SCHEMA_VERSION = 1;
|
|
239603
239656
|
var DEFAULT_AGENT_MAX_ITERATIONS = 200;
|
|
239604
239657
|
var MAX_AGENT_MAX_ITERATIONS = 1e3;
|
|
@@ -241149,16 +241202,16 @@ function createPermissionModeOverride(mode) {
|
|
|
241149
241202
|
}
|
|
241150
241203
|
var MAX_CONFIG_FILE_BYTES = 2 * 1024 * 1024;
|
|
241151
241204
|
var MAX_PRICING_FILE_BYTES = 1024 * 1024;
|
|
241152
|
-
function
|
|
241205
|
+
function isRecord2(value) {
|
|
241153
241206
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
241154
241207
|
}
|
|
241155
241208
|
function sanitizeUntrustedProjectConfig(source, baseline) {
|
|
241156
|
-
if (!
|
|
241209
|
+
if (!isRecord2(source)) return {};
|
|
241157
241210
|
const safe = {};
|
|
241158
241211
|
for (const key of ["name", "language", "tui"]) {
|
|
241159
241212
|
if (source[key] !== void 0) safe[key] = source[key];
|
|
241160
241213
|
}
|
|
241161
|
-
if (
|
|
241214
|
+
if (isRecord2(source.context)) {
|
|
241162
241215
|
const context = { ...source.context };
|
|
241163
241216
|
delete context.testCommands;
|
|
241164
241217
|
if (context.autoRepair !== false) delete context.autoRepair;
|
|
@@ -241176,7 +241229,7 @@ function sanitizeUntrustedProjectConfig(source, baseline) {
|
|
|
241176
241229
|
}
|
|
241177
241230
|
safe.context = context;
|
|
241178
241231
|
}
|
|
241179
|
-
if (
|
|
241232
|
+
if (isRecord2(source.agent) && typeof source.agent.maxIterations === "number") {
|
|
241180
241233
|
safe.agent = {
|
|
241181
241234
|
maxIterations: Math.min(
|
|
241182
241235
|
source.agent.maxIterations,
|
|
@@ -241184,7 +241237,7 @@ function sanitizeUntrustedProjectConfig(source, baseline) {
|
|
|
241184
241237
|
)
|
|
241185
241238
|
};
|
|
241186
241239
|
}
|
|
241187
|
-
if (
|
|
241240
|
+
if (isRecord2(source.agents)) {
|
|
241188
241241
|
const agents = {};
|
|
241189
241242
|
if (source.agents.enabled === false) agents.enabled = false;
|
|
241190
241243
|
if (typeof source.agents.maxProfiles === "number") {
|
|
@@ -241206,7 +241259,7 @@ function sanitizeUntrustedProjectConfig(source, baseline) {
|
|
|
241206
241259
|
}
|
|
241207
241260
|
safe.agents = agents;
|
|
241208
241261
|
}
|
|
241209
|
-
if (
|
|
241262
|
+
if (isRecord2(source.permissions)) {
|
|
241210
241263
|
const permissions = {};
|
|
241211
241264
|
const requestedMode = source.permissions.mode;
|
|
241212
241265
|
if (typeof requestedMode === "string" && permissionSafetyRank(requestedMode) >= permissionSafetyRank(baseline.permissions.mode)) {
|
|
@@ -241233,9 +241286,9 @@ function sanitizeUntrustedProjectConfig(source, baseline) {
|
|
|
241233
241286
|
}
|
|
241234
241287
|
safe.permissions = permissions;
|
|
241235
241288
|
}
|
|
241236
|
-
if (
|
|
241289
|
+
if (isRecord2(source.tools)) {
|
|
241237
241290
|
const tools = {};
|
|
241238
|
-
if (
|
|
241291
|
+
if (isRecord2(source.tools.bash)) {
|
|
241239
241292
|
const bash = {};
|
|
241240
241293
|
if (source.tools.bash.enabled === false) bash.enabled = false;
|
|
241241
241294
|
if (typeof source.tools.bash.timeoutMs === "number") {
|
|
@@ -241246,7 +241299,7 @@ function sanitizeUntrustedProjectConfig(source, baseline) {
|
|
|
241246
241299
|
}
|
|
241247
241300
|
tools.bash = bash;
|
|
241248
241301
|
}
|
|
241249
|
-
if (
|
|
241302
|
+
if (isRecord2(source.tools.backgroundTasks)) {
|
|
241250
241303
|
const backgroundTasks = {};
|
|
241251
241304
|
for (const key of [
|
|
241252
241305
|
"maxConcurrentTasks",
|
|
@@ -241273,19 +241326,19 @@ function sanitizeUntrustedProjectConfig(source, baseline) {
|
|
|
241273
241326
|
}
|
|
241274
241327
|
tools.backgroundTasks = backgroundTasks;
|
|
241275
241328
|
}
|
|
241276
|
-
if (
|
|
241329
|
+
if (isRecord2(source.tools.webSearch)) {
|
|
241277
241330
|
tools.webSearch = {
|
|
241278
241331
|
...source.tools.webSearch.enabled === false ? { enabled: false } : {}
|
|
241279
241332
|
};
|
|
241280
241333
|
}
|
|
241281
|
-
if (
|
|
241334
|
+
if (isRecord2(source.tools.mcp)) {
|
|
241282
241335
|
tools.mcp = {
|
|
241283
241336
|
...source.tools.mcp.enabled === false ? { enabled: false } : {}
|
|
241284
241337
|
};
|
|
241285
241338
|
}
|
|
241286
241339
|
safe.tools = tools;
|
|
241287
241340
|
}
|
|
241288
|
-
if (
|
|
241341
|
+
if (isRecord2(source.skills)) {
|
|
241289
241342
|
const skills = {};
|
|
241290
241343
|
if (source.skills.enabled === false) skills.enabled = false;
|
|
241291
241344
|
if (source.skills.activation === "explicit") skills.activation = "explicit";
|
|
@@ -241325,7 +241378,7 @@ function warnIgnoredConfiguration(filePath) {
|
|
|
241325
241378
|
console.warn(`Warning: Invalid configuration at ${filePath}; file ignored.`);
|
|
241326
241379
|
}
|
|
241327
241380
|
function hasUnsupportedSchemaVersion(source) {
|
|
241328
|
-
if (!
|
|
241381
|
+
if (!isRecord2(source) || source.schemaVersion === void 0) return false;
|
|
241329
241382
|
return source.schemaVersion !== ORBIT_CONFIG_SCHEMA_VERSION;
|
|
241330
241383
|
}
|
|
241331
241384
|
function warnUnsupportedConfiguration(filePath) {
|
|
@@ -241369,14 +241422,14 @@ function migrateLegacyDeepSeekProvider(config) {
|
|
|
241369
241422
|
}
|
|
241370
241423
|
var ConfigLoader = class {
|
|
241371
241424
|
static merge(target, source) {
|
|
241372
|
-
if (!
|
|
241373
|
-
const result =
|
|
241425
|
+
if (!isRecord2(source)) return target;
|
|
241426
|
+
const result = isRecord2(target) ? { ...target } : {};
|
|
241374
241427
|
for (const key of Object.keys(source)) {
|
|
241375
241428
|
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
241376
241429
|
continue;
|
|
241377
241430
|
}
|
|
241378
241431
|
const sourceValue = source[key];
|
|
241379
|
-
if (
|
|
241432
|
+
if (isRecord2(sourceValue)) {
|
|
241380
241433
|
result[key] = this.merge(result[key] ?? {}, sourceValue);
|
|
241381
241434
|
} else if (sourceValue !== void 0) {
|
|
241382
241435
|
result[key] = sourceValue;
|
|
@@ -243093,6 +243146,14 @@ function getDeepSeekReasoningEffort(budgetTokens = 4096, explicitEffort) {
|
|
|
243093
243146
|
return "high";
|
|
243094
243147
|
}
|
|
243095
243148
|
function getDeepSeekThinkingPolicy(profile, input) {
|
|
243149
|
+
if (input.requestedEffort) {
|
|
243150
|
+
const effort = getDeepSeekReasoningEffort(4096, input.requestedEffort);
|
|
243151
|
+
return {
|
|
243152
|
+
enabled: true,
|
|
243153
|
+
effort,
|
|
243154
|
+
budgetTokens: effort === "low" ? 2048 : effort === "max" ? 8192 : 4096
|
|
243155
|
+
};
|
|
243156
|
+
}
|
|
243096
243157
|
if (profile.legacyAlias) {
|
|
243097
243158
|
return profile.optimizedThinkingDefault ? { enabled: true, effort: "high", budgetTokens: 4096 } : { enabled: false, effort: "high", budgetTokens: 0 };
|
|
243098
243159
|
}
|
|
@@ -243121,6 +243182,13 @@ function resolveModelThinkingPolicy(model, context) {
|
|
|
243121
243182
|
if (adaptation.family === "deepseek-v4") {
|
|
243122
243183
|
return getDeepSeekThinkingPolicy(adaptation.deepSeekV4, context);
|
|
243123
243184
|
}
|
|
243185
|
+
if (context.requestedEffort) {
|
|
243186
|
+
return {
|
|
243187
|
+
enabled: true,
|
|
243188
|
+
effort: context.requestedEffort,
|
|
243189
|
+
budgetTokens: budgetForEffort(context.requestedEffort)
|
|
243190
|
+
};
|
|
243191
|
+
}
|
|
243124
243192
|
if (context.isRepairTurn) {
|
|
243125
243193
|
return { enabled: true, budgetTokens: 8192 };
|
|
243126
243194
|
}
|
|
@@ -243129,6 +243197,19 @@ function resolveModelThinkingPolicy(model, context) {
|
|
|
243129
243197
|
}
|
|
243130
243198
|
return void 0;
|
|
243131
243199
|
}
|
|
243200
|
+
function budgetForEffort(effort) {
|
|
243201
|
+
switch (effort) {
|
|
243202
|
+
case "low":
|
|
243203
|
+
return 2048;
|
|
243204
|
+
case "medium":
|
|
243205
|
+
return 3072;
|
|
243206
|
+
case "high":
|
|
243207
|
+
return 4096;
|
|
243208
|
+
case "xhigh":
|
|
243209
|
+
case "max":
|
|
243210
|
+
return 8192;
|
|
243211
|
+
}
|
|
243212
|
+
}
|
|
243132
243213
|
function resolveModelCanonicalName(model) {
|
|
243133
243214
|
const adaptation = resolveModelAdaptation(model);
|
|
243134
243215
|
return adaptation.family === "deepseek-v4" ? adaptation.deepSeekV4.canonicalModel : model;
|
|
@@ -251975,13 +252056,21 @@ Orbit could not confirm timeout termination: ${errorMessage(error)}
|
|
|
251975
252056
|
task.requestedStop = status;
|
|
251976
252057
|
const gracefulSignalConfirmed = await signalProcessTree(task.child, false);
|
|
251977
252058
|
if (process.platform === "win32" && gracefulSignalConfirmed && task.status === "running") {
|
|
251978
|
-
|
|
252059
|
+
await waitForChildClosed(task.child, this.terminateGraceMs);
|
|
252060
|
+
if (task.status === "running") {
|
|
252061
|
+
releaseChildStreams(task.child);
|
|
252062
|
+
this.settleTask(task, status, task.child.exitCode);
|
|
252063
|
+
}
|
|
251979
252064
|
return;
|
|
251980
252065
|
}
|
|
251981
252066
|
if (await waitWithTimeout(task.completion, this.terminateGraceMs)) return;
|
|
251982
252067
|
const forcedSignalConfirmed = await signalProcessTree(task.child, true);
|
|
251983
252068
|
if (process.platform === "win32" && forcedSignalConfirmed && task.status === "running") {
|
|
251984
|
-
|
|
252069
|
+
await waitForChildClosed(task.child, this.terminateGraceMs);
|
|
252070
|
+
if (task.status === "running") {
|
|
252071
|
+
releaseChildStreams(task.child);
|
|
252072
|
+
this.settleTask(task, status, task.child.exitCode);
|
|
252073
|
+
}
|
|
251985
252074
|
return;
|
|
251986
252075
|
}
|
|
251987
252076
|
if (await waitWithTimeout(task.completion, this.terminateGraceMs)) return;
|
|
@@ -252048,6 +252137,27 @@ async function signalProcessTree(child, force) {
|
|
|
252048
252137
|
}
|
|
252049
252138
|
}
|
|
252050
252139
|
}
|
|
252140
|
+
async function waitForChildClosed(child, timeoutMs) {
|
|
252141
|
+
if (child.exitCode !== null || child.signalCode !== null) return true;
|
|
252142
|
+
return new Promise((resolve43) => {
|
|
252143
|
+
let settled = false;
|
|
252144
|
+
const finish = (closed) => {
|
|
252145
|
+
if (settled) return;
|
|
252146
|
+
settled = true;
|
|
252147
|
+
clearTimeout(timer);
|
|
252148
|
+
child.removeListener("close", onClose);
|
|
252149
|
+
resolve43(closed);
|
|
252150
|
+
};
|
|
252151
|
+
const onClose = () => finish(true);
|
|
252152
|
+
const timer = setTimeout(() => finish(false), timeoutMs);
|
|
252153
|
+
child.once("close", onClose);
|
|
252154
|
+
});
|
|
252155
|
+
}
|
|
252156
|
+
function releaseChildStreams(child) {
|
|
252157
|
+
child.stdin?.destroy();
|
|
252158
|
+
child.stdout?.destroy();
|
|
252159
|
+
child.stderr?.destroy();
|
|
252160
|
+
}
|
|
252051
252161
|
async function waitWithTimeout(promise, timeoutMs, abortSignal) {
|
|
252052
252162
|
let timeout;
|
|
252053
252163
|
let abortListener;
|
|
@@ -255467,6 +255577,26 @@ var MCP_SUPPORTED_PROTOCOL_VERSIONS = [
|
|
|
255467
255577
|
];
|
|
255468
255578
|
var MCP_LATEST_PROTOCOL_VERSION = MCP_MODERN_PROTOCOL_VERSIONS[0];
|
|
255469
255579
|
var MCP_LATEST_LEGACY_PROTOCOL_VERSION = MCP_LEGACY_PROTOCOL_VERSIONS[0];
|
|
255580
|
+
var MCP_TASK_STATUS_VALUES = [
|
|
255581
|
+
"working",
|
|
255582
|
+
"input_required",
|
|
255583
|
+
"completed",
|
|
255584
|
+
"failed",
|
|
255585
|
+
"cancelled"
|
|
255586
|
+
];
|
|
255587
|
+
var MCPTaskSchema = z28.object({
|
|
255588
|
+
taskId: z28.string().min(1).max(512),
|
|
255589
|
+
status: z28.enum(MCP_TASK_STATUS_VALUES),
|
|
255590
|
+
statusMessage: z28.string().max(1e4).optional(),
|
|
255591
|
+
createdAt: z28.string().datetime(),
|
|
255592
|
+
lastUpdatedAt: z28.string().datetime(),
|
|
255593
|
+
ttl: z28.number().int().nonnegative().nullable().optional(),
|
|
255594
|
+
pollInterval: z28.number().int().positive().max(3e5).optional()
|
|
255595
|
+
});
|
|
255596
|
+
var MCPCreateTaskResultSchema = z28.object({
|
|
255597
|
+
task: MCPTaskSchema,
|
|
255598
|
+
_meta: z28.record(z28.unknown()).optional()
|
|
255599
|
+
});
|
|
255470
255600
|
var MCP_IMPLEMENTATION_NAME_MAX_CHARS = 512;
|
|
255471
255601
|
var MCP_VERSION_MAX_CHARS = 100;
|
|
255472
255602
|
var MCP_DISCOVERY_INSTRUCTIONS_MAX_CHARS = 1e5;
|
|
@@ -255490,7 +255620,7 @@ var McpJsonRpcError = class extends Error {
|
|
|
255490
255620
|
name = "McpJsonRpcError";
|
|
255491
255621
|
};
|
|
255492
255622
|
function createModernRequestParams(params, protocolVersion, clientVersion) {
|
|
255493
|
-
const existingMeta =
|
|
255623
|
+
const existingMeta = isRecord3(params._meta) ? params._meta : {};
|
|
255494
255624
|
return {
|
|
255495
255625
|
...params,
|
|
255496
255626
|
_meta: {
|
|
@@ -255517,7 +255647,7 @@ function isRecognizedModernProtocolError(error) {
|
|
|
255517
255647
|
}
|
|
255518
255648
|
function modernVersionsFromUnsupportedError(error) {
|
|
255519
255649
|
if (!(error instanceof McpJsonRpcError) || error.code !== -32022) return [];
|
|
255520
|
-
if (!
|
|
255650
|
+
if (!isRecord3(error.data) || !Array.isArray(error.data.supported)) return [];
|
|
255521
255651
|
return error.data.supported.filter(
|
|
255522
255652
|
(value) => typeof value === "string"
|
|
255523
255653
|
);
|
|
@@ -255566,7 +255696,7 @@ function compileMirroredToolParameters(inputSchema) {
|
|
|
255566
255696
|
for (const nested of value) visit(nested, path9, false);
|
|
255567
255697
|
return;
|
|
255568
255698
|
}
|
|
255569
|
-
if (!
|
|
255699
|
+
if (!isRecord3(value)) return;
|
|
255570
255700
|
if ("x-mcp-header" in value) {
|
|
255571
255701
|
const headerName = value["x-mcp-header"];
|
|
255572
255702
|
const type = value.type;
|
|
@@ -255586,7 +255716,7 @@ function compileMirroredToolParameters(inputSchema) {
|
|
|
255586
255716
|
}
|
|
255587
255717
|
for (const [key, nested] of Object.entries(value)) {
|
|
255588
255718
|
if (key === "x-mcp-header") continue;
|
|
255589
|
-
if (key === "properties" &&
|
|
255719
|
+
if (key === "properties" && isRecord3(nested)) {
|
|
255590
255720
|
for (const [propertyName, propertySchema] of Object.entries(nested)) {
|
|
255591
255721
|
visit(propertySchema, [...path9, propertyName], true);
|
|
255592
255722
|
}
|
|
@@ -255605,7 +255735,7 @@ function createMirroredToolHeaders(parameters, args) {
|
|
|
255605
255735
|
for (const parameter of parameters) {
|
|
255606
255736
|
let value = args;
|
|
255607
255737
|
for (const segment of parameter.path) {
|
|
255608
|
-
value =
|
|
255738
|
+
value = isRecord3(value) ? value[segment] : void 0;
|
|
255609
255739
|
}
|
|
255610
255740
|
if (value === void 0 || value === null) continue;
|
|
255611
255741
|
const valid = parameter.type === "string" && typeof value === "string" || parameter.type === "boolean" && typeof value === "boolean" || (parameter.type === "number" || parameter.type === "integer") && typeof value === "number" && Number.isFinite(value) && (parameter.type === "number" || Number.isSafeInteger(value));
|
|
@@ -255620,7 +255750,7 @@ function createMirroredToolHeaders(parameters, args) {
|
|
|
255620
255750
|
}
|
|
255621
255751
|
return headers;
|
|
255622
255752
|
}
|
|
255623
|
-
function
|
|
255753
|
+
function isRecord3(value) {
|
|
255624
255754
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
255625
255755
|
}
|
|
255626
255756
|
var MCP_REQUEST_TIMEOUT_MS = 3e4;
|
|
@@ -255709,6 +255839,10 @@ var MCPPromptsListSchema = z36.object({
|
|
|
255709
255839
|
prompts: z36.array(MCPPromptSchema).max(1e4).default([]),
|
|
255710
255840
|
nextCursor: MCPPaginationCursorSchema.optional()
|
|
255711
255841
|
});
|
|
255842
|
+
var MCPTasksListSchema = z36.object({
|
|
255843
|
+
tasks: z36.array(MCPTaskSchema).max(1e4).default([]),
|
|
255844
|
+
nextCursor: MCPPaginationCursorSchema.optional()
|
|
255845
|
+
});
|
|
255712
255846
|
var MCPPromptGetResultSchema = z36.object({
|
|
255713
255847
|
description: z36.string().max(1e4).optional(),
|
|
255714
255848
|
messages: z36.array(
|
|
@@ -255786,7 +255920,8 @@ function parseServerCapabilities(initializeResult) {
|
|
|
255786
255920
|
return {
|
|
255787
255921
|
tools: has("tools"),
|
|
255788
255922
|
resources: has("resources"),
|
|
255789
|
-
prompts: has("prompts")
|
|
255923
|
+
prompts: has("prompts"),
|
|
255924
|
+
tasks: has("tasks")
|
|
255790
255925
|
};
|
|
255791
255926
|
}
|
|
255792
255927
|
function flattenResourceContents(result) {
|
|
@@ -255869,9 +256004,11 @@ var MCPClient = class {
|
|
|
255869
256004
|
serverCapabilities = {
|
|
255870
256005
|
tools: false,
|
|
255871
256006
|
resources: false,
|
|
255872
|
-
prompts: false
|
|
256007
|
+
prompts: false,
|
|
256008
|
+
tasks: false
|
|
255873
256009
|
};
|
|
255874
256010
|
catalogListeners = /* @__PURE__ */ new Set();
|
|
256011
|
+
taskStatusListeners = /* @__PURE__ */ new Set();
|
|
255875
256012
|
lastError;
|
|
255876
256013
|
get effectiveRequestTimeoutMs() {
|
|
255877
256014
|
return this.requestTimeoutMs ?? MCP_REQUEST_TIMEOUT_MS;
|
|
@@ -256056,6 +256193,117 @@ var MCPClient = class {
|
|
|
256056
256193
|
);
|
|
256057
256194
|
return flattenPromptMessages(result);
|
|
256058
256195
|
}
|
|
256196
|
+
/** Create a durable task-augmented MCP tool call. */
|
|
256197
|
+
async callToolTask(originalToolName, args, options = {}) {
|
|
256198
|
+
this.requireTaskCapability();
|
|
256199
|
+
const ttl = options.ttl;
|
|
256200
|
+
if (ttl !== void 0 && (!Number.isSafeInteger(ttl) || ttl < 1 || ttl > 7 * 24 * 60 * 60 * 1e3)) {
|
|
256201
|
+
throw new Error(
|
|
256202
|
+
"MCP task ttl must be an integer between 1ms and 7 days."
|
|
256203
|
+
);
|
|
256204
|
+
}
|
|
256205
|
+
const result = await this.sendRequest(
|
|
256206
|
+
"tools/call",
|
|
256207
|
+
{
|
|
256208
|
+
name: originalToolName,
|
|
256209
|
+
arguments: args,
|
|
256210
|
+
task: ttl === void 0 ? {} : { ttl }
|
|
256211
|
+
},
|
|
256212
|
+
options.abortSignal,
|
|
256213
|
+
{ skipModernResultCheck: true }
|
|
256214
|
+
);
|
|
256215
|
+
return MCPCreateTaskResultSchema.parse(result).task;
|
|
256216
|
+
}
|
|
256217
|
+
/** Read one durable task state without assuming a live notification stream. */
|
|
256218
|
+
async getTask(taskId, abortSignal) {
|
|
256219
|
+
this.requireTaskCapability();
|
|
256220
|
+
return MCPTaskSchema.parse(
|
|
256221
|
+
await this.sendRequest(
|
|
256222
|
+
"tasks/get",
|
|
256223
|
+
{ taskId: validateTaskId(taskId) },
|
|
256224
|
+
abortSignal,
|
|
256225
|
+
{ skipModernResultCheck: true }
|
|
256226
|
+
)
|
|
256227
|
+
);
|
|
256228
|
+
}
|
|
256229
|
+
/** List tasks through opaque cursor pagination with bounded memory. */
|
|
256230
|
+
async listTasks(abortSignal) {
|
|
256231
|
+
this.requireTaskCapability();
|
|
256232
|
+
return collectMcpPaginatedItems({
|
|
256233
|
+
method: "tasks/list",
|
|
256234
|
+
request: (params) => this.sendRequest("tasks/list", params, abortSignal, {
|
|
256235
|
+
skipModernResultCheck: true
|
|
256236
|
+
}),
|
|
256237
|
+
parse: (value) => {
|
|
256238
|
+
const page = MCPTasksListSchema.parse(value);
|
|
256239
|
+
return { items: page.tasks, nextCursor: page.nextCursor };
|
|
256240
|
+
},
|
|
256241
|
+
identity: (task) => task.taskId
|
|
256242
|
+
});
|
|
256243
|
+
}
|
|
256244
|
+
/** Request cancellation and return the receiver's authoritative state. */
|
|
256245
|
+
async cancelTask(taskId, abortSignal) {
|
|
256246
|
+
this.requireTaskCapability();
|
|
256247
|
+
return MCPTaskSchema.parse(
|
|
256248
|
+
await this.sendRequest(
|
|
256249
|
+
"tasks/cancel",
|
|
256250
|
+
{ taskId: validateTaskId(taskId) },
|
|
256251
|
+
abortSignal,
|
|
256252
|
+
{ skipModernResultCheck: true }
|
|
256253
|
+
)
|
|
256254
|
+
);
|
|
256255
|
+
}
|
|
256256
|
+
/** Retrieve the underlying tool result after a task reaches a terminal state. */
|
|
256257
|
+
async getTaskResult(taskId, abortSignal) {
|
|
256258
|
+
this.requireTaskCapability();
|
|
256259
|
+
return MCPToolCallResultSchema.parse(
|
|
256260
|
+
await this.sendRequest(
|
|
256261
|
+
"tasks/result",
|
|
256262
|
+
{ taskId: validateTaskId(taskId) },
|
|
256263
|
+
abortSignal,
|
|
256264
|
+
{ skipModernResultCheck: true }
|
|
256265
|
+
)
|
|
256266
|
+
);
|
|
256267
|
+
}
|
|
256268
|
+
/** Poll a durable task with bounded backoff until terminal or input-required. */
|
|
256269
|
+
async waitForTask(taskId, options = {}) {
|
|
256270
|
+
const maxWaitMs = Math.max(
|
|
256271
|
+
1e3,
|
|
256272
|
+
Math.min(options.maxWaitMs ?? 10 * 6e4, 24 * 60 * 6e4)
|
|
256273
|
+
);
|
|
256274
|
+
const deadline = Date.now() + maxWaitMs;
|
|
256275
|
+
while (true) {
|
|
256276
|
+
const task = await this.getTask(taskId, options.abortSignal);
|
|
256277
|
+
if (task.status === "input_required") return { task };
|
|
256278
|
+
if (["completed", "failed", "cancelled"].includes(task.status)) {
|
|
256279
|
+
return {
|
|
256280
|
+
task,
|
|
256281
|
+
result: await this.getTaskResult(task.taskId, options.abortSignal)
|
|
256282
|
+
};
|
|
256283
|
+
}
|
|
256284
|
+
const remaining = deadline - Date.now();
|
|
256285
|
+
if (remaining <= 0) {
|
|
256286
|
+
throw new Error(
|
|
256287
|
+
`MCP task "${task.taskId}" did not finish within ${maxWaitMs}ms.`
|
|
256288
|
+
);
|
|
256289
|
+
}
|
|
256290
|
+
await waitForMcpTaskPoll(
|
|
256291
|
+
Math.min(task.pollInterval ?? 1e3, remaining),
|
|
256292
|
+
options.abortSignal
|
|
256293
|
+
);
|
|
256294
|
+
}
|
|
256295
|
+
}
|
|
256296
|
+
onTaskStatus(listener) {
|
|
256297
|
+
this.taskStatusListeners.add(listener);
|
|
256298
|
+
return () => this.taskStatusListeners.delete(listener);
|
|
256299
|
+
}
|
|
256300
|
+
requireTaskCapability() {
|
|
256301
|
+
if (!this.serverCapabilities.tasks) {
|
|
256302
|
+
throw new Error(
|
|
256303
|
+
`MCP server "${this.serverName}" does not advertise durable task support.`
|
|
256304
|
+
);
|
|
256305
|
+
}
|
|
256306
|
+
}
|
|
256059
256307
|
async negotiateProtocol() {
|
|
256060
256308
|
let rawDiscoverResult;
|
|
256061
256309
|
try {
|
|
@@ -256209,7 +256457,7 @@ var MCPClient = class {
|
|
|
256209
256457
|
);
|
|
256210
256458
|
});
|
|
256211
256459
|
return request.then((result) => {
|
|
256212
|
-
if (modernVersion && method !== "server/discover") {
|
|
256460
|
+
if (modernVersion && method !== "server/discover" && !options.skipModernResultCheck) {
|
|
256213
256461
|
assertCompleteModernResult(result, method);
|
|
256214
256462
|
}
|
|
256215
256463
|
return result;
|
|
@@ -256248,6 +256496,14 @@ var MCPClient = class {
|
|
|
256248
256496
|
}
|
|
256249
256497
|
const notification = MCPNotificationSchema.safeParse(raw);
|
|
256250
256498
|
if (notification.success && typeof raw === "object" && raw !== null && !("id" in raw)) {
|
|
256499
|
+
if (notification.data.method === "notifications/tasks/status") {
|
|
256500
|
+
const task = MCPTaskSchema.safeParse(notification.data.params);
|
|
256501
|
+
if (task.success) {
|
|
256502
|
+
for (const listener of this.taskStatusListeners) {
|
|
256503
|
+
listener(task.data);
|
|
256504
|
+
}
|
|
256505
|
+
}
|
|
256506
|
+
}
|
|
256251
256507
|
const kinds = catalogKindsFromNotification(
|
|
256252
256508
|
notification.data.method,
|
|
256253
256509
|
notification.data.params
|
|
@@ -256337,6 +256593,36 @@ function assertSupportedProtocolVersion(initializeResult) {
|
|
|
256337
256593
|
function safeMessage2(error) {
|
|
256338
256594
|
return sanitizeExternalErrorMessage(error, { singleLine: true });
|
|
256339
256595
|
}
|
|
256596
|
+
function validateTaskId(taskId) {
|
|
256597
|
+
const parsed = z36.string().trim().min(1).max(512).safeParse(taskId);
|
|
256598
|
+
if (!parsed.success)
|
|
256599
|
+
throw new Error("MCP task id must be a non-empty string.");
|
|
256600
|
+
return parsed.data;
|
|
256601
|
+
}
|
|
256602
|
+
function waitForMcpTaskPoll(delayMs, abortSignal) {
|
|
256603
|
+
if (abortSignal?.aborted) {
|
|
256604
|
+
return Promise.reject(createAbortError("MCP task polling was cancelled."));
|
|
256605
|
+
}
|
|
256606
|
+
return new Promise((resolve26, reject) => {
|
|
256607
|
+
let settled = false;
|
|
256608
|
+
const timer = setTimeout(
|
|
256609
|
+
() => {
|
|
256610
|
+
settled = true;
|
|
256611
|
+
abortSignal?.removeEventListener("abort", onAbort);
|
|
256612
|
+
resolve26();
|
|
256613
|
+
},
|
|
256614
|
+
Math.max(1, delayMs)
|
|
256615
|
+
);
|
|
256616
|
+
const onAbort = () => {
|
|
256617
|
+
if (settled) return;
|
|
256618
|
+
settled = true;
|
|
256619
|
+
clearTimeout(timer);
|
|
256620
|
+
abortSignal?.removeEventListener("abort", onAbort);
|
|
256621
|
+
reject(createAbortError("MCP task polling was cancelled."));
|
|
256622
|
+
};
|
|
256623
|
+
abortSignal?.addEventListener("abort", onAbort, { once: true });
|
|
256624
|
+
});
|
|
256625
|
+
}
|
|
256340
256626
|
var DynamicMCPTool = class {
|
|
256341
256627
|
constructor(serverName, toolDefinition, risk, client) {
|
|
256342
256628
|
this.client = client;
|
|
@@ -256514,8 +256800,10 @@ var StreamableHttpMCPClient = class {
|
|
|
256514
256800
|
serverCapabilities = {
|
|
256515
256801
|
tools: false,
|
|
256516
256802
|
resources: false,
|
|
256517
|
-
prompts: false
|
|
256803
|
+
prompts: false,
|
|
256804
|
+
tasks: false
|
|
256518
256805
|
};
|
|
256806
|
+
taskStatusListeners = /* @__PURE__ */ new Set();
|
|
256519
256807
|
async start() {
|
|
256520
256808
|
if (this.started) {
|
|
256521
256809
|
throw new Error(`MCP client "${this.serverName}" has already started.`);
|
|
@@ -256650,6 +256938,116 @@ var StreamableHttpMCPClient = class {
|
|
|
256650
256938
|
);
|
|
256651
256939
|
return flattenPromptMessages(result);
|
|
256652
256940
|
}
|
|
256941
|
+
async callToolTask(originalToolName, args, options = {}) {
|
|
256942
|
+
this.requireTaskCapability();
|
|
256943
|
+
const ttl = options.ttl;
|
|
256944
|
+
if (ttl !== void 0 && (!Number.isSafeInteger(ttl) || ttl < 1 || ttl > 7 * 24 * 60 * 60 * 1e3)) {
|
|
256945
|
+
throw new Error(
|
|
256946
|
+
"MCP task ttl must be an integer between 1ms and 7 days."
|
|
256947
|
+
);
|
|
256948
|
+
}
|
|
256949
|
+
const result = await this.request(
|
|
256950
|
+
"tools/call",
|
|
256951
|
+
{
|
|
256952
|
+
name: originalToolName,
|
|
256953
|
+
arguments: args,
|
|
256954
|
+
task: ttl === void 0 ? {} : { ttl }
|
|
256955
|
+
},
|
|
256956
|
+
options.abortSignal,
|
|
256957
|
+
true,
|
|
256958
|
+
{ skipModernResultCheck: true }
|
|
256959
|
+
);
|
|
256960
|
+
return MCPCreateTaskResultSchema.parse(result).task;
|
|
256961
|
+
}
|
|
256962
|
+
async getTask(taskId, abortSignal) {
|
|
256963
|
+
this.requireTaskCapability();
|
|
256964
|
+
return MCPTaskSchema.parse(
|
|
256965
|
+
await this.request(
|
|
256966
|
+
"tasks/get",
|
|
256967
|
+
{ taskId: validateTaskId2(taskId) },
|
|
256968
|
+
abortSignal,
|
|
256969
|
+
true,
|
|
256970
|
+
{ skipModernResultCheck: true }
|
|
256971
|
+
)
|
|
256972
|
+
);
|
|
256973
|
+
}
|
|
256974
|
+
async listTasks(abortSignal) {
|
|
256975
|
+
this.requireTaskCapability();
|
|
256976
|
+
return collectMcpPaginatedItems({
|
|
256977
|
+
method: "tasks/list",
|
|
256978
|
+
request: (params) => this.request("tasks/list", params, abortSignal, true, {
|
|
256979
|
+
skipModernResultCheck: true
|
|
256980
|
+
}),
|
|
256981
|
+
parse: (value) => {
|
|
256982
|
+
const page = MCPTasksListSchema.parse(value);
|
|
256983
|
+
return { items: page.tasks, nextCursor: page.nextCursor };
|
|
256984
|
+
},
|
|
256985
|
+
identity: (task) => task.taskId,
|
|
256986
|
+
restartOnError: isPaginationSessionReset
|
|
256987
|
+
});
|
|
256988
|
+
}
|
|
256989
|
+
async cancelTask(taskId, abortSignal) {
|
|
256990
|
+
this.requireTaskCapability();
|
|
256991
|
+
return MCPTaskSchema.parse(
|
|
256992
|
+
await this.request(
|
|
256993
|
+
"tasks/cancel",
|
|
256994
|
+
{ taskId: validateTaskId2(taskId) },
|
|
256995
|
+
abortSignal,
|
|
256996
|
+
true,
|
|
256997
|
+
{ skipModernResultCheck: true }
|
|
256998
|
+
)
|
|
256999
|
+
);
|
|
257000
|
+
}
|
|
257001
|
+
async getTaskResult(taskId, abortSignal) {
|
|
257002
|
+
this.requireTaskCapability();
|
|
257003
|
+
return MCPToolCallResultSchema.parse(
|
|
257004
|
+
await this.request(
|
|
257005
|
+
"tasks/result",
|
|
257006
|
+
{ taskId: validateTaskId2(taskId) },
|
|
257007
|
+
abortSignal,
|
|
257008
|
+
true,
|
|
257009
|
+
{ skipModernResultCheck: true }
|
|
257010
|
+
)
|
|
257011
|
+
);
|
|
257012
|
+
}
|
|
257013
|
+
async waitForTask(taskId, options = {}) {
|
|
257014
|
+
const maxWaitMs = Math.max(
|
|
257015
|
+
1e3,
|
|
257016
|
+
Math.min(options.maxWaitMs ?? 10 * 6e4, 24 * 60 * 6e4)
|
|
257017
|
+
);
|
|
257018
|
+
const deadline = Date.now() + maxWaitMs;
|
|
257019
|
+
while (true) {
|
|
257020
|
+
const task = await this.getTask(taskId, options.abortSignal);
|
|
257021
|
+
if (task.status === "input_required") return { task };
|
|
257022
|
+
if (["completed", "failed", "cancelled"].includes(task.status)) {
|
|
257023
|
+
return {
|
|
257024
|
+
task,
|
|
257025
|
+
result: await this.getTaskResult(task.taskId, options.abortSignal)
|
|
257026
|
+
};
|
|
257027
|
+
}
|
|
257028
|
+
const remaining = deadline - Date.now();
|
|
257029
|
+
if (remaining <= 0) {
|
|
257030
|
+
throw new Error(
|
|
257031
|
+
`MCP task "${task.taskId}" did not finish within ${maxWaitMs}ms.`
|
|
257032
|
+
);
|
|
257033
|
+
}
|
|
257034
|
+
await waitForMcpTaskPoll2(
|
|
257035
|
+
Math.min(task.pollInterval ?? 1e3, remaining),
|
|
257036
|
+
options.abortSignal
|
|
257037
|
+
);
|
|
257038
|
+
}
|
|
257039
|
+
}
|
|
257040
|
+
onTaskStatus(listener) {
|
|
257041
|
+
this.taskStatusListeners.add(listener);
|
|
257042
|
+
return () => this.taskStatusListeners.delete(listener);
|
|
257043
|
+
}
|
|
257044
|
+
requireTaskCapability() {
|
|
257045
|
+
if (!this.serverCapabilities.tasks) {
|
|
257046
|
+
throw new Error(
|
|
257047
|
+
`MCP server "${this.serverName}" does not advertise durable task support.`
|
|
257048
|
+
);
|
|
257049
|
+
}
|
|
257050
|
+
}
|
|
256653
257051
|
async callTool(originalToolName, args, abortSignal) {
|
|
256654
257052
|
if (!this.started) {
|
|
256655
257053
|
throw new Error(`MCP client "${this.serverName}" is not connected.`);
|
|
@@ -256728,7 +257126,7 @@ var StreamableHttpMCPClient = class {
|
|
|
256728
257126
|
);
|
|
256729
257127
|
}
|
|
256730
257128
|
const modernVersion = options.modernVersion ?? (this.negotiatedProtocol?.era === "modern" ? this.negotiatedProtocol.version : void 0);
|
|
256731
|
-
if (modernVersion && method !== "server/discover") {
|
|
257129
|
+
if (modernVersion && method !== "server/discover" && !options.skipModernResultCheck) {
|
|
256732
257130
|
assertCompleteModernResult(parsed.data.result, method);
|
|
256733
257131
|
}
|
|
256734
257132
|
this.lastError = void 0;
|
|
@@ -256921,7 +257319,10 @@ var StreamableHttpMCPClient = class {
|
|
|
256921
257319
|
const contentType = response.headers.get("content-type") || "";
|
|
256922
257320
|
return contentType.includes("text/event-stream") ? parseSseJson(
|
|
256923
257321
|
body,
|
|
256924
|
-
typeof payload.id === "number" ? payload.id : void 0
|
|
257322
|
+
typeof payload.id === "number" ? payload.id : void 0,
|
|
257323
|
+
(task) => {
|
|
257324
|
+
for (const listener of this.taskStatusListeners) listener(task);
|
|
257325
|
+
}
|
|
256925
257326
|
) : JSON.parse(body);
|
|
256926
257327
|
} catch (error) {
|
|
256927
257328
|
if (controller.signal.aborted) {
|
|
@@ -257152,10 +257553,14 @@ async function fetchClientCredentialsToken(oauth, abortSignal) {
|
|
|
257152
257553
|
);
|
|
257153
257554
|
return grant.token;
|
|
257154
257555
|
}
|
|
257155
|
-
function parseSseJson(body, expectedId) {
|
|
257556
|
+
function parseSseJson(body, expectedId, onTaskStatus) {
|
|
257156
257557
|
const dataEntries = body.split(/\r?\n/).filter((line) => line.startsWith("data:")).map((line) => line.slice(5).trim()).filter((line) => line && line !== "[DONE]");
|
|
257157
257558
|
for (const data of dataEntries) {
|
|
257158
257559
|
const parsed = JSON.parse(data);
|
|
257560
|
+
if (onTaskStatus && typeof parsed === "object" && parsed !== null && "method" in parsed && parsed.method === "notifications/tasks/status" && !("id" in parsed && typeof parsed.id === "number") && "params" in parsed) {
|
|
257561
|
+
const task = MCPTaskSchema.safeParse(parsed.params);
|
|
257562
|
+
if (task.success) onTaskStatus(task.data);
|
|
257563
|
+
}
|
|
257159
257564
|
if (expectedId === void 0 || typeof parsed === "object" && parsed !== null && "id" in parsed && parsed.id === expectedId) {
|
|
257160
257565
|
return parsed;
|
|
257161
257566
|
}
|
|
@@ -257165,6 +257570,40 @@ function parseSseJson(body, expectedId) {
|
|
|
257165
257570
|
function safeMessage22(value) {
|
|
257166
257571
|
return sanitizeExternalErrorMessage(value, { singleLine: true });
|
|
257167
257572
|
}
|
|
257573
|
+
function validateTaskId2(taskId) {
|
|
257574
|
+
const parsed = z44.string().trim().min(1).max(512).safeParse(taskId);
|
|
257575
|
+
if (!parsed.success)
|
|
257576
|
+
throw new Error("MCP task id must be a non-empty string.");
|
|
257577
|
+
return parsed.data;
|
|
257578
|
+
}
|
|
257579
|
+
function waitForMcpTaskPoll2(delayMs, abortSignal) {
|
|
257580
|
+
if (abortSignal?.aborted) {
|
|
257581
|
+
const error = new Error("MCP task polling was cancelled.");
|
|
257582
|
+
error.name = "AbortError";
|
|
257583
|
+
return Promise.reject(error);
|
|
257584
|
+
}
|
|
257585
|
+
return new Promise((resolve26, reject) => {
|
|
257586
|
+
let settled = false;
|
|
257587
|
+
const timer = setTimeout(
|
|
257588
|
+
() => {
|
|
257589
|
+
settled = true;
|
|
257590
|
+
abortSignal?.removeEventListener("abort", onAbort);
|
|
257591
|
+
resolve26();
|
|
257592
|
+
},
|
|
257593
|
+
Math.max(1, delayMs)
|
|
257594
|
+
);
|
|
257595
|
+
const onAbort = () => {
|
|
257596
|
+
if (settled) return;
|
|
257597
|
+
settled = true;
|
|
257598
|
+
clearTimeout(timer);
|
|
257599
|
+
abortSignal?.removeEventListener("abort", onAbort);
|
|
257600
|
+
const error = new Error("MCP task polling was cancelled.");
|
|
257601
|
+
error.name = "AbortError";
|
|
257602
|
+
reject(error);
|
|
257603
|
+
};
|
|
257604
|
+
abortSignal?.addEventListener("abort", onAbort, { once: true });
|
|
257605
|
+
});
|
|
257606
|
+
}
|
|
257168
257607
|
function assertSecureMcpUrl(value, label) {
|
|
257169
257608
|
const url = new URL(value);
|
|
257170
257609
|
const hostname = url.hostname.toLowerCase().replace(/^\[|\]$/g, "");
|
|
@@ -257662,7 +258101,7 @@ var PermissionEngine = class {
|
|
|
257662
258101
|
"replace_file_content",
|
|
257663
258102
|
"multi_replace_file_content"
|
|
257664
258103
|
]);
|
|
257665
|
-
const safeArgs =
|
|
258104
|
+
const safeArgs = isRecord4(args) ? args : {};
|
|
257666
258105
|
if (toolName === "update_plan") {
|
|
257667
258106
|
return {
|
|
257668
258107
|
action: "allow",
|
|
@@ -257921,7 +258360,7 @@ var PermissionEngine = class {
|
|
|
257921
258360
|
};
|
|
257922
258361
|
}
|
|
257923
258362
|
};
|
|
257924
|
-
function
|
|
258363
|
+
function isRecord4(value) {
|
|
257925
258364
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
257926
258365
|
}
|
|
257927
258366
|
function firstString(...values) {
|
|
@@ -265209,7 +265648,8 @@ Note: To find where a symbol (class, function, etc.) is declared or referenced,
|
|
|
265209
265648
|
const supportsThinking = capabilities.thinking;
|
|
265210
265649
|
const thinkingPolicy = resolveModelThinkingPolicy(activeModel2, {
|
|
265211
265650
|
isComplexTask,
|
|
265212
|
-
isRepairTurn
|
|
265651
|
+
isRepairTurn,
|
|
265652
|
+
requestedEffort: this.options?.thinkingEffort
|
|
265213
265653
|
});
|
|
265214
265654
|
const thinkingEnabled = supportsThinking ? thinkingPolicy?.enabled ?? Boolean(isRepairTurn || isComplexTask) : false;
|
|
265215
265655
|
if (!this.resolvePricing(activeModel2)) {
|
|
@@ -269074,6 +269514,7 @@ var Orchestrator = class {
|
|
|
269074
269514
|
this.interaction,
|
|
269075
269515
|
{
|
|
269076
269516
|
modelOverride: this.profile?.model || this.config.models.planner,
|
|
269517
|
+
thinkingEffort: this.profile?.effort,
|
|
269077
269518
|
systemPromptOverride: `You are the Orbit Planner Agent.
|
|
269078
269519
|
Analyze the codebase and produce a bounded implementation plan. Do not modify files.
|
|
269079
269520
|
Return ONLY one JSON object with this shape:
|
|
@@ -269179,6 +269620,7 @@ Work only in your assigned isolated worktree and only inside the declared write
|
|
|
269179
269620
|
this.interaction,
|
|
269180
269621
|
{
|
|
269181
269622
|
modelOverride: this.profile?.model || this.config.models.coder,
|
|
269623
|
+
thinkingEffort: this.profile?.effort,
|
|
269182
269624
|
systemPromptOverride: [systemPrompt, this.profile?.systemPrompt].filter(Boolean).join("\n\n"),
|
|
269183
269625
|
allowedTools: applyProfileToolPolicy(this.profile, [
|
|
269184
269626
|
"read_file",
|
|
@@ -269438,6 +269880,7 @@ Work only in your assigned isolated worktree and only inside the declared write
|
|
|
269438
269880
|
this.interaction,
|
|
269439
269881
|
{
|
|
269440
269882
|
modelOverride: this.config.models.reviewer,
|
|
269883
|
+
thinkingEffort: this.profile?.effort,
|
|
269441
269884
|
systemPromptOverride: `You are the Orbit Reviewer Agent.
|
|
269442
269885
|
Your assigned perspective is ${perspective}. ${instruction}
|
|
269443
269886
|
Review the current workspace diff and run tests when useful. Do not edit files.
|
|
@@ -280170,6 +280613,8 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
280170
280613
|
disconnected: '连接断开',
|
|
280171
280614
|
retry: '立即重试',
|
|
280172
280615
|
ready: '准备就绪',
|
|
280616
|
+
waitingApproval: '等待审批',
|
|
280617
|
+
cancelling: '正在取消',
|
|
280173
280618
|
thinking: 'Orbit 正在思考…',
|
|
280174
280619
|
sendAction: '发送消息',
|
|
280175
280620
|
stopAction: '停止生成',
|
|
@@ -280324,6 +280769,8 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
280324
280769
|
disconnected: 'Disconnected',
|
|
280325
280770
|
retry: 'Retry now',
|
|
280326
280771
|
ready: 'Ready',
|
|
280772
|
+
waitingApproval: 'Waiting for approval',
|
|
280773
|
+
cancelling: 'Cancelling',
|
|
280327
280774
|
thinking: 'Orbit is thinking…',
|
|
280328
280775
|
sendAction: 'Send message',
|
|
280329
280776
|
stopAction: 'Stop generating',
|
|
@@ -280480,6 +280927,8 @@ var WEB_UI_CLIENT_FOUNDATION_SCRIPT = String.raw` const byId = (id) => document
|
|
|
280480
280927
|
disconnected: '連線中斷',
|
|
280481
280928
|
retry: '立即重試',
|
|
280482
280929
|
ready: '準備就緒',
|
|
280930
|
+
waitingApproval: '等待審批',
|
|
280931
|
+
cancelling: '正在取消',
|
|
280483
280932
|
thinking: 'Orbit 正在思考…',
|
|
280484
280933
|
stopping: '正在停止…',
|
|
280485
280934
|
stopped: '已停止產生',
|
|
@@ -282359,7 +282808,7 @@ function createMissionControl(runtime) {
|
|
|
282359
282808
|
const activeSession = session.recent.find((candidate) => candidate.active);
|
|
282360
282809
|
const active = Boolean(data.turn?.active);
|
|
282361
282810
|
const workActive = active || activeAgents > 0 || activeBackgroundTasks > 0;
|
|
282362
|
-
const statusLabel = workActive ? copy.running : agents.some((agent) => agent.status === "blocked") ? language === "en" ? "Blocked" : chinese("\u5DF2\u963B\u585E", "\u5DF2\u963B\u585E") : copy.ready;
|
|
282811
|
+
const statusLabel = data.task.status === "waiting_approval" ? copy.waitingApproval : data.task.status === "cancelling" ? copy.cancelling : workActive ? copy.running : agents.some((agent) => agent.status === "blocked") ? language === "en" ? "Blocked" : chinese("\u5DF2\u963B\u585E", "\u5DF2\u963B\u585E") : copy.ready;
|
|
282363
282812
|
const titleText = activeSession?.title || copy.untitledTask;
|
|
282364
282813
|
const goalText = session.goal || (language === "en" ? "Add a durable goal with /goal so Orbit can keep long work aligned." : chinese(
|
|
282365
282814
|
"\u4F7F\u7528 /goal \u6DFB\u52A0\u6301\u7EED\u76EE\u6807\uFF0C\u8BA9 Orbit \u5728\u957F\u4EFB\u52A1\u4E2D\u4FDD\u6301\u65B9\u5411\u3002",
|
|
@@ -282379,6 +282828,14 @@ function createMissionControl(runtime) {
|
|
|
282379
282828
|
heading.append(title, status);
|
|
282380
282829
|
const goal = document.createElement("p");
|
|
282381
282830
|
goal.textContent = goalText;
|
|
282831
|
+
if (data.task.reason) {
|
|
282832
|
+
const reason = document.createElement("small");
|
|
282833
|
+
reason.className = "task-overview-reason";
|
|
282834
|
+
reason.textContent = data.task.reason;
|
|
282835
|
+
card.append(heading, goal, reason);
|
|
282836
|
+
} else {
|
|
282837
|
+
card.append(heading, goal);
|
|
282838
|
+
}
|
|
282382
282839
|
const stats = document.createElement("dl");
|
|
282383
282840
|
stats.className = "task-overview-stats";
|
|
282384
282841
|
const rows = [
|
|
@@ -282414,7 +282871,7 @@ function createMissionControl(runtime) {
|
|
|
282414
282871
|
item.append(term, description, small);
|
|
282415
282872
|
stats.append(item);
|
|
282416
282873
|
}
|
|
282417
|
-
card.append(
|
|
282874
|
+
card.append(stats);
|
|
282418
282875
|
elements.taskOverview.replaceChildren(card);
|
|
282419
282876
|
}
|
|
282420
282877
|
function renderAgentRuns(value) {
|
|
@@ -284632,7 +285089,7 @@ var WEB_UI_PROJECT_ERROR_CODE_SET = new Set(
|
|
|
284632
285089
|
WEB_UI_PROJECT_ERROR_CODES
|
|
284633
285090
|
);
|
|
284634
285091
|
function sanitizeWebEventPayload(type, payload) {
|
|
284635
|
-
if (!
|
|
285092
|
+
if (!isRecord5(payload)) return void 0;
|
|
284636
285093
|
switch (type) {
|
|
284637
285094
|
case "ui_turn_started":
|
|
284638
285095
|
return {
|
|
@@ -284886,7 +285343,7 @@ function summarizeWebToolValue(value, options = {}) {
|
|
|
284886
285343
|
return options.allowPlainText ? safeWebToolText(candidate, 700) : "";
|
|
284887
285344
|
}
|
|
284888
285345
|
}
|
|
284889
|
-
if (!
|
|
285346
|
+
if (!isRecord5(candidate)) return "";
|
|
284890
285347
|
const safeFields = [
|
|
284891
285348
|
"path",
|
|
284892
285349
|
"filePath",
|
|
@@ -284987,7 +285444,7 @@ function readCookie(req, name) {
|
|
|
284987
285444
|
return "";
|
|
284988
285445
|
}
|
|
284989
285446
|
function sanitizeTokenUsage(value) {
|
|
284990
|
-
if (!
|
|
285447
|
+
if (!isRecord5(value)) return void 0;
|
|
284991
285448
|
return {
|
|
284992
285449
|
inputTokens: safeNumber(value.inputTokens),
|
|
284993
285450
|
outputTokens: safeNumber(value.outputTokens),
|
|
@@ -285014,7 +285471,7 @@ function safeWebToolText(value, maxLength) {
|
|
|
285014
285471
|
function stripAnsi2(value) {
|
|
285015
285472
|
return value.replace(/\u001b\[[0-9;]*m/g, "");
|
|
285016
285473
|
}
|
|
285017
|
-
function
|
|
285474
|
+
function isRecord5(value) {
|
|
285018
285475
|
return typeof value === "object" && value !== null;
|
|
285019
285476
|
}
|
|
285020
285477
|
|
|
@@ -285022,7 +285479,7 @@ function isRecord4(value) {
|
|
|
285022
285479
|
function summarizeWebUiAgentRuns(value) {
|
|
285023
285480
|
if (!Array.isArray(value)) return [];
|
|
285024
285481
|
return value.slice(0, 12).flatMap((candidate) => {
|
|
285025
|
-
if (!
|
|
285482
|
+
if (!isRecord6(candidate) || !Array.isArray(candidate.agents)) return [];
|
|
285026
285483
|
const id = boundedString(candidate.id, 128);
|
|
285027
285484
|
if (!/^run_[a-z0-9-]+$/.test(id)) return [];
|
|
285028
285485
|
return [
|
|
@@ -285039,7 +285496,7 @@ function summarizeWebUiAgentRuns(value) {
|
|
|
285039
285496
|
costUsd: finiteNumber(candidate.costUsd),
|
|
285040
285497
|
updatedAt: boundedString(candidate.updatedAt, 64),
|
|
285041
285498
|
agents: candidate.agents.slice(0, 64).flatMap((agent) => {
|
|
285042
|
-
if (!
|
|
285499
|
+
if (!isRecord6(agent)) return [];
|
|
285043
285500
|
const agentId = boundedString(agent.id, 128);
|
|
285044
285501
|
if (!/^agent_[a-z0-9-]+$/.test(agentId)) return [];
|
|
285045
285502
|
return [
|
|
@@ -285061,13 +285518,13 @@ function summarizeWebUiAgentRuns(value) {
|
|
|
285061
285518
|
) ? boundedString(agent.sessionId, 128) : "",
|
|
285062
285519
|
budgetUsd: finiteNumber(agent.budgetUsd),
|
|
285063
285520
|
costUsd: finiteNumber(agent.costUsd),
|
|
285064
|
-
access:
|
|
285065
|
-
scopes:
|
|
285521
|
+
access: isRecord6(agent.access) && agent.access.mode === "write" ? "write" : "read",
|
|
285522
|
+
scopes: isRecord6(agent.access) && Array.isArray(agent.access.scopes) ? agent.access.scopes.slice(0, 20).map((scope) => redactSecrets(boundedString(scope, 300))) : [],
|
|
285066
285523
|
startedAt: boundedString(agent.startedAt, 64),
|
|
285067
285524
|
endedAt: boundedString(agent.endedAt, 64),
|
|
285068
285525
|
error: redactSecrets(boundedString(agent.error, 1e3)),
|
|
285069
|
-
steeringCount:
|
|
285070
|
-
lastSteeredAt:
|
|
285526
|
+
steeringCount: isRecord6(agent.steering) && typeof agent.steering.count === "number" && Number.isFinite(agent.steering.count) ? Math.max(0, Math.floor(agent.steering.count)) : 0,
|
|
285527
|
+
lastSteeredAt: isRecord6(agent.steering) && typeof agent.steering.lastAt === "string" ? boundedString(agent.steering.lastAt, 64) : ""
|
|
285071
285528
|
}
|
|
285072
285529
|
];
|
|
285073
285530
|
})
|
|
@@ -285084,7 +285541,7 @@ function boundedString(value, maxLength) {
|
|
|
285084
285541
|
function boundedEnum(value, values) {
|
|
285085
285542
|
return typeof value === "string" && values.includes(value) ? value : "unknown";
|
|
285086
285543
|
}
|
|
285087
|
-
function
|
|
285544
|
+
function isRecord6(value) {
|
|
285088
285545
|
return typeof value === "object" && value !== null;
|
|
285089
285546
|
}
|
|
285090
285547
|
|
|
@@ -285111,7 +285568,7 @@ function summarizeWebUiContextFiles(value, limit = 24) {
|
|
|
285111
285568
|
const seen = /* @__PURE__ */ new Set();
|
|
285112
285569
|
if (Array.isArray(value)) {
|
|
285113
285570
|
for (const candidate of value) {
|
|
285114
|
-
if (!
|
|
285571
|
+
if (!isRecord7(candidate)) continue;
|
|
285115
285572
|
const path9 = normalizeSafeWebUiPath(candidate.path);
|
|
285116
285573
|
if (!path9 || seen.has(path9)) continue;
|
|
285117
285574
|
seen.add(path9);
|
|
@@ -285170,6 +285627,9 @@ function collectWebUiStatus(options, activeTurn) {
|
|
|
285170
285627
|
const review = summarizeWebUiReview(
|
|
285171
285628
|
safeCall(() => loop?.getSessionReview?.())
|
|
285172
285629
|
);
|
|
285630
|
+
const approval = collectWebUiApproval(
|
|
285631
|
+
safeCall(() => options.getPendingApproval?.())
|
|
285632
|
+
);
|
|
285173
285633
|
const contextFiles = summarizeWebUiContextFiles(relevantFiles);
|
|
285174
285634
|
const normalizedSessions = normalizeSessions(sessions, sessionId);
|
|
285175
285635
|
const recentSessions = normalizedSessions.filter(
|
|
@@ -285193,6 +285653,10 @@ function collectWebUiStatus(options, activeTurn) {
|
|
|
285193
285653
|
workspace: cwd,
|
|
285194
285654
|
projects,
|
|
285195
285655
|
agentRuns,
|
|
285656
|
+
task: {
|
|
285657
|
+
status: activeTurn?.cancelRequested ? "cancelling" : approval ? "waiting_approval" : activeTurn ? "running" : "ready",
|
|
285658
|
+
reason: approval?.reason || ""
|
|
285659
|
+
},
|
|
285196
285660
|
agentTeam: {
|
|
285197
285661
|
preset: config.agent.teamPreset,
|
|
285198
285662
|
maxReviewAttempts: config.agent.maxReviewAttempts,
|
|
@@ -285314,9 +285778,7 @@ function collectWebUiStatus(options, activeTurn) {
|
|
|
285314
285778
|
startedAt: activeTurn.startedAt,
|
|
285315
285779
|
cancelRequested: activeTurn.cancelRequested
|
|
285316
285780
|
} : { active: false },
|
|
285317
|
-
approval
|
|
285318
|
-
safeCall(() => options.getPendingApproval?.())
|
|
285319
|
-
),
|
|
285781
|
+
approval,
|
|
285320
285782
|
cacheDiagnostics: redactSecrets(stripAnsi3(buildCacheDiagnostics(cwd))),
|
|
285321
285783
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
285322
285784
|
};
|
|
@@ -285329,7 +285791,7 @@ function summarizeWebUiBackgroundTasks(value) {
|
|
|
285329
285791
|
"killed",
|
|
285330
285792
|
"timed_out"
|
|
285331
285793
|
]);
|
|
285332
|
-
return (Array.isArray(value) ? value : []).filter(
|
|
285794
|
+
return (Array.isArray(value) ? value : []).filter(isRecord7).slice(0, 64).map((task) => ({
|
|
285333
285795
|
id: safeLabel(typeof task.id === "string" ? task.id : "", 200),
|
|
285334
285796
|
status: typeof task.status === "string" && statuses.has(task.status) ? task.status : "failed",
|
|
285335
285797
|
startedAt: safeLabel(
|
|
@@ -285345,7 +285807,7 @@ function summarizeWebUiBackgroundTasks(value) {
|
|
|
285345
285807
|
function summarizeWebUiInputQueue(value) {
|
|
285346
285808
|
const modes = /* @__PURE__ */ new Set(["follow_up", "steer"]);
|
|
285347
285809
|
const sources = /* @__PURE__ */ new Set(["terminal", "web", "api"]);
|
|
285348
|
-
return (Array.isArray(value) ? value : []).filter(
|
|
285810
|
+
return (Array.isArray(value) ? value : []).filter(isRecord7).slice(0, 12).map((item) => ({
|
|
285349
285811
|
id: safeLabel(typeof item.id === "string" ? item.id : "", 200),
|
|
285350
285812
|
mode: typeof item.mode === "string" && modes.has(item.mode) ? item.mode : "follow_up",
|
|
285351
285813
|
source: typeof item.source === "string" && sources.has(item.source) ? item.source : "api",
|
|
@@ -285364,12 +285826,12 @@ function summarizeWebUiInputQueue(value) {
|
|
|
285364
285826
|
})).filter((item) => item.id && item.text);
|
|
285365
285827
|
}
|
|
285366
285828
|
function summarizeWebUiReview(value) {
|
|
285367
|
-
const record =
|
|
285829
|
+
const record = isRecord7(value) ? value : {};
|
|
285368
285830
|
const rawChanges = Array.isArray(record.fileChanges) ? record.fileChanges : [];
|
|
285369
285831
|
const rawToolCalls = Array.isArray(record.toolCalls) ? record.toolCalls : [];
|
|
285370
285832
|
const rawCheckpoints = Array.isArray(record.checkpoints) ? record.checkpoints : [];
|
|
285371
285833
|
const rawVerification = Array.isArray(record.verification) ? record.verification : [];
|
|
285372
|
-
const fileChanges = rawChanges.filter(
|
|
285834
|
+
const fileChanges = rawChanges.filter(isRecord7).slice(-80).reverse().map((change) => ({
|
|
285373
285835
|
id: safeLabel(typeof change.id === "string" ? change.id : "", 200),
|
|
285374
285836
|
path: normalizeSafeWebUiPath(change.path) || "unknown",
|
|
285375
285837
|
diff: redactSecrets(stripAnsi3(String(change.diff || ""))).slice(
|
|
@@ -285381,7 +285843,7 @@ function summarizeWebUiReview(value) {
|
|
|
285381
285843
|
100
|
|
285382
285844
|
)
|
|
285383
285845
|
})).filter((change) => change.id && change.path !== "unknown");
|
|
285384
|
-
const checkpoints = rawCheckpoints.filter(
|
|
285846
|
+
const checkpoints = rawCheckpoints.filter(isRecord7).slice(-40).reverse().map((checkpoint) => ({
|
|
285385
285847
|
id: safeLabel(
|
|
285386
285848
|
typeof checkpoint.id === "string" ? checkpoint.id : "",
|
|
285387
285849
|
200
|
|
@@ -285396,7 +285858,7 @@ function summarizeWebUiReview(value) {
|
|
|
285396
285858
|
),
|
|
285397
285859
|
files: (Array.isArray(checkpoint.files) ? checkpoint.files : []).map((path9) => normalizeSafeWebUiPath(path9)).filter((path9) => Boolean(path9)).slice(0, 50)
|
|
285398
285860
|
})).filter((checkpoint) => checkpoint.id);
|
|
285399
|
-
const verification = rawVerification.filter(
|
|
285861
|
+
const verification = rawVerification.filter(isRecord7).slice(-20).reverse().map((entry) => ({
|
|
285400
285862
|
timestamp: safeLabel(
|
|
285401
285863
|
typeof entry.timestamp === "string" ? entry.timestamp : "",
|
|
285402
285864
|
100
|
|
@@ -285404,7 +285866,7 @@ function summarizeWebUiReview(value) {
|
|
|
285404
285866
|
success: typeof entry.success === "boolean" ? entry.success : void 0,
|
|
285405
285867
|
detail: typeof entry.detail === "string" ? redactSecrets(stripAnsi3(entry.detail)).slice(0, 2e3) : void 0
|
|
285406
285868
|
}));
|
|
285407
|
-
const toolCalls = rawToolCalls.filter(
|
|
285869
|
+
const toolCalls = rawToolCalls.filter(isRecord7).slice(-100).reverse().map((tool) => {
|
|
285408
285870
|
const startedAt = safeLabel(
|
|
285409
285871
|
typeof tool.startedAt === "string" ? tool.startedAt : "",
|
|
285410
285872
|
100
|
|
@@ -285437,7 +285899,7 @@ function summarizeWebUiReview(value) {
|
|
|
285437
285899
|
return { fileChanges, toolCalls, checkpoints, verification };
|
|
285438
285900
|
}
|
|
285439
285901
|
function collectWebUiApproval(value) {
|
|
285440
|
-
if (!
|
|
285902
|
+
if (!isRecord7(value)) return void 0;
|
|
285441
285903
|
if (typeof value.id !== "string" || !["tool", "change", "action"].includes(String(value.kind))) {
|
|
285442
285904
|
return void 0;
|
|
285443
285905
|
}
|
|
@@ -285466,7 +285928,7 @@ function safeApprovalText(value, maxLength, preserveLines) {
|
|
|
285466
285928
|
}
|
|
285467
285929
|
function normalizeSessions(sessions, activeId) {
|
|
285468
285930
|
if (!Array.isArray(sessions)) return [];
|
|
285469
|
-
return sessions.filter(
|
|
285931
|
+
return sessions.filter(isRecord7).map((session) => ({
|
|
285470
285932
|
id: typeof session.id === "string" ? session.id : "",
|
|
285471
285933
|
title: typeof session.title === "string" && session.title.trim() ? redactSecrets(session.title.trim()).slice(0, 160) : "Untitled task",
|
|
285472
285934
|
model: typeof session.model === "string" ? session.model : "",
|
|
@@ -285594,8 +286056,8 @@ function buildModelOptions(options, activeModel2) {
|
|
|
285594
286056
|
return safeCall(() => options.loop?.getModelOverride?.()) ? [discovered[0], automatic, ...discovered.slice(1)] : [automatic, ...discovered];
|
|
285595
286057
|
}
|
|
285596
286058
|
function normalizeMessage(message2, index) {
|
|
285597
|
-
const record =
|
|
285598
|
-
const metadata =
|
|
286059
|
+
const record = isRecord7(message2) ? message2 : {};
|
|
286060
|
+
const metadata = isRecord7(record.metadata) ? record.metadata : {};
|
|
285599
286061
|
const role = record.role === "user" || record.role === "assistant" || record.role === "tool" ? record.role : "assistant";
|
|
285600
286062
|
const blocks = normalizeMessageBlocks(record.content);
|
|
285601
286063
|
return {
|
|
@@ -285614,7 +286076,7 @@ function normalizeMessageBlocks(content) {
|
|
|
285614
286076
|
if (!Array.isArray(content)) return [];
|
|
285615
286077
|
const blocks = [];
|
|
285616
286078
|
for (const candidate of content) {
|
|
285617
|
-
if (!
|
|
286079
|
+
if (!isRecord7(candidate)) continue;
|
|
285618
286080
|
if (candidate.type === "text" && typeof candidate.text === "string") {
|
|
285619
286081
|
blocks.push({ type: "text", text: candidate.text });
|
|
285620
286082
|
continue;
|
|
@@ -285631,7 +286093,7 @@ function normalizeMessageBlocks(content) {
|
|
|
285631
286093
|
});
|
|
285632
286094
|
continue;
|
|
285633
286095
|
}
|
|
285634
|
-
if (candidate.type === "tool_call" &&
|
|
286096
|
+
if (candidate.type === "tool_call" && isRecord7(candidate.toolCall)) {
|
|
285635
286097
|
blocks.push({
|
|
285636
286098
|
type: "tool",
|
|
285637
286099
|
id: typeof candidate.toolCall.id === "string" ? candidate.toolCall.id : "",
|
|
@@ -285641,7 +286103,7 @@ function normalizeMessageBlocks(content) {
|
|
|
285641
286103
|
});
|
|
285642
286104
|
continue;
|
|
285643
286105
|
}
|
|
285644
|
-
if (candidate.type === "tool_result" &&
|
|
286106
|
+
if (candidate.type === "tool_result" && isRecord7(candidate.toolResult)) {
|
|
285645
286107
|
const isError = candidate.toolResult.isError === true;
|
|
285646
286108
|
blocks.push({
|
|
285647
286109
|
type: "tool",
|
|
@@ -285733,9 +286195,9 @@ function successfulToolSummary(toolName, value) {
|
|
|
285733
286195
|
return {};
|
|
285734
286196
|
}
|
|
285735
286197
|
function isInternalWebMessage(message2) {
|
|
285736
|
-
if (!
|
|
286198
|
+
if (!isRecord7(message2)) return true;
|
|
285737
286199
|
if (message2.role === "system") return true;
|
|
285738
|
-
const metadata =
|
|
286200
|
+
const metadata = isRecord7(message2.metadata) ? message2.metadata : {};
|
|
285739
286201
|
return metadata.kind === "orbit_volatile_context" || metadata.kind === "history_compaction_summary";
|
|
285740
286202
|
}
|
|
285741
286203
|
function safeCall(fn) {
|
|
@@ -285751,7 +286213,7 @@ function finiteNumber2(value) {
|
|
|
285751
286213
|
function stripAnsi3(value) {
|
|
285752
286214
|
return value.replace(/\u001b\[[0-9;]*m/g, "");
|
|
285753
286215
|
}
|
|
285754
|
-
function
|
|
286216
|
+
function isRecord7(value) {
|
|
285755
286217
|
return typeof value === "object" && value !== null;
|
|
285756
286218
|
}
|
|
285757
286219
|
|
|
@@ -290874,6 +291336,14 @@ var WEB_UI_INSPECTOR_STYLES = String.raw`
|
|
|
290874
291336
|
line-height: 1.5;
|
|
290875
291337
|
}
|
|
290876
291338
|
|
|
291339
|
+
.task-overview-reason {
|
|
291340
|
+
display: block;
|
|
291341
|
+
margin-top: -5px;
|
|
291342
|
+
color: var(--warning-strong, var(--accent-strong));
|
|
291343
|
+
font-size: 9px;
|
|
291344
|
+
line-height: 1.45;
|
|
291345
|
+
}
|
|
291346
|
+
|
|
290877
291347
|
.task-overview-stats {
|
|
290878
291348
|
display: grid;
|
|
290879
291349
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
@@ -295245,7 +295715,7 @@ Running shell command: ${shellCommand}...`)
|
|
|
295245
295715
|
import picocolors11 from "picocolors";
|
|
295246
295716
|
|
|
295247
295717
|
// src/runtime/ConfigObjectPath.ts
|
|
295248
|
-
function
|
|
295718
|
+
function isRecord8(value) {
|
|
295249
295719
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
295250
295720
|
}
|
|
295251
295721
|
var blockedSegments = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
|
|
@@ -295261,7 +295731,7 @@ function getNestedProperty(root, path9) {
|
|
|
295261
295731
|
if (!parts) return void 0;
|
|
295262
295732
|
let current = root;
|
|
295263
295733
|
for (const part of parts) {
|
|
295264
|
-
if (!
|
|
295734
|
+
if (!isRecord8(current) || !Object.hasOwn(current, part)) return void 0;
|
|
295265
295735
|
current = current[part];
|
|
295266
295736
|
}
|
|
295267
295737
|
return current;
|
|
@@ -295272,7 +295742,7 @@ function setNestedProperty(root, path9, value) {
|
|
|
295272
295742
|
let current = root;
|
|
295273
295743
|
for (const part of parts.slice(0, -1)) {
|
|
295274
295744
|
const child = current[part];
|
|
295275
|
-
if (!
|
|
295745
|
+
if (!isRecord8(child)) {
|
|
295276
295746
|
current[part] = {};
|
|
295277
295747
|
}
|
|
295278
295748
|
current = current[part];
|
|
@@ -301070,6 +301540,7 @@ Risk Warning: ${reason}`);
|
|
|
301070
301540
|
interaction,
|
|
301071
301541
|
{
|
|
301072
301542
|
modelOverride: explicitModelOverride,
|
|
301543
|
+
thinkingEffort: selectedProfile?.effort,
|
|
301073
301544
|
sessionId: options?.resumeSessionId,
|
|
301074
301545
|
requireSession: Boolean(options?.resumeSessionId),
|
|
301075
301546
|
disableStatusBar: !!options?.nonInteractive || !!options?.jsonl,
|
|
@@ -301124,7 +301595,7 @@ function configureJsonlOutput() {
|
|
|
301124
301595
|
schemaVersion: ORBIT_EVENT_SCHEMA_VERSION,
|
|
301125
301596
|
sequence: ++sequence,
|
|
301126
301597
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
301127
|
-
...
|
|
301598
|
+
...isRecord9(sanitized) ? sanitized : { type: "unknown", payload: {} }
|
|
301128
301599
|
})
|
|
301129
301600
|
);
|
|
301130
301601
|
};
|
|
@@ -301138,8 +301609,8 @@ function configureJsonlOutput() {
|
|
|
301138
301609
|
};
|
|
301139
301610
|
}
|
|
301140
301611
|
function sanitizeJsonlEvent(event) {
|
|
301141
|
-
if (!
|
|
301142
|
-
const payload =
|
|
301612
|
+
if (!isRecord9(event) || typeof event.type !== "string") return {};
|
|
301613
|
+
const payload = isRecord9(event.payload) ? event.payload : {};
|
|
301143
301614
|
const metadata = {
|
|
301144
301615
|
...typeof event.eventId === "string" ? { eventId: event.eventId } : {},
|
|
301145
301616
|
...typeof event.timestamp === "string" ? { timestamp: event.timestamp } : {}
|
|
@@ -301184,12 +301655,12 @@ function sanitizeJsonlEvent(event) {
|
|
|
301184
301655
|
function redactJsonValue(value) {
|
|
301185
301656
|
if (typeof value === "string") return redactSecrets(value);
|
|
301186
301657
|
if (Array.isArray(value)) return value.map(redactJsonValue);
|
|
301187
|
-
if (!
|
|
301658
|
+
if (!isRecord9(value)) return value;
|
|
301188
301659
|
return Object.fromEntries(
|
|
301189
301660
|
Object.entries(value).map(([key, item]) => [key, redactJsonValue(item)])
|
|
301190
301661
|
);
|
|
301191
301662
|
}
|
|
301192
|
-
function
|
|
301663
|
+
function isRecord9(value) {
|
|
301193
301664
|
return typeof value === "object" && value !== null;
|
|
301194
301665
|
}
|
|
301195
301666
|
|
|
@@ -302036,6 +302507,7 @@ function runAgentsCommand(action, options = {}) {
|
|
|
302036
302507
|
directories: catalog.directories,
|
|
302037
302508
|
profiles: catalog.profiles.map((profile) => ({
|
|
302038
302509
|
name: profile.name,
|
|
302510
|
+
extends: profile.extends,
|
|
302039
302511
|
displayName: profile.displayName,
|
|
302040
302512
|
description: profile.description,
|
|
302041
302513
|
provider: profile.provider,
|
|
@@ -302045,6 +302517,7 @@ function runAgentsCommand(action, options = {}) {
|
|
|
302045
302517
|
disallowedTools: profile.disallowedTools,
|
|
302046
302518
|
skills: profile.skills,
|
|
302047
302519
|
maxTurns: profile.maxTurns,
|
|
302520
|
+
effort: profile.effort,
|
|
302048
302521
|
isolation: profile.isolation,
|
|
302049
302522
|
memory: profile.memory,
|
|
302050
302523
|
path: profile.path,
|
|
@@ -302063,8 +302536,10 @@ function runAgentsCommand(action, options = {}) {
|
|
|
302063
302536
|
for (const profile of catalog.profiles) {
|
|
302064
302537
|
const model = profile.model ? ` \xB7 model=${profile.model}` : "";
|
|
302065
302538
|
const mode = profile.permissionMode ? ` \xB7 mode=${profile.permissionMode}` : "";
|
|
302539
|
+
const effort = profile.effort ? ` \xB7 effort=${profile.effort}` : "";
|
|
302540
|
+
const parent = profile.extends ? ` \xB7 extends=${profile.extends}` : "";
|
|
302066
302541
|
console.log(
|
|
302067
|
-
`${picocolors25.green(profile.name)}${picocolors25.gray(`${model}${mode}`)}`
|
|
302542
|
+
`${picocolors25.green(profile.name)}${picocolors25.gray(`${model}${mode}${effort}${parent}`)}`
|
|
302068
302543
|
);
|
|
302069
302544
|
if (profile.description) console.log(` ${profile.description}`);
|
|
302070
302545
|
console.log(picocolors25.gray(` ${profile.source} \xB7 ${profile.path}`));
|