@kenkaiiii/gg-boss 4.11.1 → 4.11.3
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.
|
@@ -63845,16 +63845,17 @@ function toAnthropicThinking(level, maxTokens, model) {
|
|
|
63845
63845
|
outputConfig: { effort }
|
|
63846
63846
|
};
|
|
63847
63847
|
}
|
|
63848
|
+
const VISIBLE_FLOOR = 1024;
|
|
63848
63849
|
const effectiveLevel = level === "xhigh" || level === "max" ? "high" : level;
|
|
63849
63850
|
const budgetMap = {
|
|
63850
|
-
low: Math.max(1024, Math.floor(maxTokens * 0.
|
|
63851
|
-
medium: Math.max(2048, Math.floor(maxTokens * 0.
|
|
63852
|
-
high: Math.max(4096, maxTokens)
|
|
63851
|
+
low: Math.max(1024, Math.floor(maxTokens * 0.2)),
|
|
63852
|
+
medium: Math.max(2048, Math.floor(maxTokens * 0.45)),
|
|
63853
|
+
high: Math.max(4096, Math.floor(maxTokens * 0.8))
|
|
63853
63854
|
};
|
|
63854
|
-
const budget = budgetMap[effectiveLevel];
|
|
63855
|
+
const budget = Math.max(0, Math.min(budgetMap[effectiveLevel], maxTokens - VISIBLE_FLOOR));
|
|
63855
63856
|
return {
|
|
63856
63857
|
thinking: { type: "enabled", budget_tokens: budget },
|
|
63857
|
-
maxTokens
|
|
63858
|
+
maxTokens
|
|
63858
63859
|
};
|
|
63859
63860
|
}
|
|
63860
63861
|
function remapToolCallId(id2, idMap) {
|
|
@@ -72278,7 +72279,7 @@ var SubAgentParams = external_exports.object({
|
|
|
72278
72279
|
task: external_exports.string().describe("The task to delegate to the sub-agent"),
|
|
72279
72280
|
agent: external_exports.string().optional().describe("Named agent definition to use (from ~/.gg/agents/ or .gg/agents/)")
|
|
72280
72281
|
});
|
|
72281
|
-
function createSubAgentTool(cwd2, agents,
|
|
72282
|
+
function createSubAgentTool(cwd2, agents, getParentProvider, getParentModel, getParentCacheKey, planModeRef) {
|
|
72282
72283
|
const agentList = agents.map((a) => `- ${a.name}: ${a.description}`).join("\n");
|
|
72283
72284
|
const agentDesc = agentList ? `
|
|
72284
72285
|
|
|
@@ -72308,13 +72309,14 @@ ${agentList}` : "\n\nNo named agents configured.";
|
|
|
72308
72309
|
};
|
|
72309
72310
|
}
|
|
72310
72311
|
}
|
|
72311
|
-
const useProvider =
|
|
72312
|
+
const useProvider = getParentProvider();
|
|
72313
|
+
const useModel = getParentModel();
|
|
72312
72314
|
const cliArgs = [
|
|
72313
72315
|
"--json",
|
|
72314
72316
|
"--provider",
|
|
72315
72317
|
useProvider,
|
|
72316
72318
|
"--model",
|
|
72317
|
-
|
|
72319
|
+
useModel,
|
|
72318
72320
|
"--max-turns",
|
|
72319
72321
|
String(SUB_AGENT_MAX_TURNS)
|
|
72320
72322
|
];
|
|
@@ -72341,7 +72343,7 @@ ${agentList}` : "\n\nNo named agents configured.";
|
|
|
72341
72343
|
log("INFO", "subagent", "Sub-agent spawn", {
|
|
72342
72344
|
cacheKey: subCacheKey,
|
|
72343
72345
|
provider: useProvider,
|
|
72344
|
-
model:
|
|
72346
|
+
model: useModel,
|
|
72345
72347
|
agent: agentDef?.name ?? "(default)"
|
|
72346
72348
|
});
|
|
72347
72349
|
let childExited = false;
|
|
@@ -74271,7 +74273,7 @@ function createTools(cwd2, opts) {
|
|
|
74271
74273
|
tools.push(createWebSearchTool());
|
|
74272
74274
|
}
|
|
74273
74275
|
if (opts?.agents && opts.agents.length > 0 && opts.provider && opts.model) {
|
|
74274
|
-
tools.push(createSubAgentTool(cwd2, opts.agents, opts.provider, opts.model, opts.getCacheKey, planModeRef));
|
|
74276
|
+
tools.push(createSubAgentTool(cwd2, opts.agents, () => opts.getProvider?.() ?? opts.provider, () => opts.getModel?.() ?? opts.model, opts.getCacheKey, planModeRef));
|
|
74275
74277
|
}
|
|
74276
74278
|
if (opts?.skills && opts.skills.length > 0) {
|
|
74277
74279
|
tools.push(createSkillTool(opts.skills));
|
|
@@ -83716,6 +83718,10 @@ var AgentSession = class {
|
|
|
83716
83718
|
customSystemPrompt;
|
|
83717
83719
|
/** Shared with the tool layer so plan-mode restrictions read live state. */
|
|
83718
83720
|
planModeRef = { current: false };
|
|
83721
|
+
/** Path of the approved plan currently being implemented, or undefined. When
|
|
83722
|
+
* set, the system prompt carries the `[DONE:n]` progress contract so the
|
|
83723
|
+
* model emits step-completion markers the UI's plan-progress widget reads. */
|
|
83724
|
+
approvedPlanPath;
|
|
83719
83725
|
sessionId = "";
|
|
83720
83726
|
sessionPath = "";
|
|
83721
83727
|
lastPersistedIndex = 0;
|
|
@@ -83728,10 +83734,25 @@ var AgentSession = class {
|
|
|
83728
83734
|
this.model = options.model;
|
|
83729
83735
|
this.cwd = options.cwd;
|
|
83730
83736
|
this.baseUrl = options.baseUrl;
|
|
83731
|
-
this.maxTokens =
|
|
83737
|
+
this.maxTokens = this.resolveMaxTokens(options.model);
|
|
83732
83738
|
this.thinkingLevel = options.thinkingLevel;
|
|
83733
83739
|
this.customSystemPrompt = options.systemPrompt;
|
|
83734
83740
|
}
|
|
83741
|
+
/**
|
|
83742
|
+
* Derive the output-token cap for a model. Follows the active model's
|
|
83743
|
+
* `maxOutputTokens` so a session booted on a large-output model (e.g. Kimi's
|
|
83744
|
+
* 256K) doesn't carry that cap to a smaller one (e.g. Opus's 128K) after a
|
|
83745
|
+
* model switch — that mismatch surfaces from the provider as
|
|
83746
|
+
* `max_tokens: 262144 > 128000, which is the maximum allowed …`. An explicit
|
|
83747
|
+
* `maxTokens` override is honored but clamped to the model's ceiling.
|
|
83748
|
+
*/
|
|
83749
|
+
resolveMaxTokens(modelId) {
|
|
83750
|
+
const modelInfo = getModel(modelId);
|
|
83751
|
+
if (this.opts.maxTokens) {
|
|
83752
|
+
return modelInfo ? Math.min(this.opts.maxTokens, modelInfo.maxOutputTokens) : this.opts.maxTokens;
|
|
83753
|
+
}
|
|
83754
|
+
return modelInfo?.maxOutputTokens ?? 16384;
|
|
83755
|
+
}
|
|
83735
83756
|
async initialize() {
|
|
83736
83757
|
setEstimatorModel(this.model);
|
|
83737
83758
|
const paths = await ensureAppDirs();
|
|
@@ -83758,8 +83779,10 @@ var AgentSession = class {
|
|
|
83758
83779
|
provider: this.provider,
|
|
83759
83780
|
model: this.model,
|
|
83760
83781
|
lspDiagnostics: this.settingsManager.get("lspDiagnostics"),
|
|
83761
|
-
// Lazy — sessionId
|
|
83762
|
-
//
|
|
83782
|
+
// Lazy — sessionId/model/provider can change after createTools() runs, so
|
|
83783
|
+
// sub-agent spawns read the current parent state at execution time.
|
|
83784
|
+
getProvider: () => this.provider,
|
|
83785
|
+
getModel: () => this.model,
|
|
83763
83786
|
getCacheKey: () => this.getPromptCacheKey(),
|
|
83764
83787
|
// Plan mode: only wired when the host supplies callbacks. The ref is
|
|
83765
83788
|
// shared so bash/edit/write enforce read-only restrictions live.
|
|
@@ -84140,6 +84163,7 @@ ${fileNotes.join("\n")}`);
|
|
|
84140
84163
|
this.provider = provider;
|
|
84141
84164
|
this.model = model;
|
|
84142
84165
|
setEstimatorModel(model);
|
|
84166
|
+
this.maxTokens = this.resolveMaxTokens(model);
|
|
84143
84167
|
this.eventBus.emit("model_change", { provider: this.provider, model: this.model });
|
|
84144
84168
|
if (provider && provider !== prevProvider) {
|
|
84145
84169
|
const hasWebSearch = this.tools.some((t) => t.name === "web_search");
|
|
@@ -84203,6 +84227,8 @@ ${fileNotes.join("\n")}`);
|
|
|
84203
84227
|
});
|
|
84204
84228
|
}
|
|
84205
84229
|
async newSession() {
|
|
84230
|
+
this.planModeRef.current = false;
|
|
84231
|
+
this.approvedPlanPath = void 0;
|
|
84206
84232
|
const basePrompt = this.customSystemPrompt ?? await buildSystemPrompt(this.cwd, this.skills, false, void 0, this.tools.map((tool) => tool.name), void 0, this.provider);
|
|
84207
84233
|
this.messages = [{ role: "system", content: basePrompt }];
|
|
84208
84234
|
await this.createNewSession();
|
|
@@ -84296,9 +84322,25 @@ ${fileNotes.join("\n")}`);
|
|
|
84296
84322
|
*/
|
|
84297
84323
|
async setPlanMode(active) {
|
|
84298
84324
|
this.planModeRef.current = active;
|
|
84325
|
+
if (active)
|
|
84326
|
+
this.approvedPlanPath = void 0;
|
|
84327
|
+
await this.rebuildSystemPromptInPlace();
|
|
84328
|
+
}
|
|
84329
|
+
/**
|
|
84330
|
+
* Bake an approved plan into the system prompt so the model is told to emit
|
|
84331
|
+
* `[DONE:n]` markers as it completes each step (the contract the UI's
|
|
84332
|
+
* plan-progress widget reads). Pass `undefined` to clear it. No-op when a
|
|
84333
|
+
* custom system prompt is in force (the host owns the prompt then).
|
|
84334
|
+
*/
|
|
84335
|
+
async setApprovedPlan(approvedPlanPath) {
|
|
84336
|
+
this.approvedPlanPath = approvedPlanPath;
|
|
84337
|
+
await this.rebuildSystemPromptInPlace();
|
|
84338
|
+
}
|
|
84339
|
+
/** Rebuild messages[0] from current plan-mode + approved-plan state. */
|
|
84340
|
+
async rebuildSystemPromptInPlace() {
|
|
84299
84341
|
if (this.customSystemPrompt)
|
|
84300
84342
|
return;
|
|
84301
|
-
const rebuilt = await buildSystemPrompt(this.cwd, this.skills,
|
|
84343
|
+
const rebuilt = await buildSystemPrompt(this.cwd, this.skills, this.planModeRef.current, this.approvedPlanPath, this.tools.map((tool) => tool.name), void 0, this.provider);
|
|
84302
84344
|
if (this.messages[0]?.role === "system") {
|
|
84303
84345
|
this.messages[0] = { role: "system", content: rebuilt };
|
|
84304
84346
|
} else {
|
|
@@ -116472,4 +116514,4 @@ react/cjs/react-jsx-runtime.development.js:
|
|
|
116472
116514
|
* LICENSE file in the root directory of this source tree.
|
|
116473
116515
|
*)
|
|
116474
116516
|
*/
|
|
116475
|
-
//# sourceMappingURL=chunk-
|
|
116517
|
+
//# sourceMappingURL=chunk-WECKKLXP.js.map
|