feat(sdk,plugins): APIs publiques lancement commandes + outillage + événements + config (#125,#126,#127,#130)

This commit is contained in:
2026-08-02 13:35:48 +02:00
parent dce61ae1aa
commit e3e887d6a4
3 changed files with 369 additions and 0 deletions

View File

@ -1760,6 +1760,234 @@ export interface PluginRuntimeContributionCatalog {
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). */
export interface PluginTopLevelMenuContribution {
id: string;