@xpert-ai/plugin-sdk 3.23.1 → 3.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/README.md +8 -0
- package/docs/analytics.md +42 -0
- package/docs/artifact-presentations.md +43 -0
- package/docs/mcp-client.md +63 -0
- package/docs/provider-credential-validation.md +34 -0
- package/docs/rest-client.md +24 -0
- package/docs/workspace-file-tools.md +6 -0
- package/index.cjs.js +471 -89
- package/index.esm.js +448 -92
- package/model-provider.cjs.js +10 -0
- package/model-provider.esm.js +9 -1
- package/package.json +2 -2
- package/src/index.d.ts +2 -0
- package/src/lib/agent/handoff/agent-runtime-message.contract.d.ts +76 -76
- package/src/lib/agent/middleware/capabilities/assistant-task.d.ts +36 -1
- package/src/lib/agent/runtime/dispatch.d.ts +284 -284
- package/src/lib/agent/runtime/index.d.ts +1 -0
- package/src/lib/agent/runtime/pipeline-scope.d.ts +110 -0
- package/src/lib/agent/runtime/types.d.ts +4 -2
- package/src/lib/ai-model/ai-model-provider.interface.d.ts +3 -1
- package/src/lib/ai-model/utils/limits.d.ts +4 -2
- package/src/lib/artifact-presentation/index.d.ts +35 -0
- package/src/lib/data/analytics/analytics-payload.d.ts +3 -0
- package/src/lib/data/analytics/index.d.ts +1 -0
- package/src/lib/data/datasource/types.d.ts +1 -1
- package/src/lib/project-pipeline/adapters.d.ts +87 -0
- package/src/lib/project-pipeline/capability.d.ts +100 -0
- package/src/lib/project-pipeline/index.d.ts +5 -0
- package/src/lib/project-pipeline/projection.d.ts +71 -0
- package/src/lib/project-pipeline/registry.d.ts +509 -0
- package/src/lib/project-pipeline/runtime-registry.d.ts +45 -0
- package/src/lib/project-pipeline/scoped-registry.d.ts +10 -0
- package/src/lib/project-task/index.d.ts +6 -0
- package/src/lib/project-type/index.d.ts +17 -1
- package/src/lib/rag/types.d.ts +1 -1
- package/src/lib/runtime/capabilities/artifacts.d.ts +2 -0
- package/src/lib/runtime/capabilities/index.d.ts +2 -0
- package/src/lib/runtime/capabilities/mcp-client-runtime.d.ts +41 -0
- package/src/lib/runtime/capabilities/rest-client-runtime.d.ts +34 -0
- package/src/lib/sandbox/file-edits.d.ts +4 -0
- package/src/lib/sandbox/protocol.d.ts +7 -1
- package/src/lib/sandbox/sandbox.d.ts +2 -8
- package/src/lib/tool-provider/adapters.d.ts +1 -1
- package/src/lib/tool-provider/types.d.ts +2 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { JSONValue } from '@xpert-ai/contracts';
|
|
2
|
+
import type { RuntimeIdentityScope } from '../runtime-scope';
|
|
3
|
+
/** References an existing platform connection. No URLs, credentials or connection overrides. */
|
|
4
|
+
export interface McpClientScope {
|
|
5
|
+
actor: Required<Pick<RuntimeIdentityScope, 'tenantId' | 'organizationId' | 'userId'>>;
|
|
6
|
+
workspaceId: string;
|
|
7
|
+
toolsetId: string;
|
|
8
|
+
serverName: string;
|
|
9
|
+
signal: AbortSignal;
|
|
10
|
+
deadlineAt: number;
|
|
11
|
+
}
|
|
12
|
+
export interface McpClientToolDescriptor {
|
|
13
|
+
name: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
inputSchema: Record<string, JSONValue>;
|
|
16
|
+
outputSchema?: Record<string, JSONValue>;
|
|
17
|
+
/** Pins input/output schemas and behavior hints, not authorization or server implementation. */
|
|
18
|
+
contractHash: string;
|
|
19
|
+
}
|
|
20
|
+
export interface McpClientToolResult {
|
|
21
|
+
structuredContent?: Record<string, JSONValue>;
|
|
22
|
+
/** Plain text blocks only. Consumers must explicitly opt into a text JSON result contract. */
|
|
23
|
+
text: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface McpClientToolCall {
|
|
26
|
+
toolName: string;
|
|
27
|
+
contractHash: string;
|
|
28
|
+
arguments: Record<string, JSONValue>;
|
|
29
|
+
}
|
|
30
|
+
/** The host currently permits read-only tools only; requests cannot relax this policy. */
|
|
31
|
+
export interface McpClientToolsApi {
|
|
32
|
+
/** Lists enabled, model-visible tools advertising read-only behavior for the current viewer. */
|
|
33
|
+
list(scope: McpClientScope): Promise<McpClientToolDescriptor[]>;
|
|
34
|
+
/** Callers must additionally restrict tools to their own approved operation catalog. */
|
|
35
|
+
call(scope: McpClientScope, request: McpClientToolCall): Promise<McpClientToolResult>;
|
|
36
|
+
}
|
|
37
|
+
/** Governed access to existing platform MCP connections. Only implemented capabilities are exposed. */
|
|
38
|
+
export interface McpClientRuntimeApi {
|
|
39
|
+
readonly tools: McpClientToolsApi;
|
|
40
|
+
}
|
|
41
|
+
export declare const McpClientRuntimeCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<McpClientRuntimeApi>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { JSONValue } from '@xpert-ai/contracts';
|
|
2
|
+
import type { RuntimeIdentityScope } from '../runtime-scope';
|
|
3
|
+
/** References a saved OpenAPI toolset; transport addresses and credentials stay in the host. */
|
|
4
|
+
export interface RestClientScope {
|
|
5
|
+
actor: Required<Pick<RuntimeIdentityScope, 'tenantId' | 'organizationId' | 'userId'>>;
|
|
6
|
+
workspaceId: string;
|
|
7
|
+
toolsetId: string;
|
|
8
|
+
signal: AbortSignal;
|
|
9
|
+
deadlineAt: number;
|
|
10
|
+
}
|
|
11
|
+
export interface RestOperationDescriptor {
|
|
12
|
+
operationId: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
method: 'GET' | 'POST';
|
|
15
|
+
inputSchema: Record<string, JSONValue>;
|
|
16
|
+
/** Pins endpoint, parameter serialization and read-only declaration, not access grants. */
|
|
17
|
+
contractHash: string;
|
|
18
|
+
}
|
|
19
|
+
export interface RestOperationCall {
|
|
20
|
+
operationId: string;
|
|
21
|
+
contractHash: string;
|
|
22
|
+
arguments: Record<string, JSONValue>;
|
|
23
|
+
}
|
|
24
|
+
export interface RestClientRuntimeApi {
|
|
25
|
+
readonly operations: {
|
|
26
|
+
/** Enabled GET operations and POST operations explicitly declared x-xpert-read-only. */
|
|
27
|
+
list(scope: RestClientScope): Promise<RestOperationDescriptor[]>;
|
|
28
|
+
call(scope: RestClientScope, request: RestOperationCall): Promise<{
|
|
29
|
+
body: JSONValue;
|
|
30
|
+
sourceFetchedAt: string;
|
|
31
|
+
}>;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export declare const RestClientRuntimeCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<RestClientRuntimeApi>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { EditOperation, EditResult, ExecuteResponse, MaybePromise, MultiEditResult } from './protocol';
|
|
2
|
+
export declare function editCommandResult(filePath: string, result: ExecuteResponse): EditResult;
|
|
3
|
+
/** Stops on failure; never promises rollback or silently reapplies completed edits. */
|
|
4
|
+
export declare function sequentialFileEdits(filePath: string, edits: EditOperation[], apply: (edit: EditOperation) => MaybePromise<EditResult>): Promise<MultiEditResult>;
|
|
@@ -139,6 +139,12 @@ export interface MultiEditResult {
|
|
|
139
139
|
filesUpdate?: Record<string, FileData> | null;
|
|
140
140
|
/** Results from each individual edit operation */
|
|
141
141
|
results?: EditResult[];
|
|
142
|
+
/** Present when the backend reports sequential persistence. Indices are one-based. */
|
|
143
|
+
progress?: {
|
|
144
|
+
mode: 'sequential';
|
|
145
|
+
appliedEdits: number;
|
|
146
|
+
failedEdit?: number;
|
|
147
|
+
};
|
|
142
148
|
/** Metadata for the multi-edit operation, attached to the ToolMessage */
|
|
143
149
|
metadata?: Record<string, unknown>;
|
|
144
150
|
}
|
|
@@ -290,7 +296,7 @@ export interface BackendProtocol extends IBackendProtocol {
|
|
|
290
296
|
/**
|
|
291
297
|
* Perform multiple sequential edits on a single file.
|
|
292
298
|
* All edits are applied sequentially, with each edit operating on the result of the previous edit.
|
|
293
|
-
*
|
|
299
|
+
* Earlier successful edits may persist when a later edit fails. Inspect progress and reread before retrying.
|
|
294
300
|
*
|
|
295
301
|
* @param filePath - Absolute file path
|
|
296
302
|
* @param edits - Array of edit operations to perform sequentially
|
|
@@ -97,14 +97,8 @@ export declare abstract class BaseSandbox implements SandboxBackendProtocol {
|
|
|
97
97
|
* Append content to a file. Creates the file if it doesn't exist.
|
|
98
98
|
*/
|
|
99
99
|
append(filePath: string, content: string): Promise<WriteResult>;
|
|
100
|
-
/**
|
|
101
|
-
* Edit a file by replacing string occurrences.
|
|
102
|
-
*/
|
|
100
|
+
/** Edit a file by replacing string occurrences. */
|
|
103
101
|
edit(filePath: string, oldString: string, newString: string, replaceAll?: boolean): Promise<EditResult>;
|
|
104
|
-
/**
|
|
105
|
-
* Perform multiple sequential edits on a single file.
|
|
106
|
-
* All edits are applied sequentially, with each edit operating on the result of the previous edit.
|
|
107
|
-
* All edits must succeed for the operation to succeed (atomic).
|
|
108
|
-
*/
|
|
102
|
+
/** Earlier successful edits remain persisted if a later edit fails. */
|
|
109
103
|
multiEdit(filePath: string, edits: EditOperation[]): Promise<MultiEditResult>;
|
|
110
104
|
}
|
|
@@ -13,7 +13,7 @@ export declare class DecoratedToolsetStrategy implements IToolsetStrategy<IXpert
|
|
|
13
13
|
readonly descriptor: XpertToolProviderDescriptor;
|
|
14
14
|
readonly meta: IToolsetStrategy<IXpertToolset>['meta'];
|
|
15
15
|
constructor(instance: XpertToolProviderInstance, pluginName?: string, pluginVersion?: string);
|
|
16
|
-
validateConfig(): Promise<void>;
|
|
16
|
+
validateConfig(config?: unknown): Promise<void>;
|
|
17
17
|
create(toolset: IXpertToolset, params?: TBuiltinToolsetParams): Promise<BuiltinToolset>;
|
|
18
18
|
createTools(): DynamicStructuredTool<ZodSchema>[];
|
|
19
19
|
}
|
|
@@ -97,6 +97,8 @@ export interface XpertBusinessToolContext {
|
|
|
97
97
|
}
|
|
98
98
|
export type XpertDecoratedToolMethod<TInputSchema extends ZodTypeAny = ZodTypeAny, TOutputSchema extends ZodTypeAny = ZodTypeAny> = (input: ZodInfer<TInputSchema>, context: XpertBusinessToolContext) => PromiseOrValue<ZodInfer<TOutputSchema> | XpertToolResult<ZodInfer<TOutputSchema>> | XpertPreparedToolResult>;
|
|
99
99
|
export interface XpertToolProviderInstance {
|
|
100
|
+
/** Validate connection values before saving. Reject invalid input without exposing credentials in errors. */
|
|
101
|
+
validateConfig?(config: unknown): PromiseOrValue<void>;
|
|
100
102
|
/** Compatibility hook for legacy providers; prefer resource and prompt method decorators. */
|
|
101
103
|
getMcpExtensions?(): Pick<McpCapabilityDefinitions, 'resources' | 'resourceTemplates' | 'prompts'>;
|
|
102
104
|
getMiddlewareExtensions?(provider: string, options: unknown, context: IAgentMiddlewareContext): PromiseOrValue<Omit<AgentMiddleware, 'name' | 'tools'>>;
|