Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(pi): scope inherited windows to runtime binary (#5890)
Tsai Yuan540f5c944e8d
diff --git a/apps/desktop/src/main/maker-host/pi-host.ts b/apps/desktop/src/main/maker-host/pi-host.tsindex eeb0797e5c..a6d7b01f68 100644--- a/apps/desktop/src/main/maker-host/pi-host.ts+++ b/apps/desktop/src/main/maker-host/pi-host.ts@@ -154,6 +154,7 @@ export type PiBundledModelCatalog = ReadonlyMap<string, ReadonlyMap<string, PiBuexport type PiListedModelIds = ReadonlyMap<string, ReadonlySet<string>>;const piBundledModelsByBinary = new Map<string, Promise<PiBundledModelCatalog | null>>();+const resolvedPiBundledModelsByBinary = new Map<string, PiBundledModelCatalog>();const listedIdsByCatalog = new WeakMap<PiBundledModelCatalog, PiListedModelIds>();let latestPiBundledModelCatalog: PiBundledModelCatalog | null = null;@@ -405,8 +406,12 @@ export async function readPiBundledModels(const cached = piBundledModelsByBinary.get(binaryPath);if (cached) {const catalog = await cached;+ if (catalog) resolvedPiBundledModelsByBinary.set(binaryPath, catalog);latestPiBundledModelCatalog = catalog;- if (catalog === null) piBundledModelsByBinary.delete(binaryPath);+ if (catalog === null) {+ piBundledModelsByBinary.delete(binaryPath);+ resolvedPiBundledModelsByBinary.delete(binaryPath);+ }return catalog;}// A model-switch preview may inspect a live task without launching another Pi@@ -490,10 +495,14 @@ export async function readPiBundledModels(})();piBundledModelsByBinary.set(binaryPath, pending);const catalog = await pending;+ if (catalog) resolvedPiBundledModelsByBinary.set(binaryPath, catalog);latestPiBundledModelCatalog = catalog;// A temp-dir/timeout/parse failure is transient evidence, not a permanent property of this// binary. Keep successful probes cached, but let the next session retry a null result.- if (catalog === null) piBundledModelsByBinary.delete(binaryPath);+ if (catalog === null) {+ piBundledModelsByBinary.delete(binaryPath);+ resolvedPiBundledModelsByBinary.delete(binaryPath);+ }return catalog;}@@ -1616,18 +1625,24 @@ function isPiGatewayModelApi(api: PiBundledModelInfo['api']): api is PiModelApi);}-function resolveProbedPiGatewayModel(modelId: string): PiBundledModelInfo | undefined {+function resolveProbedPiGatewayModel(+ modelId: string,+ runtimeBinaryPath?: string,+): PiBundledModelInfo | undefined {+ const catalog = runtimeBinaryPath+ ? resolvedPiBundledModelsByBinary.get(runtimeBinaryPath)+ : latestPiBundledModelCatalog;const normalized = modelId.replace(/\[1m\]$/, '');const identity = resolveBundledPiGatewayCatalogIdentity(normalized);if (identity) {- const matched = latestPiBundledModelCatalog?.get(identity.provider)?.get(identity.modelId);+ const matched = catalog?.get(identity.provider)?.get(identity.modelId);if (matched) return matched;}// Future namespaced models may use Pi's exact provider/model identity without a client alias.// This is an exact pair lookup, never a bare-id or family guess.const slash = normalized.indexOf('/');if (slash <= 0) return undefined;- return latestPiBundledModelCatalog+ return catalog?.get(normalized.slice(0, slash))?.get(normalized.slice(slash + 1));}@@ -1635,7 +1650,7 @@ function resolveProbedPiGatewayModel(modelId: string): PiBundledModelInfo | undeexport function resolvePiCindyGatewayModelApi(_selectedProviderId: string | null | undefined,modelId: string,- context?: { remote: boolean },+ context?: { remote: boolean; runtimeBinaryPath?: string },): PiModelApi | null | undefined {// Gateway membership remains the account-availability gate, but its protocol is the last hint.const gatewayApi = resolveXdPiGatewayHintApi(modelId);@@ -1646,7 +1661,7 @@ export function resolvePiCindyGatewayModelApi(// sessions skip that probe but still use this client version's explicit static configuration// before the last-priority Gateway hint.if (context?.remote) return resolveBundledPiGatewayModelProfile(modelId)?.api ?? gatewayApi;- const probed = resolveProbedPiGatewayModel(modelId);+ const probed = resolveProbedPiGatewayModel(modelId, context?.runtimeBinaryPath);if (probed) return isPiGatewayModelApi(probed.api) ? probed.api : null;return resolveBundledPiGatewayModelProfile(modelId)?.api ?? gatewayApi;}@@ -1654,7 +1669,7 @@ export function resolvePiCindyGatewayModelApi(export function resolvePiCindyGatewayModelSpec(_selectedProviderId: string | null | undefined,modelId: string,- context?: { remote: boolean },+ context?: { remote: boolean; runtimeBinaryPath?: string },): Pick<PiNativeModelSpec,'api' | 'compat' | 'samplingParams' | 'thinkingLevelMap'@@ -1662,7 +1677,9 @@ export function resolvePiCindyGatewayModelSpec(const api = resolvePiCindyGatewayModelApi(_selectedProviderId, modelId, context);if (api === undefined || api === null) return api;const bundled = resolveBundledPiGatewayModelProfile(modelId);- const probed = context?.remote ? undefined : resolveProbedPiGatewayModel(modelId);+ const probed = context?.remote+ ? undefined+ : resolveProbedPiGatewayModel(modelId, context?.runtimeBinaryPath);const compatibleBundled = bundled?.api === api ? bundled : undefined;const compatibleProbed = probed?.api === api ? probed : undefined;let compat = compatibleProbed?.compat ?? compatibleBundled?.compat;@@ -1715,6 +1732,8 @@ export async function resolvePiNativeProviders(ctx: {remoteHostId?: string | null;providerId?: string | null;model: string;+ /** Local Pi binary frozen by maker-core for this session. */+ runtimeBinaryPath?: string;resumeSessionId?: string;purpose?: 'startup' | 'preview' | 'live-refresh';}): Promise<PiNativeProvidersResult> {@@ -1735,7 +1754,7 @@ export async function resolvePiNativeProviders(ctx: {});throw new PiNativeProviderProxyNotReadyError();}- const piBinaryPath = resolvePiBinaryPath();+ const piBinaryPath = ctx.runtimeBinaryPath ?? resolvePiBinaryPath();// Never treat the Desktop executable as the catalog of a different remote Pi binary.const bundledModels = !ctx.remoteHostId && piBinaryPath? await readPiBundledModels(piBinaryPath, { cachedOnly: ctx.purpose === 'preview' })diff --git a/packages/maker-core/src/agents/base-agent.ts b/packages/maker-core/src/agents/base-agent.tsindex ea56629b4c..1d23caac18 100644--- a/packages/maker-core/src/agents/base-agent.ts+++ b/packages/maker-core/src/agents/base-agent.ts@@ -851,6 +851,8 @@ export interface AgentDeps {remoteHostId?: string | null;providerId?: string | null;model: string;+ /** Local Pi binary frozen for this session; host catalog probes must use the same build. */+ runtimeBinaryPath?: string;/** Present only when restoring an existing Pi session; permits private compatibility ids. */resumeSessionId?: string;/** Preview must not prepare global skills or start a local model service. */@@ -888,14 +890,14 @@ export interface AgentDeps {resolvePiGatewayModelApi?: (providerId: string | null | undefined,modelId: string,- context?: { remote: boolean },+ context?: { remote: boolean; runtimeBinaryPath?: string },) => PiNativeApi | null | undefined;/** Host-resolved model-specific PI compatibility metadata for the Gateway block. */resolvePiGatewayModelSpec?: (providerId: string | null | undefined,modelId: string,- context?: { remote: boolean },+ context?: { remote: boolean; runtimeBinaryPath?: string },) => PiGatewayModelSpec | null | undefined;/**diff --git a/packages/maker-core/src/agents/pi/__tests__/pi-provider-routing.test.ts b/packages/maker-core/src/agents/pi/__tests__/pi-provider-routing.test.tsindex 1e19efc887..80a76c6377 100644--- a/packages/maker-core/src/agents/pi/__tests__/pi-provider-routing.test.ts+++ b/packages/maker-core/src/agents/pi/__tests__/pi-provider-routing.test.ts@@ -21,6 +21,7 @@ import { CINDY_SUBAGENT_EXTENSION_SOURCE } from "../cindy-subagent-source.js";const captured = vi.hoisted(() => ({args: [] as string[],+ spawnBinaryPath: undefined as string | undefined,env: {} as Record<string, string | undefined>,requests: [] as Array<Record<string, unknown>>,responses: [] as Array<Record<string, unknown>>,@@ -59,11 +60,13 @@ const captured = vi.hoisted(() => ({vi.mock("../transport.js", () => ({createPiStdioTransport: (opts: {+ binaryPath: string;args: string[];env: Record<string, string | undefined>;onProcessSpawned?: (pid: number) => void | (() => void);}) => {// spawn 参数断言移到 transport 工厂(spawn 行为在 stdio transport)。+ captured.spawnBinaryPath = opts.binaryPath;captured.args = [...opts.args];captured.env = { ...(opts.env ?? {}) };opts.onProcessSpawned?.(1234);@@ -273,6 +276,7 @@ describe("Pi provider-aware model routing", () => {beforeEach(() => {captured.args = [];+ captured.spawnBinaryPath = undefined;captured.requests = [];captured.responses = [];captured.onEvent = undefined;@@ -598,6 +602,7 @@ describe("Pi provider-aware model routing", () => {};expect(apiResolver).toHaveBeenCalledWith("openai", "shared-model", {remote: false,+ runtimeBinaryPath: deps.binaryPath,});expect(descriptorResolver).toHaveBeenCalledWith("openai", "shared-model");expect(@@ -4033,8 +4038,8 @@ describe("Pi provider-aware model routing", () => {deps.runtimeConfig = { ...deps.runtimeConfig, piAutoCompactThresholdPct: 75 };deps.resolveModelContextLimit = (provider, model) =>provider === 'native-account' && (model === 'catalog-model' || model === 'catalog-alias')- ? workingWindow- : undefined;+ ? workingWindow ?? null+ : null;captured.requestHandler = async (command) => {if (command.type === 'get_available_models') return { success: true, data: { models: [{ provider: 'pi-native', id: 'wire-model', contextWindow: 400_000 },@@ -4064,7 +4069,13 @@ describe("Pi provider-aware model routing", () => {});const rebuiltSettings = JSON.parse(readFileSync(path.join(captured.env.PI_CODING_AGENT_DIR!, 'settings.json'), 'utf8',- )) as { compaction?: { modelOverrides?: Record<string, { reserveTokens?: number }> } };+ )) as { compaction?: {+ reserveTokens?: number;+ modelOverrides?: Record<string, { reserveTokens?: number }>;+ } };+ // Pi 0.x uses this global reserve: retain the 400K physical capacity and+ // express the 150K working window as its 112.5K used-token threshold.+ expect(rebuiltSettings.compaction?.reserveTokens).toBe(287_500);expect(rebuiltSettings.compaction?.modelOverrides?.['pi-native/wire-model']?.reserveTokens).toBe(37_500);expect(await rebuilt.previewModelSwitch?.('catalog-alias', { providerId: 'native-account' }))@@ -4072,6 +4083,76 @@ describe("Pi provider-aware model routing", () => {await rebuilt.close();});+ it('does not reuse an inherited window after the managed Pi binary changes', async () => {+ const v1Path = path.join(agentHome, 'pi-v1');+ const v2Path = path.join(agentHome, 'pi-v2');+ let binaryPath = v1Path;+ let liveWindow = 400_000;+ const resolvedBinaryPaths: Array<string | undefined> = [];+ const deps = byomDeps(async (input) => {+ resolvedBinaryPaths.push(input.runtimeBinaryPath);+ return { providers: [+ { id: 'native-a', name: 'Current', baseUrl: 'http://a.test', api: 'openai-completions',+ models: [{ id: 'local-model', contextWindow: 200_000 }] },+ { id: 'pi-native', sourceProviderId: 'native-account', name: 'Inherited', baseUrl: 'http://b.test',+ inheritModels: true, modelIdAliases: { 'catalog-alias': 'catalog-model' },+ models: [{ id: 'catalog-model', wireId: 'wire-model' }] },+ ], env: {} };+ });+ let observeFreeze = false;+ let signalFrozen!: () => void;+ const binaryFrozen = new Promise<void>((resolve) => { signalFrozen = resolve; });+ Object.defineProperty(deps, 'binaryPath', { configurable: true, get: () => {+ const current = binaryPath;+ if (observeFreeze) {+ observeFreeze = false;+ signalFrozen();+ }+ return current;+ } });+ captured.requestHandler = async (command) => {+ if (command.type === 'get_available_models') return { success: true, data: { models: [+ { provider: 'pi-native', id: 'wire-model', contextWindow: liveWindow },+ ] } };+ return { success: true, data: command.type === 'get_state'+ ? { sessionFile: '/mock/s.jsonl', model: { contextWindow: 200_000 } }+ : {} };+ };++ const agent = new PiAgent(deps);+ observeFreeze = true;+ const firstStart = agent.startSession({+ sessionId: 'binary-window-v1', workingDir: cwd, model: 'local-model', providerId: 'native-a',+ makerMemoryEnabled: true, makerMemoryIndexSnapshot: '',+ });+ // Publish v2 after startSession freezes v1, while the async memory-scope+ // lookup still precedes native-provider resolution.+ await binaryFrozen;+ binaryPath = v2Path;+ const first = await firstStart;+ expect(resolvedBinaryPaths).toEqual([v1Path]);+ expect(captured.spawnBinaryPath).toBe(v1Path);+ expect(await first.previewModelSwitch?.('catalog-alias', { providerId: 'native-account' }))+ .toMatchObject({ targetContextWindow: 400_000 });+ expect(resolvedBinaryPaths).toEqual([v1Path, v1Path]);+ await first.close();++ liveWindow = 200_000;+ captured.requests.length = 0;+ const afterUpdate = await agent.startSession({+ sessionId: 'binary-window-v2', workingDir: cwd, model: 'local-model', providerId: 'native-a',+ });+ expect(captured.spawnBinaryPath).toBe(v2Path);+ const settings = JSON.parse(readFileSync(+ path.join(captured.env.PI_CODING_AGENT_DIR!, 'settings.json'), 'utf8',+ )) as { compaction?: { modelOverrides?: Record<string, { reserveTokens?: number }> } };+ expect(settings.compaction?.modelOverrides).not.toHaveProperty('pi-native/wire-model');+ expect(await afterUpdate.previewModelSwitch?.('catalog-alias', { providerId: 'native-account' }))+ .toMatchObject({ targetContextWindow: 200_000 });+ expect(resolvedBinaryPaths).toEqual([v1Path, v1Path, v2Path, v2Path]);+ await afterUpdate.close();+ });+it('refreshes a managed adapter when the same model ID gets a new descriptor', async () => {let window = 100_000;const deps = byomDeps(async () => ({ providers: [{diff --git a/packages/maker-core/src/agents/pi/index.ts b/packages/maker-core/src/agents/pi/index.tsindex 1d2b89e86c..dcee87c9c0 100644--- a/packages/maker-core/src/agents/pi/index.ts+++ b/packages/maker-core/src/agents/pi/index.ts@@ -1816,8 +1816,11 @@ export class PiAgent extends BaseAgent {});}- private inheritedNativeContextWindowKey(provider: string, model: string): string {- return `${provider}\0${model}`;+ private inheritedNativeContextWindowKey(binaryPath: string, provider: string, model: string): string {+ // Desktop may update Pi in place while this Agent stays registered. Bind a+ // learned catalog value to the binary frozen for that session: an old task+ // can remain alive after deps.binaryPath starts advertising the next build.+ return `${binaryPath}\0${provider}\0${model}`;}private requestSubagentRunnerExit(@@ -2054,8 +2057,8 @@ export class PiAgent extends BaseAgent {* 通常是 RemoteHost.execStream 在远端跑同一命令、把 stdin/stdout 拽回本地* (SshPiTransport)。PiAgent 对两种来源的差异零感知(协议层只认行)。*- * remoteBinaryPath:远端 pi 二进制绝对路径(host 已 probe)。需要它来决定- * plan-mode 扩展路径 / subagent spawn env —— 本地场景即 this.deps.binaryPath。+ * runtimeBinaryPath:会话冻结的 pi 二进制绝对路径。远端由 host probe,+ * 本地也必须使用快照,不能在异步准备完成后重新读取动态依赖。*/private async createTransport(opts: {@@ -2070,13 +2073,13 @@ export class PiAgent extends BaseAgent {},onProcessSpawned?: (pid: number) => void | (() => void),remoteHostId?: string | null,- remoteBinaryPath?: string,+ runtimeBinaryPath?: string,): Promise<{ transport: PiTransport; remoteBinaryPath: string | undefined }> {if (remoteHostId && this.deps.getRemotePiTransport) {const transport = await this.deps.getRemotePiTransport(remoteHostId, {binaryPath: this.deps.binaryPath,// startSession 已在 plan-mode 段前 resolve;host 侧有 cache,重复 probe 秒回。- remoteBinaryPath: remoteBinaryPath ?? this.deps.binaryPath,+ remoteBinaryPath: runtimeBinaryPath ?? this.deps.binaryPath,args: opts.args,cwd: opts.cwd,env: opts.env,@@ -2086,12 +2089,12 @@ export class PiAgent extends BaseAgent {});return {transport,- remoteBinaryPath: transport.remoteBinaryPath ?? remoteBinaryPath,+ remoteBinaryPath: transport.remoteBinaryPath ?? runtimeBinaryPath,};}return {transport: createPiStdioTransport({- binaryPath: this.deps.binaryPath,+ binaryPath: runtimeBinaryPath ?? this.deps.binaryPath,args: opts.args,cwd: opts.cwd,env: opts.env,@@ -2237,6 +2240,8 @@ export class PiAgent extends BaseAgent {workingContextWindow?: number;/** Session-frozen Pi auto-compact percentage. Do not re-read the live getter. */piCompactionPct?: number;+ /** Local Pi binary frozen for this session; scopes learned native windows. */+ runtimeBinaryPath?: string;/** Host-installed roots/specs for Pi's own package discovery. */packages?: readonly PiNativePackageEntry[];disabledSkills?: DisabledSkillLaunchSnapshot;@@ -2284,7 +2289,10 @@ export class PiAgent extends BaseAgent {// provider-aware 描述符,不能被同名 non-reasoning BYOM 清空 reasoning。// host 未注入 resolver 或只有 BYOM 条目时保留旧 flat fallback。const m = this.deps.resolvePiGatewayModelDescriptor?.(gatewayProviderId, publicModel.id) ?? publicModel;- const resolverContext = { remote: opts.remote === true };+ const resolverContext = {+ remote: opts.remote === true,+ runtimeBinaryPath: opts.runtimeBinaryPath,+ };const resolvedSpec = this.deps.resolvePiGatewayModelSpec?.(gatewayProviderId, m.id, resolverContext);const resolvedApi = resolvedSpec?.api ?? this.deps.resolvePiGatewayModelApi?.(gatewayProviderId,@@ -2451,9 +2459,9 @@ export class PiAgent extends BaseAgent {const workingWindow = this.deps.resolveModelContextLimit?.(provider.sourceProviderId ?? provider.id, model.id) ?? undefined;const inheritsNativeWindow = provider.inheritModels === true && model.api === undefined&& model.catalogAddition !== true && model.contextWindow === undefined;- const learnedWindow = !opts.remote && inheritsNativeWindow+ const learnedWindow = !opts.remote && opts.runtimeBinaryPath && inheritsNativeWindow? this.inheritedNativeContextWindows.get(- this.inheritedNativeContextWindowKey(provider.id, model.wireId ?? model.id),+ this.inheritedNativeContextWindowKey(opts.runtimeBinaryPath, provider.id, model.wireId ?? model.id),): undefined;// An inherited entry without a Cindy-owned window keeps Pi's native@@ -2563,6 +2571,9 @@ export class PiAgent extends BaseAgent {// 轮 22 LOW-6:空串 remoteHostId 规范化 —— Boolean('') 是 false 会让会话// 被判定本地但后续仍把 '' 传给 resolvePiNativeProviders 等, 行为分裂。if (opts.remoteHostId === '') opts.remoteHostId = undefined;+ // Freeze the local runtime identity before the first await. Desktop may+ // install a newer managed Pi while this task remains alive.+ const sessionRuntimeBinaryPath = opts.remoteHostId ? undefined : this.deps.binaryPath;if (opts.remoteHostId && !this.deps.getRemotePiTransport) {throw new NotSupportedError('remoteSession', {supported: false,@@ -2632,6 +2643,7 @@ export class PiAgent extends BaseAgent {remoteHostId: opts.remoteHostId,providerId: opts.providerId,model: opts.model,+ runtimeBinaryPath: sessionRuntimeBinaryPath,resumeSessionId: opts.resumeSessionId,});nativeProviders = resolved?.providers ?? [];@@ -2803,9 +2815,9 @@ export class PiAgent extends BaseAgent {const startupWorkingContextWindow = this.deps.resolveModelContextLimit?.(authProviderId, opts.model) ?? undefined;const nativeModel = nativeProviders.find((provider) => provider.id === initialProvider)?.models.find((model) => (model.wireId ?? model.id) === initialWireModel);- const learnedNativeContextWindow = !remote && nativeModel?.contextWindow === undefined+ const learnedNativeContextWindow = !remote && sessionRuntimeBinaryPath && nativeModel?.contextWindow === undefined? this.inheritedNativeContextWindows.get(- this.inheritedNativeContextWindowKey(initialProvider, initialWireModel),+ this.inheritedNativeContextWindowKey(sessionRuntimeBinaryPath, initialProvider, initialWireModel),): undefined;const startupContextWindow = Math.max(@@ -2935,7 +2947,7 @@ export class PiAgent extends BaseAgent {// the current `cindy` provider and leak an invalid unnamespaced model id.// 受邀者分享的不是网关时,子代理不能改走网关。const routedGatewaySubagentModels = guestOmitsGateway ? [] : gatewaySubagentModels.filter((model) => {- const resolverContext = { remote };+ const resolverContext = { remote, runtimeBinaryPath: sessionRuntimeBinaryPath };const spec = this.deps.resolvePiGatewayModelSpec?.(PI_PROVIDER_ID, model.id, resolverContext);const api = spec?.api ?? this.deps.resolvePiGatewayModelApi?.(PI_PROVIDER_ID,@@ -3207,6 +3219,7 @@ export class PiAgent extends BaseAgent {contextWindow: startupContextWindow,workingContextWindow: startupWorkingContextWindow,piCompactionPct: sessionPiAutoCompactPct,+ runtimeBinaryPath: sessionRuntimeBinaryPath,});configHome = joinRemotePosixPath(agentHome,@@ -3223,6 +3236,7 @@ export class PiAgent extends BaseAgent {remote, fileOps, contextWindow: startupContextWindow,workingContextWindow: startupWorkingContextWindow,piCompactionPct: sessionPiAutoCompactPct,+ runtimeBinaryPath: sessionRuntimeBinaryPath,...(guestOmitsGateway ? { omitGatewayModels: true } : {}),},);@@ -3761,7 +3775,7 @@ export class PiAgent extends BaseAgent {}return resolved;})(opts.remoteHostId)- : this.deps.binaryPath;+ : sessionRuntimeBinaryPath!;// plan 模式:挂载 pi 自带的 plan-mode example 扩展(随 pi 分发,版本匹配,免 vendoring)。// 只在文件存在时 --extension;缺失则 plan 模式静默降级(setPlanMode 时 warn)。@@ -6483,6 +6497,7 @@ export class PiAgent extends BaseAgent {remoteHostId: opts.remoteHostId,providerId: requestedProviderId,model,+ runtimeBinaryPath: sessionRuntimeBinaryPath,resumeSessionId: sdkSessionId || opts.resumeSessionId,purpose: 'preview',});@@ -6541,7 +6556,9 @@ export class PiAgent extends BaseAgent {&& nativeModel.catalogAddition !== true && nativeModel.contextWindow === undefined;}const gatewaySpec = gateway- ? this.deps.resolvePiGatewayModelSpec?.(sourceId, model, { remote })+ ? this.deps.resolvePiGatewayModelSpec?.(sourceId, model, {+ remote, runtimeBinaryPath: sessionRuntimeBinaryPath,+ }): undefined;if (gateway && gatewaySpec === null) {return { action: 'unavailable', targetContextWindow: null, windowVerified: false,@@ -6569,7 +6586,7 @@ export class PiAgent extends BaseAgent {configuredWindow = actualWindow;if (!remote && provider && wireId) {this.inheritedNativeContextWindows.set(- this.inheritedNativeContextWindowKey(provider, wireId),+ this.inheritedNativeContextWindowKey(effectivePiBinaryPath, provider, wireId),actualWindow,);}@@ -6594,6 +6611,7 @@ export class PiAgent extends BaseAgent {contextWindow: targetContextWindow ?? ctx.contextWindow ?? startupContextWindow,workingContextWindow: this.deps.resolveModelContextLimit?.(sourceId, model) ?? undefined,piCompactionPct: sessionPiAutoCompactPct,+ runtimeBinaryPath: sessionRuntimeBinaryPath,packages: nativePackagePaths, disabledSkills: disabledSkillLaunch,...(guestOmitsGateway ? { omitGatewayModels: true } : {}) },);@@ -6649,6 +6667,7 @@ export class PiAgent extends BaseAgent {remoteHostId: opts.remoteHostId,providerId: requestedProviderId,model,+ runtimeBinaryPath: sessionRuntimeBinaryPath,resumeSessionId: sdkSessionId || opts.resumeSessionId,purpose: 'live-refresh',});@@ -6727,7 +6746,8 @@ export class PiAgent extends BaseAgent {nextGateway ? requestedProviderId : authProviderId,{ remote, fileOps, contextWindow: nextDescriptor?.contextWindow ?? ctx.contextWindow,workingContextWindow: this.deps.resolveModelContextLimit?.(sourceId, model) ?? undefined,- piCompactionPct: sessionPiAutoCompactPct, packages: nativePackagePaths,+ piCompactionPct: sessionPiAutoCompactPct, runtimeBinaryPath: sessionRuntimeBinaryPath,+ packages: nativePackagePaths,disabledSkills: disabledSkillLaunch,...(guestOmitsGateway ? { omitGatewayModels: true } : {}) },);