@xpert-ai/plugin-sdk 3.18.2 → 3.18.3
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 +8 -0
- package/index.cjs.js +5 -1
- package/index.esm.js +5 -2
- package/model-provider.cjs.js +12 -3
- package/model-provider.esm.js +12 -4
- package/package.json +2 -2
- package/src/lib/agent/middleware/strategy.interface.d.ts +2 -0
- package/src/lib/core/runtime-capability.d.ts +2 -1
- package/src/lib/data/datasource/types.d.ts +7 -2
- package/src/lib/runtime/capabilities/index.d.ts +1 -0
- package/src/lib/runtime/capabilities/knowledgebase.d.ts +1 -1
- package/src/lib/runtime/capabilities/project-access.d.ts +30 -0
- package/src/lib/runtime/capabilities/project-provisioning.d.ts +8 -0
- package/src/lib/tool-provider/adapters.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @xpert-ai/plugin-sdk
|
|
2
2
|
|
|
3
|
+
## 3.18.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d107704: Add Assistant Profile display contracts and capability/activity indicators, trusted Assistant version identities, and the feature-gated Profile tab slot. Expose static Middleware Tool names and human Project access to plugin server services, and provide the shared Zard Hover Card interaction primitive.
|
|
8
|
+
- Updated dependencies [d107704]
|
|
9
|
+
- @xpert-ai/contracts@3.18.2
|
|
10
|
+
|
|
3
11
|
## 3.18.2
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/index.cjs.js
CHANGED
|
@@ -1597,7 +1597,7 @@ class BaseSQLQueryRunner extends BaseQueryRunner {
|
|
|
1597
1597
|
return;
|
|
1598
1598
|
}
|
|
1599
1599
|
// --- MODE: UPGRADE → auto upgrade (simple implementation: only add new columns) ---
|
|
1600
|
-
// Note: This default implementation does not support modifying column types,
|
|
1600
|
+
// Note: This default implementation does not support modifying column types,
|
|
1601
1601
|
// recommend each database to implement its own version
|
|
1602
1602
|
if (exists && createMode === exports.DBCreateTableMode.UPGRADE) {
|
|
1603
1603
|
console.warn(`[BaseSQLQueryRunner] UPGRADE mode uses basic implementation. Consider implementing tableOp for better support.`);
|
|
@@ -6201,6 +6201,9 @@ class DecoratedToolsetStrategy {
|
|
|
6201
6201
|
}
|
|
6202
6202
|
}
|
|
6203
6203
|
class DecoratedAgentMiddlewareStrategy {
|
|
6204
|
+
getToolNames() {
|
|
6205
|
+
return this.descriptor.tools.filter((item)=>item.middlewareProvider === this.provider).map((item)=>item.options.name);
|
|
6206
|
+
}
|
|
6204
6207
|
async createMiddleware(options, context) {
|
|
6205
6208
|
const tools = this.descriptor.tools.filter((item)=>item.middlewareProvider === this.provider).map((item)=>createAgentTool(this.instance, item, context, options));
|
|
6206
6209
|
const extensions = await (this.instance.getMiddlewareExtensions == null ? void 0 : this.instance.getMiddlewareExtensions.call(this.instance, this.provider, options, context));
|
|
@@ -6490,6 +6493,7 @@ exports.KnowledgebaseDocumentsRuntimeCapability = modelProvider.KnowledgebaseDoc
|
|
|
6490
6493
|
exports.KnowledgebaseProvisioningRuntimeCapability = modelProvider.KnowledgebaseProvisioningRuntimeCapability;
|
|
6491
6494
|
exports.KnowledgebaseRuntimeCapability = modelProvider.KnowledgebaseRuntimeCapability;
|
|
6492
6495
|
exports.ModelProviderBuiltinToolset = modelProvider.ModelProviderBuiltinToolset;
|
|
6496
|
+
exports.ProjectAccessRuntimeCapability = modelProvider.ProjectAccessRuntimeCapability;
|
|
6493
6497
|
exports.ProjectProvisioningRuntimeCapability = modelProvider.ProjectProvisioningRuntimeCapability;
|
|
6494
6498
|
exports.SANDBOX_JOB_ERROR_CODES = modelProvider.SANDBOX_JOB_ERROR_CODES;
|
|
6495
6499
|
exports.SANDBOX_JOB_PROGRESS_PREFIX = modelProvider.SANDBOX_JOB_PROGRESS_PREFIX;
|
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, B as BuiltinToolset } from './model-provider.esm.js';
|
|
19
|
-
export { A as ActorTokenRuntimeCapability, a as ArtifactsRuntimeCapability, b as BaseTool, d as BaseToolset, 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,
|
|
19
|
+
export { A as ActorTokenRuntimeCapability, a as ArtifactsRuntimeCapability, b as BaseTool, d as BaseToolset, D as DefaultAgentMiddlewareRuntimeCapabilityRegistry, D as DefaultRuntimeCapabilityRegistry, K as KnowledgeDocumentVisualAssetsRuntimeCapability, e as KnowledgebaseDocumentsRuntimeCapability, f as KnowledgebaseProvisioningRuntimeCapability, g as KnowledgebaseRuntimeCapability, M as ModelProviderBuiltinToolset, P as ProjectAccessRuntimeCapability, h as ProjectProvisioningRuntimeCapability, S as SANDBOX_JOB_ERROR_CODES, i as SANDBOX_JOB_PROGRESS_PREFIX, j as SandboxJobRuntimeError, k as SandboxJobsRuntimeCapability, W as WORKSPACE_FILES_SOURCE, l as WorkspaceFilesRuntimeCapability, X as XPERT_RUNTIME_CAPABILITIES_TOKEN, m 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';
|
|
@@ -1579,7 +1579,7 @@ class BaseSQLQueryRunner extends BaseQueryRunner {
|
|
|
1579
1579
|
return;
|
|
1580
1580
|
}
|
|
1581
1581
|
// --- MODE: UPGRADE → auto upgrade (simple implementation: only add new columns) ---
|
|
1582
|
-
// Note: This default implementation does not support modifying column types,
|
|
1582
|
+
// Note: This default implementation does not support modifying column types,
|
|
1583
1583
|
// recommend each database to implement its own version
|
|
1584
1584
|
if (exists && createMode === DBCreateTableMode.UPGRADE) {
|
|
1585
1585
|
console.warn(`[BaseSQLQueryRunner] UPGRADE mode uses basic implementation. Consider implementing tableOp for better support.`);
|
|
@@ -6183,6 +6183,9 @@ class DecoratedToolsetStrategy {
|
|
|
6183
6183
|
}
|
|
6184
6184
|
}
|
|
6185
6185
|
class DecoratedAgentMiddlewareStrategy {
|
|
6186
|
+
getToolNames() {
|
|
6187
|
+
return this.descriptor.tools.filter((item)=>item.middlewareProvider === this.provider).map((item)=>item.options.name);
|
|
6188
|
+
}
|
|
6186
6189
|
async createMiddleware(options, context) {
|
|
6187
6190
|
const tools = this.descriptor.tools.filter((item)=>item.middlewareProvider === this.provider).map((item)=>createAgentTool(this.instance, item, context, options));
|
|
6188
6191
|
const extensions = await (this.instance.getMiddlewareExtensions == null ? void 0 : this.instance.getMiddlewareExtensions.call(this.instance, this.provider, options, context));
|
package/model-provider.cjs.js
CHANGED
|
@@ -160,10 +160,13 @@ class DefaultRuntimeCapabilityRegistry {
|
|
|
160
160
|
return this;
|
|
161
161
|
}
|
|
162
162
|
has(key) {
|
|
163
|
-
|
|
163
|
+
var _this_parent;
|
|
164
|
+
return this.capabilities.has(runtimeCapabilityId(key)) || ((_this_parent = this.parent) == null ? void 0 : _this_parent.get(key)) !== undefined;
|
|
164
165
|
}
|
|
165
166
|
get(key) {
|
|
166
|
-
|
|
167
|
+
var _this_parent;
|
|
168
|
+
const id = runtimeCapabilityId(key);
|
|
169
|
+
return this.capabilities.has(id) ? this.capabilities.get(id) : (_this_parent = this.parent) == null ? void 0 : _this_parent.get(key);
|
|
167
170
|
}
|
|
168
171
|
require(key) {
|
|
169
172
|
const implementation = this.get(key);
|
|
@@ -172,8 +175,9 @@ class DefaultRuntimeCapabilityRegistry {
|
|
|
172
175
|
}
|
|
173
176
|
return implementation;
|
|
174
177
|
}
|
|
175
|
-
constructor(entries = []){
|
|
178
|
+
constructor(entries = [], parent){
|
|
176
179
|
this.capabilities = new Map();
|
|
180
|
+
this.parent = parent;
|
|
177
181
|
entries.forEach(([key, implementation])=>this.register(key, implementation));
|
|
178
182
|
}
|
|
179
183
|
}
|
|
@@ -252,6 +256,10 @@ const ProjectProvisioningRuntimeCapability = createRuntimeCapability('platform.p
|
|
|
252
256
|
description: 'Idempotently provision a platform Chat Project and connect it to an Assistant.'
|
|
253
257
|
});
|
|
254
258
|
|
|
259
|
+
const ProjectAccessRuntimeCapability = createRuntimeCapability('platform.project.access', {
|
|
260
|
+
description: 'Resolve human Project membership for platform and plugin operations.'
|
|
261
|
+
});
|
|
262
|
+
|
|
255
263
|
/**
|
|
256
264
|
* Shared host-runtime plumbing for built-in tools backed by a configured model provider.
|
|
257
265
|
* Provider request/response semantics remain owned by each plugin.
|
|
@@ -377,6 +385,7 @@ exports.KnowledgebaseDocumentsRuntimeCapability = KnowledgebaseDocumentsRuntimeC
|
|
|
377
385
|
exports.KnowledgebaseProvisioningRuntimeCapability = KnowledgebaseProvisioningRuntimeCapability;
|
|
378
386
|
exports.KnowledgebaseRuntimeCapability = KnowledgebaseRuntimeCapability;
|
|
379
387
|
exports.ModelProviderBuiltinToolset = ModelProviderBuiltinToolset;
|
|
388
|
+
exports.ProjectAccessRuntimeCapability = ProjectAccessRuntimeCapability;
|
|
380
389
|
exports.ProjectProvisioningRuntimeCapability = ProjectProvisioningRuntimeCapability;
|
|
381
390
|
exports.SANDBOX_JOB_ERROR_CODES = SANDBOX_JOB_ERROR_CODES;
|
|
382
391
|
exports.SANDBOX_JOB_PROGRESS_PREFIX = SANDBOX_JOB_PROGRESS_PREFIX;
|
package/model-provider.esm.js
CHANGED
|
@@ -158,10 +158,13 @@ class DefaultRuntimeCapabilityRegistry {
|
|
|
158
158
|
return this;
|
|
159
159
|
}
|
|
160
160
|
has(key) {
|
|
161
|
-
|
|
161
|
+
var _this_parent;
|
|
162
|
+
return this.capabilities.has(runtimeCapabilityId(key)) || ((_this_parent = this.parent) == null ? void 0 : _this_parent.get(key)) !== undefined;
|
|
162
163
|
}
|
|
163
164
|
get(key) {
|
|
164
|
-
|
|
165
|
+
var _this_parent;
|
|
166
|
+
const id = runtimeCapabilityId(key);
|
|
167
|
+
return this.capabilities.has(id) ? this.capabilities.get(id) : (_this_parent = this.parent) == null ? void 0 : _this_parent.get(key);
|
|
165
168
|
}
|
|
166
169
|
require(key) {
|
|
167
170
|
const implementation = this.get(key);
|
|
@@ -170,8 +173,9 @@ class DefaultRuntimeCapabilityRegistry {
|
|
|
170
173
|
}
|
|
171
174
|
return implementation;
|
|
172
175
|
}
|
|
173
|
-
constructor(entries = []){
|
|
176
|
+
constructor(entries = [], parent){
|
|
174
177
|
this.capabilities = new Map();
|
|
178
|
+
this.parent = parent;
|
|
175
179
|
entries.forEach(([key, implementation])=>this.register(key, implementation));
|
|
176
180
|
}
|
|
177
181
|
}
|
|
@@ -250,6 +254,10 @@ const ProjectProvisioningRuntimeCapability = createRuntimeCapability('platform.p
|
|
|
250
254
|
description: 'Idempotently provision a platform Chat Project and connect it to an Assistant.'
|
|
251
255
|
});
|
|
252
256
|
|
|
257
|
+
const ProjectAccessRuntimeCapability = createRuntimeCapability('platform.project.access', {
|
|
258
|
+
description: 'Resolve human Project membership for platform and plugin operations.'
|
|
259
|
+
});
|
|
260
|
+
|
|
253
261
|
/**
|
|
254
262
|
* Shared host-runtime plumbing for built-in tools backed by a configured model provider.
|
|
255
263
|
* Provider request/response semantics remain owned by each plugin.
|
|
@@ -364,4 +372,4 @@ function normalizeWorkspaceScope(scope) {
|
|
|
364
372
|
} : {});
|
|
365
373
|
}
|
|
366
374
|
|
|
367
|
-
export { ActorTokenRuntimeCapability as A, BuiltinToolset as B, DefaultRuntimeCapabilityRegistry as D, KnowledgeDocumentVisualAssetsRuntimeCapability as K, ModelProviderBuiltinToolset as M,
|
|
375
|
+
export { ActorTokenRuntimeCapability as A, BuiltinToolset as B, DefaultRuntimeCapabilityRegistry as D, KnowledgeDocumentVisualAssetsRuntimeCapability as K, ModelProviderBuiltinToolset as M, ProjectAccessRuntimeCapability as P, SANDBOX_JOB_ERROR_CODES as S, WORKSPACE_FILES_SOURCE as W, XPERT_RUNTIME_CAPABILITIES_TOKEN as X, ArtifactsRuntimeCapability as a, BaseTool as b, createRuntimeCapability as c, BaseToolset as d, KnowledgebaseDocumentsRuntimeCapability as e, KnowledgebaseProvisioningRuntimeCapability as f, KnowledgebaseRuntimeCapability as g, ProjectProvisioningRuntimeCapability as h, SANDBOX_JOB_PROGRESS_PREFIX as i, SandboxJobRuntimeError as j, SandboxJobsRuntimeCapability as k, WorkspaceFilesRuntimeCapability as l, isSandboxJobRuntimeError as m };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xpert-ai/plugin-sdk",
|
|
3
|
-
"version": "3.18.
|
|
3
|
+
"version": "3.18.3",
|
|
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.18.
|
|
20
|
+
"@xpert-ai/contracts": "3.18.2",
|
|
21
21
|
"express": "^4.22.1",
|
|
22
22
|
"js-tiktoken": "^1.0.21"
|
|
23
23
|
},
|
|
@@ -25,5 +25,7 @@ export interface IAgentMiddlewareContext {
|
|
|
25
25
|
}
|
|
26
26
|
export interface IAgentMiddlewareStrategy<T = unknown> {
|
|
27
27
|
meta: TAgentMiddlewareMeta;
|
|
28
|
+
/** Static Tool names exposed by this Middleware, for capability summaries without creating a runtime instance. */
|
|
29
|
+
getToolNames?(options: T): readonly string[];
|
|
28
30
|
createMiddleware(options: T, context: IAgentMiddlewareContext): PromiseOrValue<AgentMiddleware>;
|
|
29
31
|
}
|
|
@@ -16,8 +16,9 @@ export interface RuntimeCapabilityRegistry {
|
|
|
16
16
|
export type RuntimeCapabilityResolver = Pick<RuntimeCapabilityRegistry, 'get'>;
|
|
17
17
|
export declare const XPERT_RUNTIME_CAPABILITIES_TOKEN = "XPERT_RUNTIME_CAPABILITIES";
|
|
18
18
|
export declare class DefaultRuntimeCapabilityRegistry implements RuntimeCapabilityRegistry {
|
|
19
|
+
private readonly parent?;
|
|
19
20
|
private readonly capabilities;
|
|
20
|
-
constructor(entries?: Array<[RuntimeCapabilityKey<unknown> | string, unknown]
|
|
21
|
+
constructor(entries?: Array<[RuntimeCapabilityKey<unknown> | string, unknown]>, parent?: RuntimeCapabilityResolver);
|
|
21
22
|
register<T>(key: RuntimeCapabilityKey<T> | string, implementation: T): this;
|
|
22
23
|
has<T>(key: RuntimeCapabilityKey<T> | string): boolean;
|
|
23
24
|
get<T>(key: RuntimeCapabilityKey<T> | string): T | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _axios from 'axios';
|
|
2
2
|
import { Readable } from 'stream';
|
|
3
|
-
import { IColumnDef, IDSSchema, IDSTable } from '@xpert-ai/contracts';
|
|
4
|
-
export { IColumnDef, IDSSchema, IDSTable } from '@xpert-ai/contracts';
|
|
3
|
+
import { IColumnDef, IDataSourceCapabilityQuery, IDSSchema, IDSTable } from '@xpert-ai/contracts';
|
|
4
|
+
export { IColumnDef, IDataSourceCapabilityQuery, IDSSchema, IDSTable } from '@xpert-ai/contracts';
|
|
5
5
|
/**
|
|
6
6
|
* The base options for DB adapters
|
|
7
7
|
*/
|
|
@@ -82,6 +82,11 @@ export interface DBQueryRunner {
|
|
|
82
82
|
* @param tableName
|
|
83
83
|
*/
|
|
84
84
|
getSchema(catalog?: string, tableName?: string): Promise<IDSSchema[]>;
|
|
85
|
+
/**
|
|
86
|
+
* Runs an adapter-owned, read-only capability without exposing its domain
|
|
87
|
+
* contract through the host platform.
|
|
88
|
+
*/
|
|
89
|
+
queryCapability?(query: IDataSourceCapabilityQuery): Promise<unknown>;
|
|
85
90
|
/**
|
|
86
91
|
* Describe a sql query result schema
|
|
87
92
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSONValue, KnowledgeFilterDiagnostics, KnowledgeFilterNode } from '@xpert-ai/contracts';
|
|
2
|
-
export type KnowledgebaseRetrievalMode = 'vector' | 'graph' | 'hybrid';
|
|
2
|
+
export type KnowledgebaseRetrievalMode = 'vector' | 'keyword' | 'graph' | 'hybrid';
|
|
3
3
|
export type KnowledgebaseMetadata = Record<string, JSONValue>;
|
|
4
4
|
export type KnowledgebaseRetrievalSettings = {
|
|
5
5
|
mode?: KnowledgebaseRetrievalMode;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Trusted server actor. View providers derive this from host context; jobs persist that actor. */
|
|
2
|
+
export interface ProjectAccessActor {
|
|
3
|
+
tenantId: string;
|
|
4
|
+
organizationId?: string | null;
|
|
5
|
+
userId: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ProjectHumanAccess {
|
|
8
|
+
projectId: string;
|
|
9
|
+
role: 'owner' | 'manager' | 'editor' | 'member';
|
|
10
|
+
canManage: boolean;
|
|
11
|
+
archived: boolean;
|
|
12
|
+
/** Explicit Project bindings, for plugins that choose to use assignment as business policy. */
|
|
13
|
+
assistantIds?: string[];
|
|
14
|
+
}
|
|
15
|
+
/** Human membership only. Assistant assignment and business authorization remain plugin-owned. */
|
|
16
|
+
export interface ProjectAccessApi {
|
|
17
|
+
listReadable(input: {
|
|
18
|
+
actor: ProjectAccessActor;
|
|
19
|
+
projectIds?: string[];
|
|
20
|
+
}): Promise<ProjectHumanAccess[]>;
|
|
21
|
+
assertEdit(input: {
|
|
22
|
+
actor: ProjectAccessActor;
|
|
23
|
+
projectId: string;
|
|
24
|
+
}): Promise<ProjectHumanAccess>;
|
|
25
|
+
assertManage(input: {
|
|
26
|
+
actor: ProjectAccessActor;
|
|
27
|
+
projectId: string;
|
|
28
|
+
}): Promise<ProjectHumanAccess>;
|
|
29
|
+
}
|
|
30
|
+
export declare const ProjectAccessRuntimeCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<ProjectAccessApi>;
|
|
@@ -37,5 +37,13 @@ export type ProjectEnsureResult = {
|
|
|
37
37
|
export interface ProjectProvisioningApi {
|
|
38
38
|
/** Create or reconcile a Chat Project without changing its caller-supplied id. */
|
|
39
39
|
ensure(input: ProjectEnsureInput): Promise<ProjectEnsureResult>;
|
|
40
|
+
/** Owner-only physical deletion of an archived plugin-bound Project and its workspace. */
|
|
41
|
+
purge?(input: {
|
|
42
|
+
projectId: string;
|
|
43
|
+
xpertId: string;
|
|
44
|
+
}): Promise<{
|
|
45
|
+
projectId: string;
|
|
46
|
+
deleted: boolean;
|
|
47
|
+
}>;
|
|
40
48
|
}
|
|
41
49
|
export declare const ProjectProvisioningRuntimeCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<ProjectProvisioningApi>;
|
|
@@ -23,5 +23,6 @@ export declare class DecoratedAgentMiddlewareStrategy implements IAgentMiddlewar
|
|
|
23
23
|
readonly provider: string;
|
|
24
24
|
readonly meta: any;
|
|
25
25
|
constructor(instance: XpertToolProviderInstance, descriptor: XpertToolProviderDescriptor, provider: string);
|
|
26
|
+
getToolNames(): readonly string[];
|
|
26
27
|
createMiddleware(options: unknown, context: IAgentMiddlewareContext): Promise<AgentMiddleware>;
|
|
27
28
|
}
|