billion-context-pi 0.1.56-pr.288.78 → 0.1.56
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/config.d.ts +4 -36
- package/dist/delegate-tool.d.ts +0 -9
- package/dist/index.js +10 -79
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
|
@@ -1,21 +1,5 @@
|
|
|
1
1
|
import { type Config, type Prompts } from "acp-kernel";
|
|
2
2
|
import type { ThrottleRetryConfig } from "./throttle-retry.js";
|
|
3
|
-
/** Per-role delegate defaults. Lets long-lived automation pin a cheaper or
|
|
4
|
-
* more capable model and a thinking level per delegate role, so the main
|
|
5
|
-
* agent doesn't have to fill them in on every `acp_delegate()` call. */
|
|
6
|
-
export interface DelegateRoleConfig {
|
|
7
|
-
/** Default model for this role, as `"provider/id"`. Resolution priority:
|
|
8
|
-
* per-call `model` > this role default > parent agent's current model. A
|
|
9
|
-
* value that isn't a valid `"provider/id"` is ignored (treated as unset).
|
|
10
|
-
* If the configured model doesn't exist in the live registry, the child
|
|
11
|
-
* falls back to the parent model and a warning is logged — it never fails. */
|
|
12
|
-
model?: string;
|
|
13
|
-
/** Default thinking level for this role: one of off|minimal|low|medium|
|
|
14
|
-
* high|xhigh|max. Resolution priority: per-call `thinkingLevel` > this role
|
|
15
|
-
* default > global `delegate.thinkingLevel` > Pi's own default. An invalid
|
|
16
|
-
* value is ignored with a warning (never fails). */
|
|
17
|
-
thinkingLevel?: string;
|
|
18
|
-
}
|
|
19
3
|
/** Delegate sub-agent configuration. */
|
|
20
4
|
export interface DelegateConfig {
|
|
21
5
|
/** Enable acp_delegate tools (delegate/wait/cancel) and their system-prompt
|
|
@@ -28,15 +12,6 @@ export interface DelegateConfig {
|
|
|
28
12
|
* "merged" — delegate token usage folded into the tool-result usage field,
|
|
29
13
|
* counted as part of the main session totals. */
|
|
30
14
|
displayUsage?: "merged" | "separate";
|
|
31
|
-
/** Global default thinking level applied to every delegate when neither the
|
|
32
|
-
* per-call `thinkingLevel` nor the role's own `thinkingLevel` is set. One of
|
|
33
|
-
* off|minimal|low|medium|high|xhigh|max. When unset at all levels, no
|
|
34
|
-
* `--thinking` flag is passed and each child uses Pi's own default. */
|
|
35
|
-
thinkingLevel?: string;
|
|
36
|
-
/** Per-role defaults keyed by role name (reviewer/researcher/worker/planner/
|
|
37
|
-
* oracle, or any custom role). See DelegateRoleConfig. Only affects roles
|
|
38
|
-
* that are named here; other roles inherit the parent model + Pi defaults. */
|
|
39
|
-
agents?: Record<string, DelegateRoleConfig>;
|
|
40
15
|
}
|
|
41
16
|
/** Compression tuning fields, shared by all three levels (global, provider,
|
|
42
17
|
* model). Percentage fields accept a ratio (0.75) or percent string ("75%").
|
|
@@ -141,19 +116,12 @@ export interface AdapterConfig {
|
|
|
141
116
|
}
|
|
142
117
|
export declare const DEFAULT_TOOL_BASH_TIMEOUT = 60;
|
|
143
118
|
export declare const DEFAULT_TOOL_OUTPUT_MAX_BYTES = 200000;
|
|
144
|
-
/** Resolved delegate settings: registration flags plus the per-role / global
|
|
145
|
-
* model + thinking defaults consumed by buildChildArgs at spawn time. */
|
|
146
|
-
export interface ResolvedDelegate {
|
|
147
|
-
enabled: boolean;
|
|
148
|
-
displayUsage: "merged" | "separate";
|
|
149
|
-
/** Global default thinking level (undefined when unset). */
|
|
150
|
-
thinkingLevel?: string;
|
|
151
|
-
/** Per-role defaults keyed by role name (undefined when unset). */
|
|
152
|
-
agents?: Record<string, DelegateRoleConfig>;
|
|
153
|
-
}
|
|
154
119
|
/** Resolve delegate config from the adapter, handling the boolean shorthand
|
|
155
120
|
* and the legacy flat `displayUsage` alias. */
|
|
156
|
-
export declare function resolveDelegate(adapter: AdapterConfig):
|
|
121
|
+
export declare function resolveDelegate(adapter: AdapterConfig): {
|
|
122
|
+
enabled: boolean;
|
|
123
|
+
displayUsage: "merged" | "separate";
|
|
124
|
+
};
|
|
157
125
|
/** Per-field deepest-wins merge of the three compression levels (global →
|
|
158
126
|
* provider → model). An undefined field at a deeper level does NOT clear a
|
|
159
127
|
* value set at a shallower level — only a defined value overrides. */
|
package/dist/delegate-tool.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type ChildProcess, type SpawnOptions } from "node:child_process";
|
|
2
2
|
import { Type, type Static } from "typebox";
|
|
3
3
|
import type { AgentToolResult, ExtensionAPI, ExtensionContext, ToolDefinition } from "@earendil-works/pi-coding-agent";
|
|
4
|
-
import { type DelegateRoleConfig } from "./config.js";
|
|
5
4
|
import { type Usage } from "./delegate-events.js";
|
|
6
5
|
export declare function delegateStdinText(resumeFrom: boolean, task: string | undefined): string;
|
|
7
6
|
export declare function delegateSpawnOptions(cwd: string, env: NodeJS.ProcessEnv): SpawnOptions;
|
|
@@ -55,13 +54,6 @@ export declare function addDelegateUsage(u: Usage): void;
|
|
|
55
54
|
export declare function getDelegateUsage(): Usage | undefined;
|
|
56
55
|
export declare function resetDelegateUsage(): void;
|
|
57
56
|
export declare function setDelegateDisplayUsage(mode: "merged" | "separate"): void;
|
|
58
|
-
export declare function setDelegateDefaults(d: {
|
|
59
|
-
thinkingLevel?: string;
|
|
60
|
-
agents?: Record<string, DelegateRoleConfig>;
|
|
61
|
-
} | undefined): void;
|
|
62
|
-
export declare function resetDelegateDefaults(): void;
|
|
63
|
-
declare const VALID_THINKING_LEVELS: readonly ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
64
|
-
export declare function isValidThinkingLevel(v: unknown): v is (typeof VALID_THINKING_LEVELS)[number];
|
|
65
57
|
/** Snapshot of currently-running delegate runs, for the TUI status widget. */
|
|
66
58
|
export declare function runningRunsSnapshot(): {
|
|
67
59
|
runId: string;
|
|
@@ -110,7 +102,6 @@ declare const DelegateParams: Type.TObject<{
|
|
|
110
102
|
resumeFrom: Type.TOptional<Type.TString>;
|
|
111
103
|
cwd: Type.TOptional<Type.TString>;
|
|
112
104
|
model: Type.TOptional<Type.TString>;
|
|
113
|
-
thinkingLevel: Type.TOptional<Type.TString>;
|
|
114
105
|
async: Type.TOptional<Type.TBoolean>;
|
|
115
106
|
showThinking: Type.TOptional<Type.TBoolean>;
|
|
116
107
|
}>;
|
package/dist/index.js
CHANGED
|
@@ -3560,9 +3560,7 @@ function resolveDelegate(adapter) {
|
|
|
3560
3560
|
if (typeof d === "object" && d !== null) {
|
|
3561
3561
|
return {
|
|
3562
3562
|
enabled: d.enabled !== false,
|
|
3563
|
-
displayUsage: d.displayUsage ?? adapter.displayUsage ?? "separate"
|
|
3564
|
-
thinkingLevel: d.thinkingLevel,
|
|
3565
|
-
agents: d.agents
|
|
3563
|
+
displayUsage: d.displayUsage ?? adapter.displayUsage ?? "separate"
|
|
3566
3564
|
};
|
|
3567
3565
|
}
|
|
3568
3566
|
return {
|
|
@@ -10388,25 +10386,6 @@ var delegateDisplayUsage = "separate";
|
|
|
10388
10386
|
function setDelegateDisplayUsage(mode) {
|
|
10389
10387
|
delegateDisplayUsage = mode;
|
|
10390
10388
|
}
|
|
10391
|
-
var delegateDefaults = {};
|
|
10392
|
-
function setDelegateDefaults(d) {
|
|
10393
|
-
delegateDefaults = d ?? {};
|
|
10394
|
-
}
|
|
10395
|
-
var VALID_THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
10396
|
-
function isValidThinkingLevel(v) {
|
|
10397
|
-
return typeof v === "string" && VALID_THINKING_LEVELS.includes(v);
|
|
10398
|
-
}
|
|
10399
|
-
function pickFirstDefined(values) {
|
|
10400
|
-
for (const v of values) {
|
|
10401
|
-
if (typeof v === "string" && v.trim() !== "") return v;
|
|
10402
|
-
}
|
|
10403
|
-
return void 0;
|
|
10404
|
-
}
|
|
10405
|
-
function normalizeModelRef(m) {
|
|
10406
|
-
if (!m) return void 0;
|
|
10407
|
-
const s = m.trim();
|
|
10408
|
-
return s.includes("/") ? s : void 0;
|
|
10409
|
-
}
|
|
10410
10389
|
function runningRunsSnapshot() {
|
|
10411
10390
|
const out = [];
|
|
10412
10391
|
for (const r of runs.values()) {
|
|
@@ -10511,10 +10490,7 @@ var DelegateParams = typebox_exports.Object({
|
|
|
10511
10490
|
typebox_exports.String({ description: "Working directory for the delegate (default: current project dir)." })
|
|
10512
10491
|
),
|
|
10513
10492
|
model: typebox_exports.Optional(
|
|
10514
|
-
typebox_exports.String({ description:
|
|
10515
|
-
),
|
|
10516
|
-
thinkingLevel: typebox_exports.Optional(
|
|
10517
|
-
typebox_exports.String({ description: `Per-call thinking-level override: ${VALID_THINKING_LEVELS.join("|")}. Default: this role's configured level, else the global delegate.thinkingLevel, else Pi's own default.` })
|
|
10493
|
+
typebox_exports.String({ description: 'Model override as "provider/id" (default: inherit current model).' })
|
|
10518
10494
|
),
|
|
10519
10495
|
async: typebox_exports.Optional(
|
|
10520
10496
|
typebox_exports.Boolean({
|
|
@@ -11210,55 +11186,12 @@ Complete the task below.`, "utf8");
|
|
|
11210
11186
|
const merged = [.../* @__PURE__ */ new Set([...agentDef.tools.split(",").map((s) => s.trim()), ...ACP_TOOLS])];
|
|
11211
11187
|
cliArgs.push("--tools", merged.join(","));
|
|
11212
11188
|
}
|
|
11213
|
-
|
|
11214
|
-
|
|
11215
|
-
|
|
11216
|
-
|
|
11217
|
-
|
|
11218
|
-
|
|
11219
|
-
let modelId;
|
|
11220
|
-
let source = "inherit";
|
|
11221
|
-
if (callModel) {
|
|
11222
|
-
const parts = callModel.split("/");
|
|
11223
|
-
provider = parts[0];
|
|
11224
|
-
modelId = parts.slice(1).join("/");
|
|
11225
|
-
source = "call";
|
|
11226
|
-
} else if (roleModel) {
|
|
11227
|
-
const parts = roleModel.split("/");
|
|
11228
|
-
provider = parts[0];
|
|
11229
|
-
modelId = parts.slice(1).join("/");
|
|
11230
|
-
source = "role";
|
|
11231
|
-
} else if (parentProvider !== void 0 && parentModelId !== void 0) {
|
|
11232
|
-
provider = parentProvider;
|
|
11233
|
-
modelId = parentModelId;
|
|
11234
|
-
}
|
|
11235
|
-
if (source === "role" && provider !== void 0 && modelId !== void 0) {
|
|
11236
|
-
const registry3 = ctx.modelRegistry;
|
|
11237
|
-
const found = registry3 ? registry3.find(provider, modelId) : void 0;
|
|
11238
|
-
if (!found) {
|
|
11239
|
-
logWarn("delegate", {
|
|
11240
|
-
event: "role-model-missing",
|
|
11241
|
-
agent: args.agent,
|
|
11242
|
-
requested: `${provider}/${modelId}`,
|
|
11243
|
-
fallback: parentProvider !== void 0 ? `${parentProvider}/${parentModelId}` : null
|
|
11244
|
-
});
|
|
11245
|
-
if (parentProvider !== void 0 && parentModelId !== void 0) {
|
|
11246
|
-
provider = parentProvider;
|
|
11247
|
-
modelId = parentModelId;
|
|
11248
|
-
source = "inherit";
|
|
11249
|
-
}
|
|
11250
|
-
}
|
|
11251
|
-
}
|
|
11252
|
-
if (provider !== void 0 && modelId !== void 0) {
|
|
11253
|
-
cliArgs.push("--provider", provider, "--model", modelId);
|
|
11254
|
-
}
|
|
11255
|
-
const thinkingPick = pickFirstDefined([args.thinkingLevel, roleCfg?.thinkingLevel, delegateDefaults.thinkingLevel]);
|
|
11256
|
-
if (thinkingPick !== void 0) {
|
|
11257
|
-
if (isValidThinkingLevel(thinkingPick)) {
|
|
11258
|
-
cliArgs.push("--thinking", thinkingPick);
|
|
11259
|
-
} else {
|
|
11260
|
-
logWarn("delegate", { event: "invalid-thinking-level", agent: args.agent, value: thinkingPick });
|
|
11261
|
-
}
|
|
11189
|
+
if (args.model && args.model.includes("/")) {
|
|
11190
|
+
const [providerId, ...rest] = args.model.split("/");
|
|
11191
|
+
const modelId = rest.join("/");
|
|
11192
|
+
cliArgs.push("--provider", providerId, "--model", modelId);
|
|
11193
|
+
} else if (ctx.model) {
|
|
11194
|
+
cliArgs.push("--provider", ctx.model.provider, "--model", ctx.model.id);
|
|
11262
11195
|
}
|
|
11263
11196
|
return { cliArgs, tmpDir, isAsync, useJsonStream, sessionFile };
|
|
11264
11197
|
}
|
|
@@ -12525,9 +12458,7 @@ function wireSessionLifecycle(pi, runtime) {
|
|
|
12525
12458
|
logInfo("session", { event: "start", sid, cwd: ctx.cwd, debug: runtime.adapter.debug ?? null, version: true ? "0.1.56" : null, model: modelInfo?.id ?? null, modelApi: modelInfo?.api ?? null, contextWindow: modelInfo?.contextWindow ?? null });
|
|
12526
12459
|
try {
|
|
12527
12460
|
await runtime.reloadConfig(ctx.cwd);
|
|
12528
|
-
|
|
12529
|
-
setDelegateDisplayUsage(delegate.displayUsage);
|
|
12530
|
-
setDelegateDefaults({ thinkingLevel: delegate.thinkingLevel, agents: delegate.agents });
|
|
12461
|
+
setDelegateDisplayUsage(resolveDelegate(runtime.adapter).displayUsage);
|
|
12531
12462
|
} catch (e) {
|
|
12532
12463
|
logThrow("config", e, { sid, phase: "session_start" });
|
|
12533
12464
|
}
|
|
@@ -12696,7 +12627,7 @@ ${rendered.text}${example}`);
|
|
|
12696
12627
|
function wireSystemPrompt(pi, runtime) {
|
|
12697
12628
|
pi.on("before_agent_start", (event) => {
|
|
12698
12629
|
if (runtime.refused) return;
|
|
12699
|
-
const delegate =
|
|
12630
|
+
const delegate = runtime.adapter.delegate !== false;
|
|
12700
12631
|
const acp = buildAcpSystemPrompt(runtime.prompts);
|
|
12701
12632
|
const prompt = delegate ? `${acp}
|
|
12702
12633
|
${ACP_DELEGATE_PROMPT}` : acp;
|