@xpert-ai/plugin-sdk 3.17.2 → 3.17.4
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/CHANGELOG.md +16 -0
- package/index.cjs.js +1 -0
- package/index.esm.js +1 -1
- package/model-provider.cjs.js +6 -1
- package/model-provider.esm.js +6 -2
- package/package.json +2 -2
- package/src/lib/agent/middleware/capabilities/assistant-task.d.ts +13 -0
- package/src/lib/integration/strategy.interface.d.ts +21 -1
- package/src/lib/runtime/capabilities/index.d.ts +1 -0
- package/src/lib/runtime/capabilities/project-provisioning.d.ts +30 -0
- package/src/lib/runtime/capabilities/workspace-files.d.ts +47 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @xpert-ai/plugin-sdk
|
|
2
2
|
|
|
3
|
+
## 3.17.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7b6954a: project
|
|
8
|
+
- Updated dependencies [7b6954a]
|
|
9
|
+
- @xpert-ai/contracts@3.17.4
|
|
10
|
+
|
|
11
|
+
## 3.17.3
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 754866e: Add reusable enterprise H5 identity and single-assistant session contracts.
|
|
16
|
+
- Updated dependencies [754866e]
|
|
17
|
+
- @xpert-ai/contracts@3.17.3
|
|
18
|
+
|
|
3
19
|
## 3.17.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/index.cjs.js
CHANGED
|
@@ -5772,6 +5772,7 @@ exports.KnowledgebaseDocumentsRuntimeCapability = modelProvider.KnowledgebaseDoc
|
|
|
5772
5772
|
exports.KnowledgebaseProvisioningRuntimeCapability = modelProvider.KnowledgebaseProvisioningRuntimeCapability;
|
|
5773
5773
|
exports.KnowledgebaseRuntimeCapability = modelProvider.KnowledgebaseRuntimeCapability;
|
|
5774
5774
|
exports.ModelProviderBuiltinToolset = modelProvider.ModelProviderBuiltinToolset;
|
|
5775
|
+
exports.ProjectProvisioningRuntimeCapability = modelProvider.ProjectProvisioningRuntimeCapability;
|
|
5775
5776
|
exports.SANDBOX_JOB_ERROR_CODES = modelProvider.SANDBOX_JOB_ERROR_CODES;
|
|
5776
5777
|
exports.SANDBOX_JOB_PROGRESS_PREFIX = modelProvider.SANDBOX_JOB_PROGRESS_PREFIX;
|
|
5777
5778
|
exports.SandboxJobRuntimeError = modelProvider.SandboxJobRuntimeError;
|
package/index.esm.js
CHANGED
|
@@ -16,7 +16,7 @@ import fs__default from 'fs';
|
|
|
16
16
|
import http from 'http';
|
|
17
17
|
import https from 'https';
|
|
18
18
|
import { c as createRuntimeCapability } from './model-provider.esm.js';
|
|
19
|
-
export { A as ActorTokenRuntimeCapability, a as ArtifactsRuntimeCapability, B as BaseTool, b as BaseToolset, d as BuiltinToolset, D as DefaultAgentMiddlewareRuntimeCapabilityRegistry, D as DefaultRuntimeCapabilityRegistry, K as KnowledgeDocumentVisualAssetsRuntimeCapability, e as KnowledgebaseDocumentsRuntimeCapability, f as KnowledgebaseProvisioningRuntimeCapability, g as KnowledgebaseRuntimeCapability, M as ModelProviderBuiltinToolset, S as SANDBOX_JOB_ERROR_CODES, h as SANDBOX_JOB_PROGRESS_PREFIX, i as SandboxJobRuntimeError, j as SandboxJobsRuntimeCapability, W as WORKSPACE_FILES_SOURCE, k as WorkspaceFilesRuntimeCapability, X as XPERT_RUNTIME_CAPABILITIES_TOKEN, l as isSandboxJobRuntimeError } from './model-provider.esm.js';
|
|
19
|
+
export { A as ActorTokenRuntimeCapability, a as ArtifactsRuntimeCapability, B as BaseTool, b as BaseToolset, d as BuiltinToolset, D as DefaultAgentMiddlewareRuntimeCapabilityRegistry, D as DefaultRuntimeCapabilityRegistry, K as KnowledgeDocumentVisualAssetsRuntimeCapability, e as KnowledgebaseDocumentsRuntimeCapability, f as KnowledgebaseProvisioningRuntimeCapability, g as KnowledgebaseRuntimeCapability, M as ModelProviderBuiltinToolset, P as ProjectProvisioningRuntimeCapability, S as SANDBOX_JOB_ERROR_CODES, h as SANDBOX_JOB_PROGRESS_PREFIX, i as SandboxJobRuntimeError, j as SandboxJobsRuntimeCapability, W as WORKSPACE_FILES_SOURCE, k as WorkspaceFilesRuntimeCapability, X as XPERT_RUNTIME_CAPABILITIES_TOKEN, l as isSandboxJobRuntimeError } from './model-provider.esm.js';
|
|
20
20
|
import fsPromises from 'fs/promises';
|
|
21
21
|
import * as path from 'path';
|
|
22
22
|
import path__default, { join } from 'path';
|
package/model-provider.cjs.js
CHANGED
|
@@ -194,7 +194,7 @@ const ArtifactsRuntimeCapability = createRuntimeCapability('platform.artifacts',
|
|
|
194
194
|
|
|
195
195
|
/** Stable source identifier for portable workspace file references. */ const WORKSPACE_FILES_SOURCE = 'platform.workspace.files';
|
|
196
196
|
const WorkspaceFilesRuntimeCapability = createRuntimeCapability('platform.workspace.files', {
|
|
197
|
-
description: 'Upload, understand, resolve, read, and delete
|
|
197
|
+
description: 'Upload, understand, search parsed chunks, resolve, read, and delete files in Xpert workspace volumes.'
|
|
198
198
|
});
|
|
199
199
|
|
|
200
200
|
/** Stable machine-readable failures emitted by the Sandbox Jobs capability. */ const SANDBOX_JOB_ERROR_CODES = [
|
|
@@ -236,6 +236,10 @@ const SANDBOX_JOB_ERROR_CODE_SET = new Set(SANDBOX_JOB_ERROR_CODES);
|
|
|
236
236
|
description: 'Run registered plugin actions in isolated, short-lived Sandbox Runtime jobs.'
|
|
237
237
|
});
|
|
238
238
|
|
|
239
|
+
const ProjectProvisioningRuntimeCapability = createRuntimeCapability('platform.project.provisioning', {
|
|
240
|
+
description: 'Idempotently provision a platform Chat Project and connect it to an Assistant.'
|
|
241
|
+
});
|
|
242
|
+
|
|
239
243
|
/**
|
|
240
244
|
* Shared host-runtime plumbing for built-in tools backed by a configured model provider.
|
|
241
245
|
* Provider request/response semantics remain owned by each plugin.
|
|
@@ -342,6 +346,7 @@ exports.KnowledgebaseDocumentsRuntimeCapability = KnowledgebaseDocumentsRuntimeC
|
|
|
342
346
|
exports.KnowledgebaseProvisioningRuntimeCapability = KnowledgebaseProvisioningRuntimeCapability;
|
|
343
347
|
exports.KnowledgebaseRuntimeCapability = KnowledgebaseRuntimeCapability;
|
|
344
348
|
exports.ModelProviderBuiltinToolset = ModelProviderBuiltinToolset;
|
|
349
|
+
exports.ProjectProvisioningRuntimeCapability = ProjectProvisioningRuntimeCapability;
|
|
345
350
|
exports.SANDBOX_JOB_ERROR_CODES = SANDBOX_JOB_ERROR_CODES;
|
|
346
351
|
exports.SANDBOX_JOB_PROGRESS_PREFIX = SANDBOX_JOB_PROGRESS_PREFIX;
|
|
347
352
|
exports.SandboxJobRuntimeError = SandboxJobRuntimeError;
|
package/model-provider.esm.js
CHANGED
|
@@ -192,7 +192,7 @@ const ArtifactsRuntimeCapability = createRuntimeCapability('platform.artifacts',
|
|
|
192
192
|
|
|
193
193
|
/** Stable source identifier for portable workspace file references. */ const WORKSPACE_FILES_SOURCE = 'platform.workspace.files';
|
|
194
194
|
const WorkspaceFilesRuntimeCapability = createRuntimeCapability('platform.workspace.files', {
|
|
195
|
-
description: 'Upload, understand, resolve, read, and delete
|
|
195
|
+
description: 'Upload, understand, search parsed chunks, resolve, read, and delete files in Xpert workspace volumes.'
|
|
196
196
|
});
|
|
197
197
|
|
|
198
198
|
/** Stable machine-readable failures emitted by the Sandbox Jobs capability. */ const SANDBOX_JOB_ERROR_CODES = [
|
|
@@ -234,6 +234,10 @@ const SANDBOX_JOB_ERROR_CODE_SET = new Set(SANDBOX_JOB_ERROR_CODES);
|
|
|
234
234
|
description: 'Run registered plugin actions in isolated, short-lived Sandbox Runtime jobs.'
|
|
235
235
|
});
|
|
236
236
|
|
|
237
|
+
const ProjectProvisioningRuntimeCapability = createRuntimeCapability('platform.project.provisioning', {
|
|
238
|
+
description: 'Idempotently provision a platform Chat Project and connect it to an Assistant.'
|
|
239
|
+
});
|
|
240
|
+
|
|
237
241
|
/**
|
|
238
242
|
* Shared host-runtime plumbing for built-in tools backed by a configured model provider.
|
|
239
243
|
* Provider request/response semantics remain owned by each plugin.
|
|
@@ -329,4 +333,4 @@ function normalizeOptionalString(value) {
|
|
|
329
333
|
return normalized || undefined;
|
|
330
334
|
}
|
|
331
335
|
|
|
332
|
-
export { ActorTokenRuntimeCapability as A, BaseTool as B, DefaultRuntimeCapabilityRegistry as D, KnowledgeDocumentVisualAssetsRuntimeCapability as K, ModelProviderBuiltinToolset as M, SANDBOX_JOB_ERROR_CODES as S, WORKSPACE_FILES_SOURCE as W, XPERT_RUNTIME_CAPABILITIES_TOKEN as X, ArtifactsRuntimeCapability as a, BaseToolset as b, createRuntimeCapability as c, BuiltinToolset as d, KnowledgebaseDocumentsRuntimeCapability as e, KnowledgebaseProvisioningRuntimeCapability as f, KnowledgebaseRuntimeCapability as g, SANDBOX_JOB_PROGRESS_PREFIX as h, SandboxJobRuntimeError as i, SandboxJobsRuntimeCapability as j, WorkspaceFilesRuntimeCapability as k, isSandboxJobRuntimeError as l };
|
|
336
|
+
export { ActorTokenRuntimeCapability as A, BaseTool as B, DefaultRuntimeCapabilityRegistry as D, KnowledgeDocumentVisualAssetsRuntimeCapability as K, ModelProviderBuiltinToolset as M, ProjectProvisioningRuntimeCapability as P, SANDBOX_JOB_ERROR_CODES as S, WORKSPACE_FILES_SOURCE as W, XPERT_RUNTIME_CAPABILITIES_TOKEN as X, ArtifactsRuntimeCapability as a, BaseToolset as b, createRuntimeCapability as c, BuiltinToolset as d, KnowledgebaseDocumentsRuntimeCapability as e, KnowledgebaseProvisioningRuntimeCapability as f, KnowledgebaseRuntimeCapability as g, SANDBOX_JOB_PROGRESS_PREFIX as h, SandboxJobRuntimeError as i, SandboxJobsRuntimeCapability as j, WorkspaceFilesRuntimeCapability as k, isSandboxJobRuntimeError as l };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xpert-ai/plugin-sdk",
|
|
3
|
-
"version": "3.17.
|
|
3
|
+
"version": "3.17.4",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@langchain/openai": "0.6.9",
|
|
20
|
-
"@xpert-ai/contracts": "3.17.
|
|
20
|
+
"@xpert-ai/contracts": "3.17.4",
|
|
21
21
|
"express": "^4.22.1",
|
|
22
22
|
"js-tiktoken": "^1.0.21"
|
|
23
23
|
},
|
|
@@ -12,6 +12,17 @@ export type AgentMiddlewareAssistantTaskFile = {
|
|
|
12
12
|
size?: number;
|
|
13
13
|
role?: string;
|
|
14
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Stable plugin skill reference used by Assistant Tasks.
|
|
17
|
+
*
|
|
18
|
+
* Plugin-owned callers must not persist workspace-local SkillPackage UUIDs.
|
|
19
|
+
* The host resolves this portable identity to the installed package and verifies
|
|
20
|
+
* that the target Agent is directly connected to the owning Skills Middleware.
|
|
21
|
+
*/
|
|
22
|
+
export type AgentMiddlewareAssistantTaskSkillRef = {
|
|
23
|
+
pluginName: string;
|
|
24
|
+
componentKey: string;
|
|
25
|
+
};
|
|
15
26
|
export type AgentMiddlewareAssistantTaskInput = {
|
|
16
27
|
xpertId: string;
|
|
17
28
|
agentKey?: string;
|
|
@@ -22,6 +33,8 @@ export type AgentMiddlewareAssistantTaskInput = {
|
|
|
22
33
|
clientMessageId?: string;
|
|
23
34
|
prompt: string;
|
|
24
35
|
files?: AgentMiddlewareAssistantTaskFile[];
|
|
36
|
+
/** Skills that this task is expected to load through its target Agent's Skills Middleware. */
|
|
37
|
+
selectedSkillRefs?: AgentMiddlewareAssistantTaskSkillRef[];
|
|
25
38
|
/** Additional bounded human-input fields exposed to runtime-state fixed filters. */
|
|
26
39
|
humanInput?: Record<string, JSONValue>;
|
|
27
40
|
context?: Record<string, unknown>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IIntegration, TIntegrationProvider } from '@xpert-ai/contracts';
|
|
1
|
+
import { IIntegration, TEnterpriseH5IdentityGrant, TIntegrationProvider } from '@xpert-ai/contracts';
|
|
2
2
|
export type TIntegrationStrategyParams = {
|
|
3
3
|
query: string;
|
|
4
4
|
};
|
|
@@ -14,10 +14,30 @@ export type IntegrationTestResult = {
|
|
|
14
14
|
warnings?: string[];
|
|
15
15
|
probe?: IntegrationTestProbe;
|
|
16
16
|
} & Record<string, unknown>;
|
|
17
|
+
/** Identity proof accepted by an integration strategy for enterprise H5 exchange. */
|
|
18
|
+
export type IntegrationIdentityGrant = TEnterpriseH5IdentityGrant;
|
|
19
|
+
/** Public integration data required before the browser requests an identity grant. */
|
|
20
|
+
export type IntegrationIdentityBootstrap = {
|
|
21
|
+
externalOrganizationId: string;
|
|
22
|
+
clientConfig: Record<string, unknown>;
|
|
23
|
+
};
|
|
24
|
+
/** Enterprise identity verified by an integration, with optional Xpert account binding. */
|
|
25
|
+
export type IntegrationExternalIdentity = {
|
|
26
|
+
provider: string;
|
|
27
|
+
externalOrganizationId: string;
|
|
28
|
+
subjectId: string;
|
|
29
|
+
displayName?: string;
|
|
30
|
+
accountBinding?: {
|
|
31
|
+
provider: string;
|
|
32
|
+
subjectId: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
17
35
|
export interface IntegrationStrategy<T = unknown> {
|
|
18
36
|
meta: TIntegrationProvider;
|
|
19
37
|
execute(integration: IIntegration<T>, payload: TIntegrationStrategyParams): Promise<any>;
|
|
20
38
|
onUpdate?(previous: IIntegration<T>, current: IIntegration<any>): Promise<void> | void;
|
|
21
39
|
onDelete?(integration: IIntegration<T>): Promise<void> | void;
|
|
22
40
|
validateConfig?(config: T, integration?: IIntegration<T>): Promise<void | IntegrationTestResult>;
|
|
41
|
+
getIdentityBootstrap?(integration: IIntegration<T>): Promise<IntegrationIdentityBootstrap>;
|
|
42
|
+
exchangeIdentity?(integration: IIntegration<T>, grant: IntegrationIdentityGrant): Promise<IntegrationExternalIdentity>;
|
|
23
43
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Lifecycle states that plugin-managed Projects may synchronize to the platform. */
|
|
2
|
+
export type ProjectProvisioningStatus = 'active' | 'archived';
|
|
3
|
+
/** Stable identity and desired state for an idempotently provisioned Chat Project. */
|
|
4
|
+
export type ProjectEnsureInput = {
|
|
5
|
+
/** Caller-generated id reused across retries to prevent duplicate Projects. */
|
|
6
|
+
projectId: string;
|
|
7
|
+
/** Workspace that owns both the Project and connected Assistant. */
|
|
8
|
+
workspaceId: string;
|
|
9
|
+
/** Assistant that must be connected to the Project. */
|
|
10
|
+
xpertId: string;
|
|
11
|
+
/** Current business-project display name. */
|
|
12
|
+
name: string;
|
|
13
|
+
/** Current business-project lifecycle state. */
|
|
14
|
+
status: ProjectProvisioningStatus;
|
|
15
|
+
};
|
|
16
|
+
/** Effective Project state after an idempotent ensure operation. */
|
|
17
|
+
export type ProjectEnsureResult = {
|
|
18
|
+
projectId: string;
|
|
19
|
+
workspaceId: string;
|
|
20
|
+
/** Complete set of Assistants connected after synchronization. */
|
|
21
|
+
xpertIds: string[];
|
|
22
|
+
/** Whether this call inserted the Project or reconciled an existing one. */
|
|
23
|
+
operation: 'created' | 'updated';
|
|
24
|
+
};
|
|
25
|
+
/** Host API exposed to plugins that own one-to-one business Project mappings. */
|
|
26
|
+
export interface ProjectProvisioningApi {
|
|
27
|
+
/** Create or reconcile a Chat Project without changing its caller-supplied id. */
|
|
28
|
+
ensure(input: ProjectEnsureInput): Promise<ProjectEnsureResult>;
|
|
29
|
+
}
|
|
30
|
+
export declare const ProjectProvisioningRuntimeCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<ProjectProvisioningApi>;
|
|
@@ -184,6 +184,49 @@ export type WorkspaceValidatedUnderstandingReference = {
|
|
|
184
184
|
anchor?: Record<string, unknown>;
|
|
185
185
|
excerpt: string;
|
|
186
186
|
};
|
|
187
|
+
/** Scoped, bounded FileChunk DTO for plugin-owned evidence mapping. */
|
|
188
|
+
export type WorkspaceUnderstandingChunk = {
|
|
189
|
+
/** FileAsset that owns the parsed chunk. */
|
|
190
|
+
fileAssetId: string;
|
|
191
|
+
/** Stable FileChunk identifier suitable for evidence references. */
|
|
192
|
+
chunkId: string;
|
|
193
|
+
/** Parser order within the source document. */
|
|
194
|
+
orderNo: number;
|
|
195
|
+
/** Parser-specific page, sheet, slide, or block location. */
|
|
196
|
+
anchor?: Record<string, unknown>;
|
|
197
|
+
/** Bounded source text; callers must not assume it contains the whole file. */
|
|
198
|
+
content: string;
|
|
199
|
+
};
|
|
200
|
+
/** Input for paging an already parsed FileAsset without creating a second index. */
|
|
201
|
+
export type WorkspaceListUnderstandingChunksInput = WorkspaceFileScope & {
|
|
202
|
+
fileAssetId: string;
|
|
203
|
+
/** One-based page number. */
|
|
204
|
+
page?: number;
|
|
205
|
+
/** Page size clamped by the host. */
|
|
206
|
+
pageSize?: number;
|
|
207
|
+
/** Maximum characters returned for each chunk. */
|
|
208
|
+
contentLength?: number;
|
|
209
|
+
};
|
|
210
|
+
/** One bounded page from the FileAsset's existing FileChunk index. */
|
|
211
|
+
export type WorkspaceUnderstandingChunkPage = {
|
|
212
|
+
fileAssetId: string;
|
|
213
|
+
/** Chunks in parser order for the requested page. */
|
|
214
|
+
items: WorkspaceUnderstandingChunk[];
|
|
215
|
+
page: number;
|
|
216
|
+
pageSize: number;
|
|
217
|
+
/** True when another bounded page can be requested. */
|
|
218
|
+
hasMore: boolean;
|
|
219
|
+
};
|
|
220
|
+
/** Input for hybrid search over a FileAsset's existing FileChunk index. */
|
|
221
|
+
export type WorkspaceSearchUnderstandingChunksInput = WorkspaceFileScope & {
|
|
222
|
+
fileAssetId: string;
|
|
223
|
+
/** Natural-language or keyword query evaluated by the platform hybrid index. */
|
|
224
|
+
query: string;
|
|
225
|
+
/** Result count clamped by the host. */
|
|
226
|
+
limit?: number;
|
|
227
|
+
/** Maximum characters returned for each matching chunk. */
|
|
228
|
+
contentLength?: number;
|
|
229
|
+
};
|
|
187
230
|
/**
|
|
188
231
|
* Runtime capability contract for reading, writing, uploading, deleting, and
|
|
189
232
|
* understanding files in Xpert workspace Volumes.
|
|
@@ -199,6 +242,10 @@ export interface WorkspaceFilesApi {
|
|
|
199
242
|
retryUnderstanding(input: WorkspaceRetryUnderstandingInput): Promise<WorkspaceUnderstandingStatus>;
|
|
200
243
|
/** Validate bounded FileAsset/chunk evidence without returning complete file contents. */
|
|
201
244
|
validateUnderstandingReferences(input: WorkspaceValidateUnderstandingReferencesInput): Promise<WorkspaceValidatedUnderstandingReference[]>;
|
|
245
|
+
/** List one bounded page of parsed chunks after enforcing FileAsset workspace scope. */
|
|
246
|
+
listUnderstandingChunks(input: WorkspaceListUnderstandingChunksInput): Promise<WorkspaceUnderstandingChunkPage>;
|
|
247
|
+
/** Search the existing FileChunk hybrid index without creating another embedding index. */
|
|
248
|
+
searchUnderstandingChunks(input: WorkspaceSearchUnderstandingChunksInput): Promise<WorkspaceUnderstandingChunk[]>;
|
|
202
249
|
/**
|
|
203
250
|
* Resolve metadata and an openable URL for an explicitly scoped workspace
|
|
204
251
|
* file without reading its bytes into the API process.
|