@cydm/pie 2.4.0 → 2.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/builtin/extensions/ask-user/index.js +1 -1
- package/dist/builtin/extensions/plan-mode/index.js +1 -1
- package/dist/builtin/extensions/subagent/index.js +3 -2
- package/dist/builtin/extensions/todo/index.js +1 -1
- package/dist/chunks/{chunk-FKUEIYFQ.js → chunk-JXY3YLDS.js} +72 -16
- package/dist/chunks/{chunk-XVUV3IM2.js → chunk-PU7IIEKH.js} +1 -1
- package/dist/cli.js +50 -2
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
createAskUserCapability
|
|
4
|
-
} from "../../../chunks/chunk-
|
|
4
|
+
} from "../../../chunks/chunk-JXY3YLDS.js";
|
|
5
5
|
import "../../../chunks/chunk-ZKHMNEXL.js";
|
|
6
6
|
import "../../../chunks/chunk-YRXXRLMQ.js";
|
|
7
7
|
import "../../../chunks/chunk-XXGYUYXI.js";
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
isPlanModeSafeCommand,
|
|
8
8
|
markCompletedPlanSteps,
|
|
9
9
|
restoreExecutionState
|
|
10
|
-
} from "../../../chunks/chunk-
|
|
10
|
+
} from "../../../chunks/chunk-JXY3YLDS.js";
|
|
11
11
|
import "../../../chunks/chunk-ZKHMNEXL.js";
|
|
12
12
|
import "../../../chunks/chunk-YRXXRLMQ.js";
|
|
13
13
|
import {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
createCliHostCapabilities
|
|
4
|
-
} from "../../../chunks/chunk-
|
|
4
|
+
} from "../../../chunks/chunk-PU7IIEKH.js";
|
|
5
5
|
import {
|
|
6
6
|
createSharedFileSystemTools,
|
|
7
7
|
createSubagentCapability
|
|
8
|
-
} from "../../../chunks/chunk-
|
|
8
|
+
} from "../../../chunks/chunk-JXY3YLDS.js";
|
|
9
9
|
import "../../../chunks/chunk-ZKHMNEXL.js";
|
|
10
10
|
import "../../../chunks/chunk-YRXXRLMQ.js";
|
|
11
11
|
import "../../../chunks/chunk-5353DEEC.js";
|
|
@@ -38,6 +38,7 @@ function subagentExtension(ctx) {
|
|
|
38
38
|
notify: ctx.hasUI ? (message, type) => ctx.ui.notify(message, type === "success" ? "info" : type) : void 0,
|
|
39
39
|
debugLog: (module, message, data) => ctx.log(`[subagent:${module}] ${message}${data !== void 0 ? ` ${JSON.stringify(data)}` : ""}`),
|
|
40
40
|
resolveModelClass: (modelClass) => ctx.resolveModelClass?.(modelClass),
|
|
41
|
+
resolveModelRef: (modelRef) => ctx.resolveModelRef?.(modelRef),
|
|
41
42
|
createRuntimeTools: () => {
|
|
42
43
|
const parentRuntimeTools = ctx.getRuntimeTools();
|
|
43
44
|
if (Array.isArray(parentRuntimeTools) && parentRuntimeTools.length > 0) {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
executeManageTodoList,
|
|
9
9
|
executionStateToTodos,
|
|
10
10
|
restoreExecutionState
|
|
11
|
-
} from "../../../chunks/chunk-
|
|
11
|
+
} from "../../../chunks/chunk-JXY3YLDS.js";
|
|
12
12
|
import "../../../chunks/chunk-ZKHMNEXL.js";
|
|
13
13
|
import "../../../chunks/chunk-YRXXRLMQ.js";
|
|
14
14
|
import "../../../chunks/chunk-XXGYUYXI.js";
|
|
@@ -1322,6 +1322,8 @@ function formatSkillSummariesForPrompt(skills) {
|
|
|
1322
1322
|
|
|
1323
1323
|
// ../../packages/shared-headless-capabilities/src/subagent.ts
|
|
1324
1324
|
var DEFAULT_SUBAGENT_TIMEOUT_SECONDS = 1200;
|
|
1325
|
+
var DEFAULT_SUBAGENT_THINKING_LEVEL = "medium";
|
|
1326
|
+
var SUBAGENT_THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh"];
|
|
1325
1327
|
function formatSkillsForPrompt(skills) {
|
|
1326
1328
|
return formatSkillSummariesForPrompt(skills);
|
|
1327
1329
|
}
|
|
@@ -1411,21 +1413,28 @@ function filterToolsForSubagent(runtimeTools, parentTools, plan) {
|
|
|
1411
1413
|
}
|
|
1412
1414
|
return filtered;
|
|
1413
1415
|
}
|
|
1414
|
-
function buildSubagentPlan(deps, task, name, priority, timeoutSeconds) {
|
|
1416
|
+
function buildSubagentPlan(deps, task, name, priority, timeoutSeconds, modelOverride, thinkingLevel = DEFAULT_SUBAGENT_THINKING_LEVEL) {
|
|
1415
1417
|
const complexity = inferComplexity(task, priority);
|
|
1416
1418
|
const modelClass = selectModelClass(complexity, priority);
|
|
1417
|
-
const
|
|
1419
|
+
const overrideResolution = modelOverride ? deps.resolveModelRef?.(modelOverride) ?? { model: void 0, fallbackReason: `model override "${modelOverride}" is not supported by this host` } : void 0;
|
|
1420
|
+
const overridePair = overrideResolution?.model && overrideResolution?.apiKey ? { model: overrideResolution.model, apiKey: overrideResolution.apiKey } : void 0;
|
|
1421
|
+
const modelResolution = overridePair ? void 0 : deps.resolveModelClass?.(modelClass);
|
|
1418
1422
|
const resolvedPair = modelResolution?.model && modelResolution?.apiKey ? { model: modelResolution.model, apiKey: modelResolution.apiKey } : void 0;
|
|
1419
|
-
const model = resolvedPair?.model ?? deps.model;
|
|
1420
|
-
const apiKey = resolvedPair?.apiKey ?? deps.apiKey;
|
|
1423
|
+
const model = overridePair?.model ?? resolvedPair?.model ?? deps.model;
|
|
1424
|
+
const apiKey = overridePair?.apiKey ?? resolvedPair?.apiKey ?? deps.apiKey;
|
|
1425
|
+
const overrideMissReason = overrideResolution?.fallbackReason ?? `model override "${modelOverride}" could not be resolved`;
|
|
1426
|
+
const modelFallbackReason = modelOverride ? overridePair ? void 0 : modelResolution?.fallbackReason ? `${overrideMissReason}; ${modelResolution.fallbackReason}` : overrideMissReason : modelResolution?.fallbackReason;
|
|
1421
1427
|
const partialPlan = {
|
|
1422
1428
|
task,
|
|
1423
1429
|
name,
|
|
1424
1430
|
priority,
|
|
1425
1431
|
complexity,
|
|
1426
1432
|
modelClass,
|
|
1433
|
+
modelOverride,
|
|
1434
|
+
modelOverrideApplied: Boolean(overridePair),
|
|
1435
|
+
thinkingLevel,
|
|
1427
1436
|
modelId: `${model?.provider ? `${model.provider}/` : ""}${model?.id ?? "unknown"}`,
|
|
1428
|
-
modelFallbackReason
|
|
1437
|
+
modelFallbackReason,
|
|
1429
1438
|
toolsExcluded: [],
|
|
1430
1439
|
timeoutSeconds,
|
|
1431
1440
|
outputContract: "Return a concise answer with evidence, uncertainty, and any parent follow-up needed."
|
|
@@ -1438,13 +1447,14 @@ function buildSubagentPlan(deps, task, name, priority, timeoutSeconds) {
|
|
|
1438
1447
|
};
|
|
1439
1448
|
return { plan, tools: filteredTools, apiKey, model };
|
|
1440
1449
|
}
|
|
1441
|
-
function createAgentInstance(deps, systemPrompt, tools, model, apiKey) {
|
|
1450
|
+
function createAgentInstance(deps, systemPrompt, tools, model, apiKey, thinkingLevel) {
|
|
1442
1451
|
if (deps.createAgent) {
|
|
1443
1452
|
return deps.createAgent({
|
|
1444
1453
|
systemPrompt,
|
|
1445
1454
|
model,
|
|
1446
1455
|
tools,
|
|
1447
|
-
apiKey
|
|
1456
|
+
apiKey,
|
|
1457
|
+
thinkingLevel
|
|
1448
1458
|
});
|
|
1449
1459
|
}
|
|
1450
1460
|
return new Agent({
|
|
@@ -1452,7 +1462,7 @@ function createAgentInstance(deps, systemPrompt, tools, model, apiKey) {
|
|
|
1452
1462
|
systemPrompt,
|
|
1453
1463
|
model,
|
|
1454
1464
|
tools,
|
|
1455
|
-
thinkingLevel
|
|
1465
|
+
thinkingLevel
|
|
1456
1466
|
},
|
|
1457
1467
|
apiKey
|
|
1458
1468
|
});
|
|
@@ -1501,7 +1511,7 @@ async function runSubagentWithProgress(deps, task, reportProgress, signal) {
|
|
|
1501
1511
|
deps.debugLog?.("run", "runSubagentWithProgress START", { taskName: task.name, yoloMode: deps.yoloMode });
|
|
1502
1512
|
try {
|
|
1503
1513
|
reportProgress({ message: `[${task.name}] Starting...`, increment: 5 });
|
|
1504
|
-
const { plan, tools, apiKey, model } = buildSubagentPlan(deps, task.task, task.name, task.priority, task.timeoutSeconds);
|
|
1514
|
+
const { plan, tools, apiKey, model } = buildSubagentPlan(deps, task.task, task.name, task.priority, task.timeoutSeconds, task.modelOverride, task.thinkingLevel);
|
|
1505
1515
|
task.plan = plan;
|
|
1506
1516
|
task.needsParentWrite = needsParentWrite(task.task);
|
|
1507
1517
|
for (const excluded of plan.toolsExcluded) {
|
|
@@ -1521,7 +1531,7 @@ async function runSubagentWithProgress(deps, task, reportProgress, signal) {
|
|
|
1521
1531
|
if (signal?.aborted) {
|
|
1522
1532
|
throw new Error("Subagent aborted by parent");
|
|
1523
1533
|
}
|
|
1524
|
-
deps.log(`[Subagent ${task.name}] Plan: ${plan.complexity}/${plan.modelClass}, ${tools.length} tools`);
|
|
1534
|
+
deps.log(`[Subagent ${task.name}] Plan: ${plan.complexity}/${plan.modelClass}${plan.modelOverride ? `, model=${plan.modelOverrideApplied ? plan.modelOverride : "override failed"}` : ""}, ${tools.length} tools`);
|
|
1525
1535
|
deps.debugLog?.("plan", "SubagentPlan", plan);
|
|
1526
1536
|
const systemPrompt = `You are a specialized subagent focused on one bounded task.
|
|
1527
1537
|
|
|
@@ -1538,7 +1548,7 @@ Output:
|
|
|
1538
1548
|
- Parent follow-up needed, if any
|
|
1539
1549
|
|
|
1540
1550
|
${formatSkillsForPrompt(deps.skills ?? [])}`;
|
|
1541
|
-
const subagent = createAgentInstance(deps, systemPrompt, tools, model, apiKey);
|
|
1551
|
+
const subagent = createAgentInstance(deps, systemPrompt, tools, model, apiKey, plan.thinkingLevel);
|
|
1542
1552
|
let assistantTurns = 0;
|
|
1543
1553
|
let toolCalls = 0;
|
|
1544
1554
|
let rejectTimeout = () => void 0;
|
|
@@ -1660,6 +1670,12 @@ function buildParallelResult(tasks, totalDuration) {
|
|
|
1660
1670
|
resultText += `**${task.name}** (${statusLabel}`;
|
|
1661
1671
|
if (task.plan) {
|
|
1662
1672
|
resultText += `, ${task.plan.complexity}/${task.plan.modelClass}`;
|
|
1673
|
+
if (task.plan.thinkingLevel !== DEFAULT_SUBAGENT_THINKING_LEVEL) {
|
|
1674
|
+
resultText += `, thinking=${task.plan.thinkingLevel}`;
|
|
1675
|
+
}
|
|
1676
|
+
if (task.plan.modelOverride) {
|
|
1677
|
+
resultText += task.plan.modelOverrideApplied ? `, model=${task.plan.modelOverride}` : `, model=${task.plan.modelOverride} (unresolved, fell back)`;
|
|
1678
|
+
}
|
|
1663
1679
|
}
|
|
1664
1680
|
if (task.details) {
|
|
1665
1681
|
resultText += `, ${task.details.durationMs}ms, ${task.details.toolCalls} tools`;
|
|
@@ -1699,7 +1715,7 @@ function normalizeTaskDefs(args) {
|
|
|
1699
1715
|
return { error: "Invalid spawn_subagents_parallel arguments: tasks must be a non-empty array." };
|
|
1700
1716
|
}
|
|
1701
1717
|
const normalized = [];
|
|
1702
|
-
const allowedFields = [...TASK_FIELD_ALIASES, "name", "priority", "timeout"];
|
|
1718
|
+
const allowedFields = [...TASK_FIELD_ALIASES, "name", "priority", "timeout", "model", "thinkingLevel"];
|
|
1703
1719
|
for (const [index, def] of taskDefs.entries()) {
|
|
1704
1720
|
if (!def || typeof def !== "object") {
|
|
1705
1721
|
return { error: `Invalid task #${index + 1}: expected an object with the objective in "task" (aliases "description"/"prompt"/"objective" accepted).` };
|
|
@@ -1722,11 +1738,21 @@ function normalizeTaskDefs(args) {
|
|
|
1722
1738
|
return { error: `Invalid task #${index + 1}: timeout must be a positive number of seconds.` };
|
|
1723
1739
|
}
|
|
1724
1740
|
const priority = def.priority === "thorough" ? "thorough" : "fast";
|
|
1741
|
+
const modelOverride = typeof def.model === "string" ? def.model.trim() : void 0;
|
|
1742
|
+
if (def.model !== void 0 && !modelOverride) {
|
|
1743
|
+
return { error: `Invalid task #${index + 1}: "model" must be a non-empty model reference such as "provider/model-id".` };
|
|
1744
|
+
}
|
|
1745
|
+
const thinkingLevel = typeof def.thinkingLevel === "string" ? def.thinkingLevel.trim() : void 0;
|
|
1746
|
+
if (def.thinkingLevel !== void 0 && (!thinkingLevel || !SUBAGENT_THINKING_LEVELS.includes(thinkingLevel))) {
|
|
1747
|
+
return { error: `Invalid task #${index + 1}: "thinkingLevel" must be one of ${SUBAGENT_THINKING_LEVELS.map((level) => `"${level}"`).join(", ")}.` };
|
|
1748
|
+
}
|
|
1725
1749
|
normalized.push({
|
|
1726
1750
|
name: typeof def.name === "string" && def.name.trim() ? def.name.trim() : void 0,
|
|
1727
1751
|
task,
|
|
1728
1752
|
priority,
|
|
1729
|
-
timeoutSeconds
|
|
1753
|
+
timeoutSeconds,
|
|
1754
|
+
modelOverride,
|
|
1755
|
+
thinkingLevel
|
|
1730
1756
|
});
|
|
1731
1757
|
}
|
|
1732
1758
|
return normalized;
|
|
@@ -1770,7 +1796,11 @@ function createSubagentCapability(deps) {
|
|
|
1770
1796
|
Use this for independent investigation, search, review, or triage work. Provide each task as a plain objective. Pie chooses the model class automatically. Use timeout only for unusually long tasks.
|
|
1771
1797
|
|
|
1772
1798
|
Arguments shape (each tasks[] item puts the objective in "task" \u2014 "description"/"prompt"/"objective" are accepted as aliases):
|
|
1773
|
-
{ "tasks": [{ "task": "<objective text>", "name": "<optional short label>", "priority": "fast" | "thorough", "timeout": 600 }] }
|
|
1799
|
+
{ "tasks": [{ "task": "<objective text>", "name": "<optional short label>", "priority": "fast" | "thorough", "model": "<optional explicit model override>", "thinkingLevel": "<optional off|minimal|low|medium|high|xhigh, default medium>", "timeout": 600 }] }
|
|
1800
|
+
|
|
1801
|
+
"model" overrides the automatic model-class selection for that task when the user explicitly asks for a specific model (e.g. "anthropic/claude-..."). Prefer "provider/model-id"; a bare model id works only when it is unambiguous across providers. When the override cannot be resolved, the task falls back to automatic selection and reports why.
|
|
1802
|
+
|
|
1803
|
+
"thinkingLevel" defaults to "medium"; set it only when the user asks (e.g. "xhigh" for deep review) or for cheap lookup tasks ("off"). Non-reasoning models ignore it.`,
|
|
1774
1804
|
parameters: Type.Object({
|
|
1775
1805
|
tasks: Type.Array(
|
|
1776
1806
|
Type.Object(
|
|
@@ -1781,9 +1811,11 @@ Arguments shape (each tasks[] item puts the objective in "task" \u2014 "descript
|
|
|
1781
1811
|
objective: Type.Optional(Type.String({ description: "Alias for task." })),
|
|
1782
1812
|
name: Type.Optional(Type.String({ description: "Short name for this subagent, shown in progress updates." })),
|
|
1783
1813
|
priority: Type.Optional(Type.Union([Type.Literal("fast"), Type.Literal("thorough")], { description: "fast uses lower-cost defaults; thorough raises model class when needed." })),
|
|
1814
|
+
model: Type.Optional(Type.String({ description: 'Explicit model override for this task, e.g. "provider/model-id". Only set when the user explicitly requests a specific model; otherwise Pie picks the model class automatically.' })),
|
|
1815
|
+
thinkingLevel: Type.Optional(Type.Union([Type.Literal("off"), Type.Literal("minimal"), Type.Literal("low"), Type.Literal("medium"), Type.Literal("high"), Type.Literal("xhigh")], { description: `Reasoning level for this task. Default: "medium". Only override when the user asks (e.g. "xhigh" for deep review tasks, "off" for cheap lookups). Ignored by non-reasoning models.` })),
|
|
1784
1816
|
timeout: Type.Optional(Type.Number({ description: "Timeout in seconds. Default: 1200s (20 minutes). For longer tasks, explicitly set a higher value, e.g. 3600." }))
|
|
1785
1817
|
},
|
|
1786
|
-
{ additionalProperties: false, description: "Objective goes in 'task' (or an accepted alias); plus optional name/priority/timeout." }
|
|
1818
|
+
{ additionalProperties: false, description: "Objective goes in 'task' (or an accepted alias); plus optional name/priority/model/thinkingLevel/timeout." }
|
|
1787
1819
|
),
|
|
1788
1820
|
{ description: "Array of tasks to run in parallel; at least one of task/description/prompt/objective must be a non-empty string per item.", minItems: 1, maxItems: 10 }
|
|
1789
1821
|
)
|
|
@@ -1816,6 +1848,8 @@ Arguments shape (each tasks[] item puts the objective in "task" \u2014 "descript
|
|
|
1816
1848
|
task: def.task,
|
|
1817
1849
|
priority: def.priority,
|
|
1818
1850
|
timeoutSeconds: def.timeoutSeconds,
|
|
1851
|
+
modelOverride: def.modelOverride,
|
|
1852
|
+
thinkingLevel: def.thinkingLevel,
|
|
1819
1853
|
evidence: [],
|
|
1820
1854
|
confidenceSignals: [],
|
|
1821
1855
|
uncertainty: "medium",
|
|
@@ -1866,6 +1900,8 @@ Arguments shape (each tasks[] item puts the objective in "task" \u2014 "descript
|
|
|
1866
1900
|
task: task.task,
|
|
1867
1901
|
timeoutSeconds: task.timeoutSeconds,
|
|
1868
1902
|
plan: task.plan,
|
|
1903
|
+
modelOverride: task.modelOverride,
|
|
1904
|
+
thinkingLevel: task.plan?.thinkingLevel,
|
|
1869
1905
|
evidence: task.evidence,
|
|
1870
1906
|
confidenceSignals: task.confidenceSignals,
|
|
1871
1907
|
runtimeEvidence: task.runtimeEvidence,
|
|
@@ -8579,6 +8615,7 @@ function createFileObservationState(options = {}) {
|
|
|
8579
8615
|
const files = /* @__PURE__ */ new Map();
|
|
8580
8616
|
const maxFiles = Math.max(1, Math.floor(options.maxFiles ?? 100));
|
|
8581
8617
|
const maxRangesPerFile = Math.max(0, Math.floor(options.maxRangesPerFile ?? 8));
|
|
8618
|
+
let generation = 0;
|
|
8582
8619
|
function touchFile(absolutePath, observed) {
|
|
8583
8620
|
files.delete(absolutePath);
|
|
8584
8621
|
files.set(absolutePath, observed);
|
|
@@ -8695,8 +8732,12 @@ function createFileObservationState(options = {}) {
|
|
|
8695
8732
|
invalidate(absolutePath) {
|
|
8696
8733
|
files.delete(absolutePath);
|
|
8697
8734
|
},
|
|
8735
|
+
getGeneration() {
|
|
8736
|
+
return generation;
|
|
8737
|
+
},
|
|
8698
8738
|
clear() {
|
|
8699
8739
|
files.clear();
|
|
8740
|
+
generation++;
|
|
8700
8741
|
}
|
|
8701
8742
|
};
|
|
8702
8743
|
}
|
|
@@ -8716,6 +8757,7 @@ function createReadErrorResult(message, details) {
|
|
|
8716
8757
|
function createReadTool(cwd, options) {
|
|
8717
8758
|
const fs2 = getFileSystem();
|
|
8718
8759
|
const fileObservationState = options?.fileObservationState ?? createFileObservationState();
|
|
8760
|
+
const callerObservations = /* @__PURE__ */ new WeakMap();
|
|
8719
8761
|
const rootSchema = buildRootParameterSchema(cwd, options);
|
|
8720
8762
|
const readSchema = Type.Object({
|
|
8721
8763
|
path: Type.String({ description: "Path to the file to read. Example: 'Scripts/PlayerController.cs' or 'Assets/Gen/config.json'." }),
|
|
@@ -8950,7 +8992,18 @@ function createReadTool(cwd, options) {
|
|
|
8950
8992
|
const readStartsAtBeginning = offset === void 0 || offset === 1;
|
|
8951
8993
|
const readReachedEndOfFile = startLine + range2.selectedLines >= range2.totalLines;
|
|
8952
8994
|
const isCompleteTextKnown = readStartsAtBeginning && readReachedEndOfFile && !truncation.truncated && !truncation.firstLineExceedsLimit;
|
|
8953
|
-
|
|
8995
|
+
let callerObservation = fileObservationState;
|
|
8996
|
+
if (signal) {
|
|
8997
|
+
const generation = fileObservationState.getGeneration();
|
|
8998
|
+
const existing = callerObservations.get(signal);
|
|
8999
|
+
if (existing?.generation === generation) {
|
|
9000
|
+
callerObservation = existing.state;
|
|
9001
|
+
} else {
|
|
9002
|
+
callerObservation = createFileObservationState();
|
|
9003
|
+
callerObservations.set(signal, { generation, state: callerObservation });
|
|
9004
|
+
}
|
|
9005
|
+
}
|
|
9006
|
+
if (fileObservationState.isUnchangedReadRange(absolutePath, rangeKey, snapshot, range2.selectedContentHash) && callerObservation.isUnchangedReadRange(absolutePath, rangeKey, snapshot, range2.selectedContentHash)) {
|
|
8954
9007
|
if (signal) {
|
|
8955
9008
|
signal.removeEventListener("abort", onAbort);
|
|
8956
9009
|
}
|
|
@@ -9017,6 +9070,9 @@ Base directory: ${nodePath.dirname(absolutePath)}
|
|
|
9017
9070
|
totalLines: range2.totalLines
|
|
9018
9071
|
}
|
|
9019
9072
|
);
|
|
9073
|
+
if (callerObservation !== fileObservationState) {
|
|
9074
|
+
callerObservation.recordTextRead(absolutePath, rangeKey, snapshot, range2.selectedContentHash, isCompleteTextKnown);
|
|
9075
|
+
}
|
|
9020
9076
|
outputText = sourceHeader + outputText;
|
|
9021
9077
|
const textContent = [{ type: "text", text: outputText }];
|
|
9022
9078
|
if (aborted) return;
|
package/dist/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
createCliWebResearchHealthStore,
|
|
8
8
|
formatSize,
|
|
9
9
|
truncateHeadTail
|
|
10
|
-
} from "./chunks/chunk-
|
|
10
|
+
} from "./chunks/chunk-PU7IIEKH.js";
|
|
11
11
|
import {
|
|
12
12
|
AGENTS_CONTEXT_FILE_NAME,
|
|
13
13
|
AgentSessionController,
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
setExtensionEnabledInSettings,
|
|
61
61
|
shouldPreserveExecutionStateForUserText,
|
|
62
62
|
supersedeExecutionState
|
|
63
|
-
} from "./chunks/chunk-
|
|
63
|
+
} from "./chunks/chunk-JXY3YLDS.js";
|
|
64
64
|
import "./chunks/chunk-ZKHMNEXL.js";
|
|
65
65
|
import {
|
|
66
66
|
Deref,
|
|
@@ -53356,6 +53356,46 @@ var ModelRegistry = class {
|
|
|
53356
53356
|
}
|
|
53357
53357
|
return { model, apiKey };
|
|
53358
53358
|
}
|
|
53359
|
+
/** Resolve an explicit model reference for user-requested overrides.
|
|
53360
|
+
* Accepts "provider/model-id" (exact lookup) or a bare model id (only
|
|
53361
|
+
* when it matches exactly one configured model). Never guesses across
|
|
53362
|
+
* providers; ambiguity and missing keys are reported as fallback reasons. */
|
|
53363
|
+
resolveModelRef(ref) {
|
|
53364
|
+
const trimmed = ref.trim();
|
|
53365
|
+
if (!trimmed) {
|
|
53366
|
+
return { fallbackReason: "empty model reference" };
|
|
53367
|
+
}
|
|
53368
|
+
const separator = trimmed.indexOf("/");
|
|
53369
|
+
if (separator >= 0) {
|
|
53370
|
+
if (separator === 0 || separator === trimmed.length - 1) {
|
|
53371
|
+
return { fallbackReason: `invalid model reference "${trimmed}"; expected provider/model-id` };
|
|
53372
|
+
}
|
|
53373
|
+
const provider = trimmed.slice(0, separator);
|
|
53374
|
+
const modelId = trimmed.slice(separator + 1);
|
|
53375
|
+
const model2 = this.find(provider, modelId);
|
|
53376
|
+
if (!model2) {
|
|
53377
|
+
return { fallbackReason: `model "${trimmed}" is not configured` };
|
|
53378
|
+
}
|
|
53379
|
+
const apiKey2 = this.getApiKey(model2);
|
|
53380
|
+
if (!apiKey2) {
|
|
53381
|
+
return { model: model2, fallbackReason: `no API key available for model "${trimmed}"` };
|
|
53382
|
+
}
|
|
53383
|
+
return { model: model2, apiKey: apiKey2 };
|
|
53384
|
+
}
|
|
53385
|
+
const matches = this.getAll().filter((model2) => model2.id === trimmed);
|
|
53386
|
+
if (matches.length === 0) {
|
|
53387
|
+
return { fallbackReason: `model "${trimmed}" is not configured; use provider/model-id` };
|
|
53388
|
+
}
|
|
53389
|
+
if (matches.length > 1) {
|
|
53390
|
+
return { fallbackReason: `model "${trimmed}" is ambiguous across providers (${matches.map((model2) => `${model2.provider}/${model2.id}`).join(", ")}); use provider/model-id` };
|
|
53391
|
+
}
|
|
53392
|
+
const model = matches[0];
|
|
53393
|
+
const apiKey = this.getApiKey(model);
|
|
53394
|
+
if (!apiKey) {
|
|
53395
|
+
return { model, fallbackReason: `no API key available for model "${model.provider}/${model.id}"` };
|
|
53396
|
+
}
|
|
53397
|
+
return { model, apiKey };
|
|
53398
|
+
}
|
|
53359
53399
|
hasExternalProviderConfig() {
|
|
53360
53400
|
return this.usingExternalProviders;
|
|
53361
53401
|
}
|
|
@@ -56206,6 +56246,9 @@ function createExtensionContext(extension, cwd, uiContext, abortFn, isIdleFn, ha
|
|
|
56206
56246
|
resolveModelClass(modelClass) {
|
|
56207
56247
|
return actions?.resolveModelClass?.(modelClass) ?? {};
|
|
56208
56248
|
},
|
|
56249
|
+
resolveModelRef(modelRef) {
|
|
56250
|
+
return actions?.resolveModelRef?.(modelRef) ?? {};
|
|
56251
|
+
},
|
|
56209
56252
|
getMessages() {
|
|
56210
56253
|
return actions?.getMessages?.() ?? [];
|
|
56211
56254
|
},
|
|
@@ -63885,6 +63928,7 @@ var ExtensionRunner = class {
|
|
|
63885
63928
|
getAllTools: () => runner.actions.getAllTools(),
|
|
63886
63929
|
getRuntimeTools: () => runner.actions.getRuntimeTools(),
|
|
63887
63930
|
resolveModelClass: (modelClass) => runner.actions.resolveModelClass?.(modelClass) ?? {},
|
|
63931
|
+
resolveModelRef: (modelRef) => runner.actions.resolveModelRef?.(modelRef) ?? {},
|
|
63888
63932
|
getMessages: () => runner.actions.getMessages(),
|
|
63889
63933
|
getSessionMetadata: () => runner.actions.getSessionMetadata(),
|
|
63890
63934
|
setSessionMetadata: (key, value) => runner.actions.setSessionMetadata(key, value),
|
|
@@ -74159,6 +74203,7 @@ function createExtensionContextForCommands(host) {
|
|
|
74159
74203
|
},
|
|
74160
74204
|
getRuntimeTools: () => host.agent.state.tools,
|
|
74161
74205
|
resolveModelClass: (modelClass) => host.options.modelRegistry.resolveModelClass(modelClass),
|
|
74206
|
+
resolveModelRef: (modelRef) => host.options.modelRegistry.resolveModelRef(modelRef),
|
|
74162
74207
|
getMessages: () => host.agent.state.messages,
|
|
74163
74208
|
getSessionMetadata: () => ({ ...host.sessionManager.getActiveSession()?.metadata ?? {} }),
|
|
74164
74209
|
setSessionMetadata: (key, value) => {
|
|
@@ -79434,6 +79479,7 @@ async function loadInteractiveExtensions(host) {
|
|
|
79434
79479
|
fallbackReason: resolved.fallbackReason
|
|
79435
79480
|
};
|
|
79436
79481
|
},
|
|
79482
|
+
resolveModelRef: (modelRef) => host.options.modelRegistry.resolveModelRef(modelRef),
|
|
79437
79483
|
getMessages: () => host.agent.state.messages,
|
|
79438
79484
|
getSessionMetadata: () => ({ ...host.sessionManager.getActiveSession()?.metadata ?? {} }),
|
|
79439
79485
|
setSessionMetadata: (key, value) => {
|
|
@@ -80657,6 +80703,7 @@ async function loadPrintModeExtensions(params) {
|
|
|
80657
80703
|
})),
|
|
80658
80704
|
getRuntimeTools: () => params.getAgent()?.state.tools ?? [],
|
|
80659
80705
|
resolveModelClass: (modelClass) => params.modelRegistry.resolveModelClass(modelClass),
|
|
80706
|
+
resolveModelRef: (modelRef) => params.modelRegistry.resolveModelRef(modelRef),
|
|
80660
80707
|
getMessages: () => params.getAgent()?.state.messages ?? [],
|
|
80661
80708
|
getSessionMetadata: () => ({ ...params.sessionManager.getActiveSession()?.metadata ?? {} }),
|
|
80662
80709
|
setSessionMetadata: (key, value) => {
|
|
@@ -81145,6 +81192,7 @@ async function loadJsonModeExtensions(params) {
|
|
|
81145
81192
|
})),
|
|
81146
81193
|
getRuntimeTools: () => params.getAgent()?.state.tools ?? [],
|
|
81147
81194
|
resolveModelClass: (modelClass) => params.runtime.modelRegistry.resolveModelClass(modelClass),
|
|
81195
|
+
resolveModelRef: (modelRef) => params.runtime.modelRegistry.resolveModelRef(modelRef),
|
|
81148
81196
|
getMessages: () => params.getAgent()?.state.messages ?? [],
|
|
81149
81197
|
getSessionMetadata: () => ({ ...params.runtime.sessionManager.getActiveSession()?.metadata ?? {} }),
|
|
81150
81198
|
setSessionMetadata: (key, value) => {
|