feat(sdk,plugins): APIs publiques lancement commandes + outillage + événements + config (#125,#126,#127,#130)
This commit is contained in:
@ -56,3 +56,4 @@ vector-onnx = ["infrastructure/vector-onnx", "backend/vector-onnx"]
|
|||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
uuid = { workspace = true }
|
uuid = { workspace = true }
|
||||||
async-trait = { workspace = true }
|
async-trait = { workspace = true }
|
||||||
|
tauri = { workspace = true, features = ["test"] }
|
||||||
|
|||||||
@ -1760,6 +1760,234 @@ export interface PluginRuntimeContributionCatalog {
|
|||||||
plugins: PluginRuntimePlugin[];
|
plugins: PluginRuntimePlugin[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Plugin SDK workspace/project-structure API (#124 + #129)
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** A UTF-8 workspace file returned by the public plugin workspace API. */
|
||||||
|
export interface PluginWorkspaceTextFile {
|
||||||
|
path: string;
|
||||||
|
content: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** A binary workspace file returned by the public plugin workspace API. */
|
||||||
|
export interface PluginWorkspaceBinaryFile {
|
||||||
|
path: string;
|
||||||
|
bytes: Uint8Array;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** One entry in a plugin-visible workspace directory listing. */
|
||||||
|
export interface PluginWorkspaceDirEntry {
|
||||||
|
name: string;
|
||||||
|
path: string;
|
||||||
|
isDir: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Directory listing returned by the public plugin workspace API. */
|
||||||
|
export interface PluginWorkspaceDirectoryListing {
|
||||||
|
path: string;
|
||||||
|
entries: PluginWorkspaceDirEntry[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Basic plugin-visible stat result for one workspace path. */
|
||||||
|
export interface PluginWorkspaceStat {
|
||||||
|
path: string;
|
||||||
|
exists: boolean;
|
||||||
|
isFile: boolean;
|
||||||
|
isDir: boolean;
|
||||||
|
len: number | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type PluginProjectStructureEntryKind = "file" | "directory";
|
||||||
|
|
||||||
|
/** One bounded project-structure entry returned to plugins. */
|
||||||
|
export interface PluginProjectStructureEntry {
|
||||||
|
path: string;
|
||||||
|
name: string;
|
||||||
|
kind: PluginProjectStructureEntryKind;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Generic convention detected from marker files. */
|
||||||
|
export interface PluginProjectConvention {
|
||||||
|
id: string;
|
||||||
|
markerPath: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Generic logical module inferred from marker files. */
|
||||||
|
export interface PluginProjectModule {
|
||||||
|
path: string;
|
||||||
|
markerPath: string;
|
||||||
|
conventionId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Bounded, generic project-structure query result for plugins. */
|
||||||
|
export interface PluginProjectStructure {
|
||||||
|
projectId: string;
|
||||||
|
rootPath: string;
|
||||||
|
entries: PluginProjectStructureEntry[];
|
||||||
|
conventions: PluginProjectConvention[];
|
||||||
|
modules: PluginProjectModule[];
|
||||||
|
truncated: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Plugin SDK command-task API (#125)
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export type PluginCommandTaskState =
|
||||||
|
| "queued"
|
||||||
|
| "running"
|
||||||
|
| "waiting"
|
||||||
|
| "completed"
|
||||||
|
| "failed"
|
||||||
|
| "cancelled"
|
||||||
|
| "expired";
|
||||||
|
|
||||||
|
/** One command-backed task launched through the public plugin task API. */
|
||||||
|
export interface PluginCommandTask {
|
||||||
|
taskId: string;
|
||||||
|
ownerAgentId: string;
|
||||||
|
projectId: string;
|
||||||
|
kind: string;
|
||||||
|
state: PluginCommandTaskState;
|
||||||
|
exitCode: number | null;
|
||||||
|
summary: string | null;
|
||||||
|
stdoutTail: string | null;
|
||||||
|
stderrTail: string | null;
|
||||||
|
createdAtMs: number;
|
||||||
|
updatedAtMs: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Plugin SDK external-toolchain diagnostics API (#126)
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export type PluginToolStatus = "ok" | "failed" | "missing";
|
||||||
|
export type PluginEnvStatus = "ok" | "missing" | "mismatch";
|
||||||
|
export type PluginFileKind = "file" | "directory" | "other" | "missing";
|
||||||
|
export type PluginExpectedFileKind = "file" | "directory" | "any";
|
||||||
|
export type PluginDiagnosticLevel = "info" | "warning" | "error";
|
||||||
|
|
||||||
|
/** Generic diagnostic result for external tools, env vars and workspace files. */
|
||||||
|
export interface PluginToolchainDiagnostic {
|
||||||
|
projectId: string;
|
||||||
|
cwd: string;
|
||||||
|
ok: boolean;
|
||||||
|
tools: PluginToolDiagnostic[];
|
||||||
|
env: PluginEnvDiagnostic[];
|
||||||
|
files: PluginFileDiagnostic[];
|
||||||
|
messages: PluginDiagnosticMessage[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginToolDiagnostic {
|
||||||
|
id: string;
|
||||||
|
executable: string;
|
||||||
|
present: boolean;
|
||||||
|
ok: boolean;
|
||||||
|
status: PluginToolStatus;
|
||||||
|
required: boolean;
|
||||||
|
exitCode: number | null;
|
||||||
|
version: string | null;
|
||||||
|
stdout: string | null;
|
||||||
|
stderr: string | null;
|
||||||
|
error: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginEnvDiagnostic {
|
||||||
|
name: string;
|
||||||
|
present: boolean;
|
||||||
|
ok: boolean;
|
||||||
|
required: boolean;
|
||||||
|
value: string | null;
|
||||||
|
status: PluginEnvStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginFileDiagnostic {
|
||||||
|
path: string;
|
||||||
|
exists: boolean;
|
||||||
|
ok: boolean;
|
||||||
|
required: boolean;
|
||||||
|
kind: PluginFileKind;
|
||||||
|
expectedKind: PluginExpectedFileKind | null;
|
||||||
|
len: number | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginDiagnosticMessage {
|
||||||
|
level: PluginDiagnosticLevel;
|
||||||
|
message: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Plugin SDK public event/watch API (#127)
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export type PluginPublicEventType = "workspaceFileChanged" | "backgroundTaskChanged";
|
||||||
|
|
||||||
|
export interface PluginEventSubscription {
|
||||||
|
subscriptionId: string;
|
||||||
|
projectId: string;
|
||||||
|
eventTypes: PluginPublicEventType[];
|
||||||
|
capacity: number;
|
||||||
|
retention: "bestEffortBounded" | "disposed" | string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginEventBatch {
|
||||||
|
subscriptionId: string;
|
||||||
|
events: PluginPublicEvent[];
|
||||||
|
dropped: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type PluginPublicEvent = PluginWorkspaceFileChangedEvent | PluginBackgroundTaskChangedEvent;
|
||||||
|
|
||||||
|
export interface PluginWorkspaceFileChangedEvent {
|
||||||
|
type: "workspaceFileChanged";
|
||||||
|
sequence: number;
|
||||||
|
occurredAtMs: number;
|
||||||
|
projectId: string;
|
||||||
|
path: string;
|
||||||
|
operation: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginBackgroundTaskChangedEvent {
|
||||||
|
type: "backgroundTaskChanged";
|
||||||
|
sequence: number;
|
||||||
|
occurredAtMs: number;
|
||||||
|
projectId: string;
|
||||||
|
taskId: string;
|
||||||
|
ownerAgentId: string;
|
||||||
|
state: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Plugin SDK structured configuration documents API (#130)
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
export type JsonValue =
|
||||||
|
| null
|
||||||
|
| boolean
|
||||||
|
| number
|
||||||
|
| string
|
||||||
|
| JsonValue[]
|
||||||
|
| { [key: string]: JsonValue };
|
||||||
|
|
||||||
|
export type PluginConfigDocumentFormat = "json";
|
||||||
|
export type PluginConfigUpdateMode = "mergePatch" | "replace";
|
||||||
|
|
||||||
|
export interface PluginConfigDocument {
|
||||||
|
projectId: string;
|
||||||
|
path: string;
|
||||||
|
format: PluginConfigDocumentFormat;
|
||||||
|
value: JsonValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginConfigDocumentWriteResult {
|
||||||
|
projectId: string;
|
||||||
|
path: string;
|
||||||
|
format: PluginConfigDocumentFormat;
|
||||||
|
mode: PluginConfigUpdateMode;
|
||||||
|
bytesWritten: number;
|
||||||
|
}
|
||||||
|
|
||||||
/** Manifest declaration of a top-level menu (carnet §7.1). */
|
/** Manifest declaration of a top-level menu (carnet §7.1). */
|
||||||
export interface PluginTopLevelMenuContribution {
|
export interface PluginTopLevelMenuContribution {
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
@ -43,11 +43,26 @@ import type {
|
|||||||
PairingCode,
|
PairingCode,
|
||||||
PermissionSet,
|
PermissionSet,
|
||||||
PluginAdmin,
|
PluginAdmin,
|
||||||
|
PluginCommandTask,
|
||||||
|
PluginConfigDocument,
|
||||||
|
PluginConfigDocumentFormat,
|
||||||
|
PluginConfigDocumentWriteResult,
|
||||||
|
PluginConfigUpdateMode,
|
||||||
|
PluginEventBatch,
|
||||||
|
PluginEventSubscription,
|
||||||
|
PluginPublicEventType,
|
||||||
|
PluginExpectedFileKind,
|
||||||
PluginInstallResult,
|
PluginInstallResult,
|
||||||
|
PluginToolchainDiagnostic,
|
||||||
|
PluginProjectStructure,
|
||||||
PluginReview,
|
PluginReview,
|
||||||
PluginRuntimeContributionCatalog,
|
PluginRuntimeContributionCatalog,
|
||||||
PluginSourceKind,
|
PluginSourceKind,
|
||||||
PluginUninstallResult,
|
PluginUninstallResult,
|
||||||
|
PluginWorkspaceBinaryFile,
|
||||||
|
PluginWorkspaceDirectoryListing,
|
||||||
|
PluginWorkspaceStat,
|
||||||
|
PluginWorkspaceTextFile,
|
||||||
ProjectMcpToolPermissions,
|
ProjectMcpToolPermissions,
|
||||||
PageDirection,
|
PageDirection,
|
||||||
Project,
|
Project,
|
||||||
@ -1361,6 +1376,126 @@ export interface PluginGateway {
|
|||||||
openPluginsFolder(pluginId?: string): Promise<void>;
|
openPluginsFolder(pluginId?: string): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface PluginWorkspacePathInput {
|
||||||
|
projectId: string;
|
||||||
|
path: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginWorkspaceWriteTextInput extends PluginWorkspacePathInput {
|
||||||
|
content: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginWorkspaceWriteBinaryInput extends PluginWorkspacePathInput {
|
||||||
|
bytes: Uint8Array;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginProjectStructureQuery {
|
||||||
|
projectId: string;
|
||||||
|
path?: string;
|
||||||
|
maxDepth?: number;
|
||||||
|
maxEntries?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginWorkspaceGateway {
|
||||||
|
readText(input: PluginWorkspacePathInput): Promise<PluginWorkspaceTextFile>;
|
||||||
|
readBinary(input: PluginWorkspacePathInput): Promise<PluginWorkspaceBinaryFile>;
|
||||||
|
writeText(input: PluginWorkspaceWriteTextInput): Promise<void>;
|
||||||
|
writeBinary(input: PluginWorkspaceWriteBinaryInput): Promise<void>;
|
||||||
|
listDir(input: PluginWorkspacePathInput): Promise<PluginWorkspaceDirectoryListing>;
|
||||||
|
stat(input: PluginWorkspacePathInput): Promise<PluginWorkspaceStat>;
|
||||||
|
queryProjectStructure(input: PluginProjectStructureQuery): Promise<PluginProjectStructure>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginRunCommandInput {
|
||||||
|
projectId: string;
|
||||||
|
ownerAgentId: string;
|
||||||
|
label: string;
|
||||||
|
command: string;
|
||||||
|
args?: string[];
|
||||||
|
cwd?: string;
|
||||||
|
env?: Array<[string, string]>;
|
||||||
|
recordOnly?: boolean;
|
||||||
|
deadlineMs?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginTaskStatusInput {
|
||||||
|
taskId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginTaskGateway {
|
||||||
|
runCommand(input: PluginRunCommandInput): Promise<PluginCommandTask>;
|
||||||
|
getStatus(input: PluginTaskStatusInput): Promise<PluginCommandTask | null>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginToolRequirementInput {
|
||||||
|
id: string;
|
||||||
|
executable: string;
|
||||||
|
versionArgs?: string[];
|
||||||
|
required?: boolean;
|
||||||
|
env?: Array<[string, string]>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginEnvRequirementInput {
|
||||||
|
name: string;
|
||||||
|
required?: boolean;
|
||||||
|
equals?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginFileRequirementInput {
|
||||||
|
path: string;
|
||||||
|
required?: boolean;
|
||||||
|
kind?: PluginExpectedFileKind;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginToolchainDiagnosticRequest {
|
||||||
|
projectId: string;
|
||||||
|
cwd?: string;
|
||||||
|
tools?: PluginToolRequirementInput[];
|
||||||
|
env?: PluginEnvRequirementInput[];
|
||||||
|
files?: PluginFileRequirementInput[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginToolchainGateway {
|
||||||
|
diagnose(input: PluginToolchainDiagnosticRequest): Promise<PluginToolchainDiagnostic>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginEventSubscribeInput {
|
||||||
|
projectId: string;
|
||||||
|
eventTypes?: PluginPublicEventType[];
|
||||||
|
capacity?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginEventPollInput {
|
||||||
|
subscriptionId: string;
|
||||||
|
maxEvents?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginEventUnsubscribeInput {
|
||||||
|
subscriptionId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginEventGateway {
|
||||||
|
subscribe(input: PluginEventSubscribeInput): Promise<PluginEventSubscription>;
|
||||||
|
poll(input: PluginEventPollInput): Promise<PluginEventBatch>;
|
||||||
|
unsubscribe(input: PluginEventUnsubscribeInput): Promise<PluginEventSubscription>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginConfigDocumentReadInput {
|
||||||
|
projectId: string;
|
||||||
|
path: string;
|
||||||
|
format?: PluginConfigDocumentFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginConfigDocumentUpdateInput extends PluginConfigDocumentReadInput {
|
||||||
|
mode?: PluginConfigUpdateMode;
|
||||||
|
value: PluginConfigDocument["value"];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface PluginConfigGateway {
|
||||||
|
readDocument(input: PluginConfigDocumentReadInput): Promise<PluginConfigDocument>;
|
||||||
|
updateDocument(input: PluginConfigDocumentUpdateInput): Promise<PluginConfigDocumentWriteResult>;
|
||||||
|
}
|
||||||
|
|
||||||
export interface Gateways {
|
export interface Gateways {
|
||||||
system: SystemGateway;
|
system: SystemGateway;
|
||||||
agent: AgentGateway;
|
agent: AgentGateway;
|
||||||
@ -1386,4 +1521,9 @@ export interface Gateways {
|
|||||||
focusedProject: FocusedProjectGateway;
|
focusedProject: FocusedProjectGateway;
|
||||||
uiPreferences: UiPreferencesGateway;
|
uiPreferences: UiPreferencesGateway;
|
||||||
plugin: PluginGateway;
|
plugin: PluginGateway;
|
||||||
|
pluginWorkspace: PluginWorkspaceGateway;
|
||||||
|
pluginTask: PluginTaskGateway;
|
||||||
|
pluginToolchain: PluginToolchainGateway;
|
||||||
|
pluginEvents: PluginEventGateway;
|
||||||
|
pluginConfig: PluginConfigGateway;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user