@xpert-ai/plugin-sdk 3.8.4 → 3.9.0-beta.1

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.
Files changed (74) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/index.cjs.js +486 -325
  3. package/index.esm.js +468 -298
  4. package/package.json +8 -9
  5. package/src/index.d.ts +1 -0
  6. package/src/lib/agent/handoff/agent-chat.contract.d.ts +1 -1
  7. package/src/lib/agent/handoff/handoff-processor.decorator.d.ts +1 -1
  8. package/src/lib/agent/index.d.ts +1 -0
  9. package/src/lib/agent/middleware/runtime.d.ts +1 -1
  10. package/src/lib/agent/middleware/strategy.decorator.d.ts +1 -1
  11. package/src/lib/agent/middleware/strategy.interface.d.ts +2 -1
  12. package/src/lib/agent/skill/skill-source-provider.decorator.d.ts +1 -1
  13. package/src/lib/agent/skill/skill-source-provider.interface.d.ts +1 -1
  14. package/src/lib/ai-model/abstract-provider.d.ts +1 -1
  15. package/src/lib/ai-model/ai-model-provider.interface.d.ts +1 -1
  16. package/src/lib/ai-model/ai-model.d.ts +1 -1
  17. package/src/lib/ai-model/commands/create-model-client.command.d.ts +1 -1
  18. package/src/lib/ai-model/entities/defaults.d.ts +1 -1
  19. package/src/lib/ai-model/llm.d.ts +1 -1
  20. package/src/lib/ai-model/types/model.d.ts +1 -1
  21. package/src/lib/ai-model/types/rerank.d.ts +1 -1
  22. package/src/lib/ai-model/types/text-embedding-model.d.ts +1 -1
  23. package/src/lib/ai-model/types/tts.d.ts +1 -1
  24. package/src/lib/ai-model/utils/limits.d.ts +1 -1
  25. package/src/lib/channel/strategy.interface.d.ts +1 -3
  26. package/src/lib/core/context/request-context.d.ts +9 -4
  27. package/src/lib/core/context/request-context.middleware.d.ts +1 -2
  28. package/src/lib/core/file-system.d.ts +3 -3
  29. package/src/lib/core/permissions/analytics.d.ts +2 -3
  30. package/src/lib/core/permissions/general.d.ts +1 -1
  31. package/src/lib/core/permissions/user.d.ts +1 -1
  32. package/src/lib/data/datasource/strategy.decorator.d.ts +1 -1
  33. package/src/lib/data/datasource/types.d.ts +2 -5
  34. package/src/lib/file/file-storage/provider.decorator.d.ts +1 -1
  35. package/src/lib/file/file-storage/provider.interface.d.ts +1 -3
  36. package/src/lib/file/file-upload/strategy.decorator.d.ts +1 -1
  37. package/src/lib/file/file-upload/strategy.interface.d.ts +1 -3
  38. package/src/lib/integration/strategy.decorator.d.ts +1 -1
  39. package/src/lib/integration/strategy.interface.d.ts +1 -1
  40. package/src/lib/rag/image/strategy.decorator.d.ts +1 -1
  41. package/src/lib/rag/image/strategy.interface.d.ts +1 -1
  42. package/src/lib/rag/knowledge/knowledge-strategy.decorator.d.ts +1 -1
  43. package/src/lib/rag/knowledge/knowledge-strategy.interface.d.ts +1 -1
  44. package/src/lib/rag/retriever/strategy.decorator.d.ts +1 -1
  45. package/src/lib/rag/retriever/strategy.interface.d.ts +1 -1
  46. package/src/lib/rag/source/strategy.decorator.d.ts +1 -1
  47. package/src/lib/rag/source/strategy.interface.d.ts +1 -1
  48. package/src/lib/rag/textsplitter/strategy.decorator.d.ts +1 -1
  49. package/src/lib/rag/textsplitter/strategy.interface.d.ts +1 -1
  50. package/src/lib/rag/transformer/strategy.decorator.d.ts +1 -1
  51. package/src/lib/rag/transformer/strategy.interface.d.ts +1 -1
  52. package/src/lib/rag/types.d.ts +2 -2
  53. package/src/lib/sandbox/protocol.d.ts +4 -8
  54. package/src/lib/sandbox/sandbox.decorator.d.ts +1 -1
  55. package/src/lib/sandbox/sandbox.interface.d.ts +1 -1
  56. package/src/lib/strategy.d.ts +3 -3
  57. package/src/lib/toolset/builtin.d.ts +1 -1
  58. package/src/lib/toolset/strategy.decorator.d.ts +1 -1
  59. package/src/lib/toolset/strategy.interface.d.ts +1 -1
  60. package/src/lib/toolset/toolset.d.ts +1 -1
  61. package/src/lib/types.d.ts +1 -1
  62. package/src/lib/vectorstore/strategy.decorator.d.ts +1 -1
  63. package/src/lib/view-extension/index.d.ts +4 -0
  64. package/src/lib/view-extension/provider.decorator.d.ts +2 -0
  65. package/src/lib/view-extension/provider.interface.d.ts +7 -0
  66. package/src/lib/view-extension/provider.registry.d.ts +10 -0
  67. package/src/lib/view-extension/tokens.d.ts +1 -0
  68. package/src/lib/workflow/commands/wrap-workflow-node-execution.command.d.ts +1 -1
  69. package/src/lib/workflow/node/strategy.decorator.d.ts +1 -1
  70. package/src/lib/workflow/node/strategy.interface.d.ts +1 -1
  71. package/src/lib/workflow/trigger/strategy.decorator.d.ts +1 -1
  72. package/src/lib/workflow/trigger/strategy.interface.d.ts +1 -1
  73. package/index.esm.d.ts +0 -1
  74. /package/{index.cjs.d.ts → index.d.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpert-ai/plugin-sdk",
3
- "version": "3.8.4",
3
+ "version": "3.9.0-beta.1",
4
4
  "license": "AGPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,15 +12,16 @@
12
12
  "main": "./index.cjs.js",
13
13
  "module": "./index.esm.js",
14
14
  "publishConfig": {
15
- "access": "public"
15
+ "access": "public",
16
+ "directory": "dist"
16
17
  },
17
18
  "dependencies": {
18
19
  "js-tiktoken": "^1.0.21"
19
20
  },
20
21
  "peerDependencies": {
21
22
  "@langchain/core": "*",
22
- "@metad/contracts": "*",
23
- "@metad/ocap-core": "*",
23
+ "@xpert-ai/contracts": "workspace:*",
24
+ "@xpert-ai/ocap-core": "workspace:*",
24
25
  "@nestjs/common": "*",
25
26
  "@nestjs/core": "*",
26
27
  "@nestjs/cqrs": "*",
@@ -30,12 +31,10 @@
30
31
  "i18next": "*",
31
32
  "json-schema": "*",
32
33
  "jsonwebtoken": "*",
33
- "fs": "*",
34
- "path": "*",
35
34
  "passport-jwt": "*",
36
35
  "rxjs": "*",
37
- "stream": "*",
38
36
  "yaml": "*",
39
37
  "zod": "*"
40
- }
41
- }
38
+ },
39
+ "types": "./index.d.ts"
40
+ }
package/src/index.d.ts CHANGED
@@ -16,3 +16,4 @@ export * from './lib/channel/index';
16
16
  export * from './lib/file/index';
17
17
  export * from './lib/strategy';
18
18
  export * from './lib/sandbox/index';
19
+ export * from './lib/view-extension/index';
@@ -1,4 +1,4 @@
1
- import { TChatOptions, TChatRequest } from '@metad/contracts';
1
+ import { TChatOptions, TChatRequest } from '@xpert-ai/contracts';
2
2
  export declare const AGENT_CHAT_DISPATCH_MESSAGE_TYPE: import("./message-type").StructuredHandoffMessageType;
3
3
  export interface AgentChatCallbackTarget {
4
4
  messageType: string;
@@ -8,4 +8,4 @@ export declare const HANDOFF_PROCESSOR_STRATEGY = "HANDOFF_PROCESSOR_STRATEGY";
8
8
  * 1) Which message types it handles
9
9
  * 2) Default execution policy (lane/timeout)
10
10
  */
11
- export declare function HandoffProcessorStrategy(provider: string, metadata: HandoffProcessorMetadata): <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
11
+ export declare function HandoffProcessorStrategy(provider: string, metadata: HandoffProcessorMetadata): <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -1,2 +1,3 @@
1
+ export * from './skill/index';
1
2
  export * from './middleware';
2
3
  export * from './handoff';
@@ -1,6 +1,6 @@
1
1
  import type { Runtime as LangGraphRuntime } from "@langchain/langgraph";
2
2
  import type { BaseMessage } from "@langchain/core/messages";
3
- import { TSandboxConfigurable } from "@metad/contracts";
3
+ import { TSandboxConfigurable } from "@xpert-ai/contracts";
4
4
  /**
5
5
  * Type for the agent's built-in state properties.
6
6
  */
@@ -1,2 +1,2 @@
1
1
  export declare const AGENT_MIDDLEWARE_STRATEGY = "AGENT_MIDDLEWARE_STRATEGY";
2
- export declare const AgentMiddlewareStrategy: (provider: string) => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
2
+ export declare const AgentMiddlewareStrategy: (provider: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -1,4 +1,4 @@
1
- import { IWFNMiddleware, TAgentMiddlewareMeta } from '@metad/contracts';
1
+ import { IWFNMiddleware, TAgentMiddlewareMeta, TXpertFeatures } from '@xpert-ai/contracts';
2
2
  import { StructuredToolInterface } from "@langchain/core/tools";
3
3
  import { RunnableToolLike } from '@langchain/core/runnables';
4
4
  import { AgentMiddleware } from './types';
@@ -10,6 +10,7 @@ export interface IAgentMiddlewareContext {
10
10
  projectId?: string;
11
11
  conversationId?: string;
12
12
  xpertId?: string;
13
+ xpertFeatures?: TXpertFeatures | null;
13
14
  agentKey?: string;
14
15
  node: IWFNMiddleware;
15
16
  tools: Map<string, StructuredToolInterface | RunnableToolLike>;
@@ -1,2 +1,2 @@
1
1
  export declare const SKILL_SOURCE_PROVIDER = "SKILL_SOURCE_PROVIDER";
2
- export declare const SkillSourceProviderStrategy: (provider: string) => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
2
+ export declare const SkillSourceProviderStrategy: (provider: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -1,4 +1,4 @@
1
- import { ISkillRepository, ISkillRepositoryIndex, TSkillSourceMeta } from "@metad/contracts";
1
+ import { ISkillRepository, ISkillRepositoryIndex, TSkillSourceMeta } from '@xpert-ai/contracts';
2
2
  export interface ISkillSourceProvider {
3
3
  type: string;
4
4
  meta: TSkillSourceMeta;
@@ -1,7 +1,7 @@
1
1
  import { Embeddings } from '@langchain/core/embeddings';
2
2
  import { BaseLanguageModel } from '@langchain/core/language_models/base';
3
3
  import { BaseChatModel } from '@langchain/core/language_models/chat_models';
4
- import { AIModelEntity, AiModelTypeEnum, IAiProviderEntity, ICopilotModel, ProviderModel } from '@metad/contracts';
4
+ import { AIModelEntity, AiModelTypeEnum, IAiProviderEntity, ICopilotModel, ProviderModel } from '@xpert-ai/contracts';
5
5
  import { Logger } from '@nestjs/common';
6
6
  import { AIModel } from './ai-model';
7
7
  import { IAIModelProviderStrategy } from './ai-model-provider.interface';
@@ -1,4 +1,4 @@
1
- import { AiModelTypeEnum, IAiProviderEntity, ICopilotModel, ProviderModel, AIModelEntity } from '@metad/contracts';
1
+ import { AiModelTypeEnum, IAiProviderEntity, ICopilotModel, ProviderModel, AIModelEntity } from '@xpert-ai/contracts';
2
2
  import { BaseLanguageModel } from '@langchain/core/language_models/base';
3
3
  import { Embeddings } from '@langchain/core/embeddings';
4
4
  import { BaseChatModel } from '@langchain/core/language_models/chat_models';
@@ -1,5 +1,5 @@
1
1
  import { BaseChatModel } from '@langchain/core/language_models/chat_models';
2
- import { AIModelEntity, AiModelTypeEnum, ICopilotModel, ParameterRule, PriceInfo, PriceType } from '@metad/contracts';
2
+ import { AIModelEntity, AiModelTypeEnum, ICopilotModel, ParameterRule, PriceInfo, PriceType } from '@xpert-ai/contracts';
3
3
  import { Logger } from '@nestjs/common';
4
4
  import { ModelProvider } from './abstract-provider';
5
5
  import { IAIModel, TChatModelOptions } from './types/model';
@@ -1,7 +1,7 @@
1
1
  import { Embeddings } from '@langchain/core/embeddings';
2
2
  import { BaseLanguageModel } from '@langchain/core/language_models/base';
3
3
  import { BaseChatModel } from '@langchain/core/language_models/chat_models';
4
- import { ICopilotModel, ILLMUsage } from '@metad/contracts';
4
+ import { ICopilotModel, ILLMUsage } from '@xpert-ai/contracts';
5
5
  import { Command } from '@nestjs/cqrs';
6
6
  import { IRerank } from '../types';
7
7
  /**
@@ -1,3 +1,3 @@
1
- import { ParameterRule } from "@metad/contracts";
1
+ import { ParameterRule } from "@xpert-ai/contracts";
2
2
  import { DefaultParameterName } from "./model_entities";
3
3
  export declare const PARAMETER_RULE_TEMPLATE: Record<DefaultParameterName, ParameterRule>;
@@ -1,4 +1,4 @@
1
- import { AIModelEntity, ICopilot, ILLMUsage, ParameterRule, TTokenUsage } from '@metad/contracts';
1
+ import { AIModelEntity, ICopilot, ILLMUsage, ParameterRule, TTokenUsage } from '@xpert-ai/contracts';
2
2
  import { Logger } from '@nestjs/common';
3
3
  import { LLMResult } from '@langchain/core/outputs';
4
4
  import { AIModel } from './ai-model';
@@ -1,5 +1,5 @@
1
1
  import { BaseChatModel } from "@langchain/core/language_models/chat_models";
2
- import { AIModelEntity, ICopilot, ICopilotModel, ILLMUsage, ParameterType, PriceInfo, PriceType } from "@metad/contracts";
2
+ import { AIModelEntity, ICopilot, ICopilotModel, ILLMUsage, ParameterType, PriceInfo, PriceType } from "@xpert-ai/contracts";
3
3
  export type TChatModelOptions = {
4
4
  modelProperties: Record<string, any>;
5
5
  handleLLMTokens: (input: {
@@ -1,5 +1,5 @@
1
1
  import { Document } from '@langchain/core/documents';
2
- import { ICopilotModel } from '@metad/contracts';
2
+ import { ICopilotModel } from '@xpert-ai/contracts';
3
3
  import { AIModel } from '../ai-model';
4
4
  import { TChatModelOptions } from './model';
5
5
  export type RerankResult = {
@@ -1,5 +1,5 @@
1
1
  import { Embeddings } from '@langchain/core/embeddings';
2
- import { ICopilotModel } from '@metad/contracts';
2
+ import { ICopilotModel } from '@xpert-ai/contracts';
3
3
  import { AIModel } from '../ai-model';
4
4
  import { TChatModelOptions } from './model';
5
5
  export declare abstract class TextEmbeddingModelManager extends AIModel {
@@ -1,4 +1,4 @@
1
- import { ParameterRule } from '@metad/contracts';
1
+ import { ParameterRule } from '@xpert-ai/contracts';
2
2
  import { AIModel } from '../ai-model';
3
3
  export declare abstract class TextToSpeechModel extends AIModel {
4
4
  getParameterRules(model: string, credentials: Record<string, string>): ParameterRule[];
@@ -1,4 +1,4 @@
1
1
  import { BaseLanguageModel } from "@langchain/core/language_models/base";
2
- import { ICopilotModel } from "@metad/contracts";
2
+ import { ICopilotModel } from "@xpert-ai/contracts";
3
3
  export declare function getModelContextSize(input: BaseLanguageModel | ICopilotModel): number | undefined;
4
4
  export declare function normalizeContextSize(value: unknown): number | undefined;
@@ -1,6 +1,4 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { IIntegration } from '@metad/contracts';
1
+ import { IIntegration } from '@xpert-ai/contracts';
4
2
  import { Request, Response, NextFunction } from 'express';
5
3
  /**
6
4
  * Channel metadata
@@ -1,6 +1,5 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { IUser, LanguagesEnum, PermissionsEnum, RolesEnum } from '@metad/contracts';
1
+ import { IApiKey, IRequestScopeContext, IUser, LanguagesEnum, PermissionsEnum, RolesEnum } from '@xpert-ai/contracts';
2
+ import type { IApiPrincipal } from '@xpert-ai/contracts';
4
3
  import type { IncomingMessage, ServerResponse } from 'http';
5
4
  import { AsyncLocalStorage } from 'node:async_hooks';
6
5
  export declare class RequestContext {
@@ -11,6 +10,8 @@ export declare class RequestContext {
11
10
  readonly extras: Record<string, any>;
12
11
  constructor(request: IncomingMessage, response: ServerResponse, reqId: string, userId?: string, extras?: Record<string, any>);
13
12
  static currentRequestContext(): RequestContext;
13
+ static currentApiKey(): IApiKey | null;
14
+ static currentApiPrincipal(): IApiPrincipal | null;
14
15
  static currentRequest(): IncomingMessage;
15
16
  static currentTenantId(): string;
16
17
  static currentUserId(): string;
@@ -22,7 +23,11 @@ export declare class RequestContext {
22
23
  * @returns The language code (LanguagesEnum) extracted from the headers, or the default language (ENGLISH) if not found.
23
24
  */
24
25
  static getLanguageCode(): LanguagesEnum;
25
- static getOrganizationId(): string;
26
+ static getScope(): IRequestScopeContext;
27
+ static getOrganizationId(): string | null;
28
+ static isTenantScope(): boolean;
29
+ static isOrganizationScope(): boolean;
30
+ static requireOrganizationScope(): string;
26
31
  static hasPermissions(findPermissions: Array<PermissionsEnum | string>, throwError?: boolean): boolean;
27
32
  static hasAnyPermission(findPermissions: PermissionsEnum[], throwError?: boolean): boolean;
28
33
  static currentToken(throwError?: boolean): any;
@@ -1,5 +1,4 @@
1
- /// <reference types="node" />
2
- import { IUser } from '@metad/contracts';
1
+ import { IUser } from '@xpert-ai/contracts';
3
2
  import { NestMiddleware } from '@nestjs/common';
4
3
  import { IncomingMessage, ServerResponse } from 'node:http';
5
4
  export declare class RequestContextMiddleware implements NestMiddleware {
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import { FileSystemPermission } from './permissions';
4
2
  /**
5
3
  * Restricted FileSystem based on granted permissions
@@ -35,7 +33,7 @@ export declare class XpFileSystem {
35
33
  /**
36
34
  * Read file contents
37
35
  */
38
- readFile(filePath: string, encoding?: BufferEncoding): Promise<Buffer>;
36
+ readFile(filePath: string, encoding?: BufferEncoding): Promise<NonSharedBuffer>;
39
37
  /**
40
38
  * Write file contents
41
39
  */
@@ -52,4 +50,6 @@ export declare class XpFileSystem {
52
50
  * Utility: check if a file or directory exists
53
51
  */
54
52
  exists(targetPath: string): Promise<boolean>;
53
+ private buildUrl;
54
+ private encodePath;
55
55
  }
@@ -1,4 +1,3 @@
1
- import type { DSCoreService } from '@metad/ocap-core';
2
1
  import type { BasePermission } from './general';
3
2
  export type AnalyticsPermissionOperation = 'dscore' | 'query' | 'model' | 'indicator' | 'create_indicator';
4
3
  /**
@@ -37,9 +36,9 @@ export interface AnalyticsIndicatorValidationInput {
37
36
  /**
38
37
  * Analytics service exposed to plugins under permission control.
39
38
  */
40
- export interface AnalyticsPermissionService {
39
+ export interface AnalyticsPermissionService<TDSCoreService = unknown> {
41
40
  resolveChatBIModels(modelIds: string[]): Promise<AnalyticsResolvedChatBIModel[]>;
42
- getDSCoreService(input?: AnalyticsDSCoreInput): Promise<DSCoreService>;
41
+ getDSCoreService(input?: AnalyticsDSCoreInput): Promise<TDSCoreService>;
43
42
  visitChatBIModel(modelId: string, cubeName: string): Promise<void>;
44
43
  ensureCreateIndicatorAccess(): Promise<void>;
45
44
  validateIndicatorStatement(input: AnalyticsIndicatorValidationInput): Promise<void>;
@@ -1,4 +1,4 @@
1
- import type { IIntegration, IPagination } from '@metad/contracts';
1
+ import type { IIntegration, IPagination } from '@xpert-ai/contracts';
2
2
  /**
3
3
  * Base Permission type
4
4
  */
@@ -1,4 +1,4 @@
1
- import type { IUser } from '@metad/contracts';
1
+ import type { IUser } from '@xpert-ai/contracts';
2
2
  import type { BasePermission } from './general';
3
3
  export type UserPermissionOperation = 'read' | 'write' | 'update' | 'delete';
4
4
  /**
@@ -1,2 +1,2 @@
1
1
  export declare const DATASOURCE_STRATEGY = "DATASOURCE_STRATEGY";
2
- export declare const DataSourceStrategy: (provider: string) => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
2
+ export declare const DataSourceStrategy: (provider: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -1,10 +1,7 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- /// <reference types="node" />
4
1
  import * as _axios from 'axios';
5
2
  import { Readable } from 'stream';
6
- import { IColumnDef, IDSSchema, IDSTable } from '@metad/contracts';
7
- export { IColumnDef, IDSSchema, IDSTable } from '@metad/contracts';
3
+ import { IColumnDef, IDSSchema, IDSTable } from '@xpert-ai/contracts';
4
+ export { IColumnDef, IDSSchema, IDSTable } from '@xpert-ai/contracts';
8
5
  /**
9
6
  * The base options for DB adapters
10
7
  */
@@ -1,2 +1,2 @@
1
1
  export declare const FILE_STORAGE_PROVIDER = "FILE_STORAGE_PROVIDER";
2
- export declare const FileStorageProvider: (provider: string) => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
2
+ export declare const FileStorageProvider: (provider: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -1,6 +1,4 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { FileStorageOption, FileSystem, UploadedFile } from '@metad/contracts';
1
+ import { FileStorageOption, FileSystem, UploadedFile } from '@xpert-ai/contracts';
4
2
  export interface IFileStorageProvider {
5
3
  readonly name: string;
6
4
  readonly config?: FileSystem & Record<string, any>;
@@ -1,2 +1,2 @@
1
1
  export declare const FILE_UPLOAD_TARGET_STRATEGY = "FILE_UPLOAD_TARGET_STRATEGY";
2
- export declare const FileUploadTargetStrategy: (type: string) => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
2
+ export declare const FileUploadTargetStrategy: (type: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -1,6 +1,4 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { IFileAssetDestination, IFileAssetSource, IStorageFile, IUploadFileTarget } from '@metad/contracts';
1
+ import { IFileAssetDestination, IFileAssetSource, IStorageFile, IUploadFileTarget } from '@xpert-ai/contracts';
4
2
  export type TFileUploadRequestContext = {
5
3
  tenantId?: string;
6
4
  organizationId?: string;
@@ -1,2 +1,2 @@
1
1
  export declare const INTEGRATION_STRATEGY = "INTEGRATION_STRATEGY";
2
- export declare const IntegrationStrategyKey: (provider: string) => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
2
+ export declare const IntegrationStrategyKey: (provider: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -1,4 +1,4 @@
1
- import { IIntegration, TIntegrationProvider } from '@metad/contracts';
1
+ import { IIntegration, TIntegrationProvider } from '@xpert-ai/contracts';
2
2
  export type TIntegrationStrategyParams = {
3
3
  query: string;
4
4
  };
@@ -2,4 +2,4 @@ export declare const IMAGE_UNDERSTANDING_STRATEGY = "IMAGE_UNDERSTANDING_STRATEG
2
2
  /**
3
3
  * Decorator to mark a provider as an Image Understanding Strategy
4
4
  */
5
- export declare const ImageUnderstandingStrategy: (provider: string) => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
5
+ export declare const ImageUnderstandingStrategy: (provider: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -1,6 +1,6 @@
1
1
  import { DocumentInterface } from '@langchain/core/documents';
2
2
  import { BaseChatModel } from '@langchain/core/language_models/chat_models';
3
- import { IDocumentUnderstandingProvider, IKnowledgeDocument } from '@metad/contracts';
3
+ import { IDocumentUnderstandingProvider, IKnowledgeDocument } from '@xpert-ai/contracts';
4
4
  import { Permissions, XpFileSystem } from '../../core/index';
5
5
  import { ChunkMetadata } from '../types';
6
6
  export type TImageUnderstandingConfig = {
@@ -1,2 +1,2 @@
1
1
  export declare const KNOWLEDGE_STRATEGY = "KNOWLEDGE_STRATEGY";
2
- export declare const KnowledgeStrategyKey: (provider: string) => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
2
+ export declare const KnowledgeStrategyKey: (provider: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -1,4 +1,4 @@
1
- import { IIntegration } from '@metad/contracts';
1
+ import { IIntegration } from '@xpert-ai/contracts';
2
2
  import { Document } from '@langchain/core/documents';
3
3
  export type TKnowledgeStrategyParams = {
4
4
  query: string;
@@ -2,4 +2,4 @@ export declare const RETRIEVER_STRATEGY = "RETRIEVER_STRATEGY";
2
2
  /**
3
3
  * Decorator to mark a provider as a Retriever Strategy
4
4
  */
5
- export declare const RetrieverStrategy: (provider: string) => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
5
+ export declare const RetrieverStrategy: (provider: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -1,5 +1,5 @@
1
1
  import { VectorStore } from '@langchain/core/vectorstores';
2
- import { I18nObject } from '@metad/contracts';
2
+ import { I18nObject } from '@xpert-ai/contracts';
3
3
  import { Document } from '@langchain/core/documents';
4
4
  export type TRetrieverConfig = {
5
5
  vectorStore: VectorStore;
@@ -2,4 +2,4 @@ export declare const DOCUMENT_SOURCE_STRATEGY = "DOCUMENT_SOURCE_STRATEGY";
2
2
  /**
3
3
  * Decorator to mark a provider as a Document Source Strategy
4
4
  */
5
- export declare const DocumentSourceStrategy: (provider: string) => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
5
+ export declare const DocumentSourceStrategy: (provider: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -1,4 +1,4 @@
1
- import { IDocumentSourceProvider, IIntegration } from '@metad/contracts';
1
+ import { IDocumentSourceProvider, IIntegration } from '@xpert-ai/contracts';
2
2
  import { Document } from '@langchain/core/documents';
3
3
  import { Permissions } from '../../core';
4
4
  export interface IDocumentSourceStrategy<TConfig = any> {
@@ -1,2 +1,2 @@
1
1
  export declare const TEXT_SPLITTER_STRATEGY = "TEXT_SPLITTER_STRATEGY";
2
- export declare const TextSplitterStrategy: (provider: string) => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
2
+ export declare const TextSplitterStrategy: (provider: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -1,4 +1,4 @@
1
- import { IDocumentChunkerProvider, KnowledgeStructureEnum } from '@metad/contracts';
1
+ import { IDocumentChunkerProvider, KnowledgeStructureEnum } from '@xpert-ai/contracts';
2
2
  import { DocumentInterface } from '@langchain/core/documents';
3
3
  import { ChunkMetadata } from '../types';
4
4
  /**
@@ -2,4 +2,4 @@ export declare const DOCUMENT_TRANSFORMER_STRATEGY = "DOCUMENT_TRANSFORMER_STRAT
2
2
  /**
3
3
  * Decorator to mark a provider as a Document Transformer Strategy
4
4
  */
5
- export declare const DocumentTransformerStrategy: (provider: string) => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
5
+ export declare const DocumentTransformerStrategy: (provider: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -1,4 +1,4 @@
1
- import { IDocumentProcessorProvider, IIntegration, IKnowledgeDocument } from '@metad/contracts';
1
+ import { IDocumentProcessorProvider, IIntegration, IKnowledgeDocument } from '@xpert-ai/contracts';
2
2
  import { Permissions, XpFileSystem } from '../../core/index';
3
3
  import { ChunkMetadata } from '../types';
4
4
  export type TDocumentTransformerConfig = {
@@ -1,6 +1,6 @@
1
1
  import { DocumentInterface } from '@langchain/core/documents';
2
- import { IDocChunkMetadata } from '@metad/contracts';
3
- export { TDocumentAsset } from '@metad/contracts';
2
+ import { IDocChunkMetadata } from '@xpert-ai/contracts';
3
+ export { TDocumentAsset } from '@xpert-ai/contracts';
4
4
  export interface ChunkMetadata extends IDocChunkMetadata {
5
5
  startOffset?: number;
6
6
  endOffset?: number;
@@ -1,3 +1,4 @@
1
+ import { IBackendProtocol, TSandboxConfigurable } from '@xpert-ai/contracts';
1
2
  import type { SandboxExecutionOptions } from './execution';
2
3
  /**
3
4
  * Protocol definition for pluggable memory backends.
@@ -190,7 +191,7 @@ export interface FileUploadResponse {
190
191
  * Methods can return either direct values or Promises, allowing both
191
192
  * synchronous and asynchronous implementations.
192
193
  */
193
- export interface BackendProtocol {
194
+ export interface BackendProtocol extends IBackendProtocol {
194
195
  /**
195
196
  * Structured listing with file metadata.
196
197
  *
@@ -346,13 +347,8 @@ export interface SandboxBackendProtocol extends BackendProtocol {
346
347
  /** Canonical sandbox environment identifier bound to this backend */
347
348
  readonly environmentId?: string | null;
348
349
  }
349
- /**
350
- * Type guard to check if a backend supports execution.
351
- *
352
- * @param backend - Backend instance to check
353
- * @returns True if the backend implements SandboxBackendProtocol
354
- */
355
- export declare function isSandboxBackend(backend: BackendProtocol): backend is SandboxBackendProtocol;
350
+ export declare function isSandboxBackend(backend: unknown): backend is SandboxBackendProtocol;
351
+ export declare function resolveSandboxBackend(sandbox: TSandboxConfigurable | SandboxBackendProtocol | null | undefined | unknown): SandboxBackendProtocol | null;
356
352
  /**
357
353
  * State and store container for backend initialization.
358
354
  *
@@ -1,2 +1,2 @@
1
1
  export declare const SANDBOX_PROVIDER = "SANDBOX_PROVIDER";
2
- export declare const SandboxProviderStrategy: (provider: string) => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
2
+ export declare const SandboxProviderStrategy: (provider: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -1,4 +1,4 @@
1
- import { TSandboxProviderMeta, TSandboxWorkForType } from '@metad/contracts';
1
+ import { TSandboxProviderMeta, TSandboxWorkForType } from '@xpert-ai/contracts';
2
2
  import { SandboxBackendProtocol } from './protocol';
3
3
  export type SandboxProviderCreateOptions = {
4
4
  /**
@@ -1,6 +1,6 @@
1
- import { OnModuleInit } from "@nestjs/common";
2
- import { DiscoveryService, Reflector } from "@nestjs/core";
3
- import { StrategyBus } from "./core/strategy-bus";
1
+ import { OnModuleInit } from '@nestjs/common';
2
+ import { DiscoveryService, Reflector } from '@nestjs/core';
3
+ import { StrategyBus } from './core/strategy-bus';
4
4
  export declare class BaseStrategyRegistry<S> implements OnModuleInit {
5
5
  protected readonly strategyKey: string;
6
6
  protected discoveryService: DiscoveryService;
@@ -1,6 +1,6 @@
1
1
  import { StructuredToolInterface } from '@langchain/core/tools';
2
2
  import { BaseStore } from '@langchain/langgraph';
3
- import { I18nObject, IXpertToolset, ToolProviderCredentials, TToolCredentials, TToolsetParams, XpertToolsetCategoryEnum } from '@metad/contracts';
3
+ import { I18nObject, IXpertToolset, ToolProviderCredentials, TToolCredentials, TToolsetParams, XpertToolsetCategoryEnum } from '@xpert-ai/contracts';
4
4
  import { Logger } from '@nestjs/common';
5
5
  import { CommandBus, QueryBus } from '@nestjs/cqrs';
6
6
  import { BaseToolset } from './toolset';
@@ -2,4 +2,4 @@ export declare const TOOLSET_STRATEGY = "TOOLSET_STRATEGY";
2
2
  /**
3
3
  * Decorator to mark a provider as a Toolset Strategy
4
4
  */
5
- export declare const ToolsetStrategy: (provider: string) => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
5
+ export declare const ToolsetStrategy: (provider: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -1,5 +1,5 @@
1
1
  import { DynamicStructuredTool } from '@langchain/core/tools';
2
- import { I18nObject, IconDefinition } from '@metad/contracts';
2
+ import { I18nObject, IconDefinition } from '@xpert-ai/contracts';
3
3
  import { ZodSchema } from 'zod';
4
4
  import { BuiltinToolset } from './builtin';
5
5
  export interface IToolsetStrategy<TConfig = any> {
@@ -1,5 +1,5 @@
1
1
  import { BaseToolkit, StructuredTool, StructuredToolInterface } from "@langchain/core/tools";
2
- import { I18nObject, TStateVariable, TToolsetParams } from "@metad/contracts";
2
+ import { I18nObject, TStateVariable, TToolsetParams } from "@xpert-ai/contracts";
3
3
  import { z } from 'zod';
4
4
  type ZodObjectAny = z.ZodObject<any, any, any, any>;
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { JsonSchemaObjectType, PluginMeta } from '@metad/contracts';
1
+ import { JsonSchemaObjectType, PluginMeta } from '@xpert-ai/contracts';
2
2
  import type { DynamicModule, INestApplicationContext } from '@nestjs/common';
3
3
  import { ModuleRef } from '@nestjs/core';
4
4
  import type { ZodSchema } from 'zod';
@@ -1,2 +1,2 @@
1
1
  export declare const VECTOR_STORE_STRATEGY = "VECTOR_STORE_STRATEGY";
2
- export declare const VectorStoreStrategy: (provider: string) => <TFunction extends Function, Y>(target: object | TFunction, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
2
+ export declare const VectorStoreStrategy: (provider: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -0,0 +1,4 @@
1
+ export * from './provider.decorator';
2
+ export * from './provider.interface';
3
+ export * from './provider.registry';
4
+ export * from './tokens';
@@ -0,0 +1,2 @@
1
+ export declare const VIEW_EXTENSION_PROVIDER = "VIEW_EXTENSION_PROVIDER";
2
+ export declare const ViewExtensionProvider: (providerKey: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
@@ -0,0 +1,7 @@
1
+ import { XpertExtensionViewManifest, XpertResolvedViewHostContext, XpertViewActionRequest, XpertViewActionResult, XpertViewDataResult, XpertViewQuery } from '@xpert-ai/contracts';
2
+ export interface IXpertViewExtensionProvider {
3
+ supports(context: XpertResolvedViewHostContext): Promise<boolean> | boolean;
4
+ getViewManifests(context: XpertResolvedViewHostContext, slot: string): Promise<XpertExtensionViewManifest[]> | XpertExtensionViewManifest[];
5
+ getViewData(context: XpertResolvedViewHostContext, viewKey: string, query: XpertViewQuery): Promise<XpertViewDataResult> | XpertViewDataResult;
6
+ executeViewAction?(context: XpertResolvedViewHostContext, viewKey: string, actionKey: string, request: XpertViewActionRequest): Promise<XpertViewActionResult> | XpertViewActionResult;
7
+ }
@@ -0,0 +1,10 @@
1
+ import { DiscoveryService, Reflector } from '@nestjs/core';
2
+ import { BaseStrategyRegistry } from '../strategy';
3
+ import { IXpertViewExtensionProvider } from './provider.interface';
4
+ export declare class ViewExtensionProviderRegistry extends BaseStrategyRegistry<IXpertViewExtensionProvider> {
5
+ constructor(discoveryService: DiscoveryService, reflector: Reflector);
6
+ listEntries(organizationId?: string): Array<{
7
+ providerKey: string;
8
+ provider: IXpertViewExtensionProvider;
9
+ }>;
10
+ }