feat: integrate marketplace plugins with coding runtime

This commit is contained in:
2026-08-28 18:02:51 +08:00
parent 1d64b89499
commit 05917a789a
21 changed files with 1921 additions and 29 deletions

View File

@@ -16,6 +16,7 @@ import {
import type { PiProductTools } from './product-tools';
import type { CodingPluginToolDefinition } from '../../../shared/coding-plugins';
import type { PiSkillEntry } from './resource-loader';
import type { EffectivePluginSnapshot } from '../../coding-plugins/effective-resolver';
const MAX_REQUEST_BYTES = 64 * 1024;
const PRODUCT_TOOL_NAME_PATTERN = /^[A-Za-z][A-Za-z0-9._:-]{0,63}$/u;
@@ -40,6 +41,7 @@ interface WorkerRegistrationRecord {
tools: CodingPluginToolDefinition[];
projectWriteLeaseToolNames: string[];
role: 'parent' | 'child';
effectiveSnapshot?: EffectivePluginSnapshot;
contextFile: string;
runId: string | null;
leases: Map<string, PiProjectWriteLease>;
@@ -62,6 +64,8 @@ export interface RegisterPiExtensionWorkerInput {
skillEntries?: readonly PiSkillEntry[];
catalogRevision?: number;
tools?: readonly CodingPluginToolDefinition[];
/** Exact Main-owned resolver output used for this worker generation. */
effectiveSnapshot?: EffectivePluginSnapshot;
extensionsDir: string;
role?: 'parent' | 'child';
runId?: string;
@@ -248,6 +252,7 @@ export class PiManagedExtensionHost {
tools,
projectWriteLeaseToolNames,
role,
...(input.effectiveSnapshot ? { effectiveSnapshot: input.effectiveSnapshot } : {}),
contextFile,
runId: role === 'child'
? input.runId as string
@@ -424,6 +429,7 @@ export class PiManagedExtensionHost {
projectId: record.projectId,
projectPath: record.projectPath,
skillIds: record.skillIds,
...(record.effectiveSnapshot ? { effectiveSnapshot: record.effectiveSnapshot } : {}),
}, value.input);
this.respond(response, 200, { result: productResult });
return;
@@ -589,6 +595,7 @@ export class PiManagedExtensionHost {
role: record.role,
skillIds: record.skillIds,
...(record.catalogRevision === undefined ? {} : { catalogRevision: record.catalogRevision }),
...(record.effectiveSnapshot ? { effectivePluginSnapshot: record.effectiveSnapshot } : {}),
allowedToolNames: record.allowedToolNames,
tools: record.tools,
projectWriteLeaseToolNames: record.projectWriteLeaseToolNames,