feat(coding): add model tools and device packages

This commit is contained in:
2026-09-02 18:35:26 +08:00
parent 841273b433
commit 664b8823a0
60 changed files with 3847 additions and 2068 deletions

View File

@@ -40,6 +40,8 @@ interface WorkerRegistrationRecord {
projectWriteLeaseToolNames: string[];
role: 'parent' | 'child';
effectiveSnapshot?: EffectivePluginSnapshot;
devicePackageGeneration?: number;
devicePackageIds?: string[];
contextFile: string;
runId: string | null;
leases: Map<string, PiProjectWriteLease>;
@@ -64,6 +66,8 @@ export interface RegisterPiExtensionWorkerInput {
tools?: readonly CodingPluginToolDefinition[];
/** Exact Main-owned resolver output used for this worker generation. */
effectiveSnapshot?: EffectivePluginSnapshot;
devicePackageGeneration?: number;
devicePackageIds?: readonly string[];
extensionsDir: string;
role?: 'parent' | 'child';
runId?: string;
@@ -252,6 +256,10 @@ export class PiManagedExtensionHost {
projectWriteLeaseToolNames,
role,
...(input.effectiveSnapshot ? { effectiveSnapshot: input.effectiveSnapshot } : {}),
...(input.devicePackageGeneration === undefined
? {}
: { devicePackageGeneration: input.devicePackageGeneration }),
...(input.devicePackageIds ? { devicePackageIds: [...input.devicePackageIds] } : {}),
contextFile,
runId: role === 'child'
? input.runId as string
@@ -424,6 +432,7 @@ export class PiManagedExtensionHost {
}
const productResult = await this.productTools.execute(value.toolName, {
conversationId: record.conversationId,
workerGeneration: record.generation,
runId: value.runId,
resourceId: value.resourceId,
projectId: record.projectId,
@@ -596,6 +605,10 @@ export class PiManagedExtensionHost {
skillIds: record.skillIds,
...(record.catalogRevision === undefined ? {} : { catalogRevision: record.catalogRevision }),
...(record.effectiveSnapshot ? { effectivePluginSnapshot: record.effectiveSnapshot } : {}),
...(record.devicePackageGeneration === undefined
? {}
: { devicePackageGeneration: record.devicePackageGeneration }),
...(record.devicePackageIds ? { devicePackageIds: record.devicePackageIds } : {}),
allowedToolNames: record.allowedToolNames,
tools: record.tools,
projectWriteLeaseToolNames: record.projectWriteLeaseToolNames,