fix(pi): resolve packaged proxy token lazily

This commit is contained in:
2026-08-24 21:41:29 +08:00
parent fa510c4976
commit f902edefd0
13 changed files with 934 additions and 30 deletions

View File

@@ -46,7 +46,7 @@ export interface CreateCodingCompositionOptions {
projectStore?: CodingProjectStore;
browser: AgentBrowserModule;
paths: CodingCompositionPaths;
localProxyCredential?: string;
getLocalProxyCredential?(): string | undefined;
}
export function resolveCodingPiRuntimePaths(input: {
@@ -73,6 +73,7 @@ export function resolveCodingPiRuntimePaths(input: {
export function createCodingComposition(
options: CreateCodingCompositionOptions,
): CodingProductComposition {
const getLocalProxyCredential = options.getLocalProxyCredential;
const projectStore = options.projectStore ?? createCodingProjectStore(options.storage);
const attachments = new CodingAttachmentStore(
path.join(options.paths.userDataDir, 'coding-runtime', 'attachments'),
@@ -113,8 +114,8 @@ export function createCodingComposition(
bundledSkillsDir: options.paths.bundledSkillsDir,
loadProviderInput,
resolveCredential: resolvePiProviderCredentialFromSecretStore,
...(options.localProxyCredential
? { getLocalProxyCredential: async () => options.localProxyCredential }
...(getLocalProxyCredential
? { getLocalProxyCredential: async () => getLocalProxyCredential() }
: {}),
extensionHost,
}),
@@ -129,8 +130,8 @@ export function createCodingComposition(
loadProviderInput,
resolveCredential: resolvePiProviderCredentialFromSecretStore,
getRevision: () => revisions.current,
...(options.localProxyCredential
? { getLocalProxyCredential: async () => options.localProxyCredential }
...(getLocalProxyCredential
? { getLocalProxyCredential: async () => getLocalProxyCredential() }
: {}),
});
const subagents = new PiSubagentScheduler({