@xpert-ai/plugin-sdk 3.17.1 → 3.17.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.
@@ -180,6 +180,10 @@ const KnowledgebaseDocumentsRuntimeCapability = createRuntimeCapability('platfor
180
180
  description: 'Upload, import, create, process, inspect, and delete persistent knowledgebase documents.'
181
181
  });
182
182
 
183
+ const KnowledgeDocumentVisualAssetsRuntimeCapability = createRuntimeCapability('platform.knowledgebase.visual-assets', {
184
+ description: 'Issue execution-scoped logical KnowledgeDocument image paths and inject validated images without exposing host storage paths.'
185
+ });
186
+
183
187
  const ActorTokenRuntimeCapability = createRuntimeCapability('platform.actor-token', {
184
188
  description: 'Mint a short-lived host-issued actor bearer token for outbound API calls.'
185
189
  });
@@ -190,7 +194,7 @@ const ArtifactsRuntimeCapability = createRuntimeCapability('platform.artifacts',
190
194
 
191
195
  /** Stable source identifier for portable workspace file references. */ const WORKSPACE_FILES_SOURCE = 'platform.workspace.files';
192
196
  const WorkspaceFilesRuntimeCapability = createRuntimeCapability('platform.workspace.files', {
193
- description: 'Upload, understand, resolve, read, and delete raw files in Xpert workspace volumes.'
197
+ description: 'Upload, understand, search parsed chunks, resolve, read, and delete files in Xpert workspace volumes.'
194
198
  });
195
199
 
196
200
  /** Stable machine-readable failures emitted by the Sandbox Jobs capability. */ const SANDBOX_JOB_ERROR_CODES = [
@@ -232,6 +236,10 @@ const SANDBOX_JOB_ERROR_CODE_SET = new Set(SANDBOX_JOB_ERROR_CODES);
232
236
  description: 'Run registered plugin actions in isolated, short-lived Sandbox Runtime jobs.'
233
237
  });
234
238
 
239
+ const ProjectProvisioningRuntimeCapability = createRuntimeCapability('platform.project.provisioning', {
240
+ description: 'Idempotently provision a platform Chat Project and connect it to an Assistant.'
241
+ });
242
+
235
243
  /**
236
244
  * Shared host-runtime plumbing for built-in tools backed by a configured model provider.
237
245
  * Provider request/response semantics remain owned by each plugin.
@@ -333,10 +341,12 @@ exports.BaseTool = BaseTool;
333
341
  exports.BaseToolset = BaseToolset;
334
342
  exports.BuiltinToolset = BuiltinToolset;
335
343
  exports.DefaultRuntimeCapabilityRegistry = DefaultRuntimeCapabilityRegistry;
344
+ exports.KnowledgeDocumentVisualAssetsRuntimeCapability = KnowledgeDocumentVisualAssetsRuntimeCapability;
336
345
  exports.KnowledgebaseDocumentsRuntimeCapability = KnowledgebaseDocumentsRuntimeCapability;
337
346
  exports.KnowledgebaseProvisioningRuntimeCapability = KnowledgebaseProvisioningRuntimeCapability;
338
347
  exports.KnowledgebaseRuntimeCapability = KnowledgebaseRuntimeCapability;
339
348
  exports.ModelProviderBuiltinToolset = ModelProviderBuiltinToolset;
349
+ exports.ProjectProvisioningRuntimeCapability = ProjectProvisioningRuntimeCapability;
340
350
  exports.SANDBOX_JOB_ERROR_CODES = SANDBOX_JOB_ERROR_CODES;
341
351
  exports.SANDBOX_JOB_PROGRESS_PREFIX = SANDBOX_JOB_PROGRESS_PREFIX;
342
352
  exports.SandboxJobRuntimeError = SandboxJobRuntimeError;
@@ -178,6 +178,10 @@ const KnowledgebaseDocumentsRuntimeCapability = createRuntimeCapability('platfor
178
178
  description: 'Upload, import, create, process, inspect, and delete persistent knowledgebase documents.'
179
179
  });
180
180
 
181
+ const KnowledgeDocumentVisualAssetsRuntimeCapability = createRuntimeCapability('platform.knowledgebase.visual-assets', {
182
+ description: 'Issue execution-scoped logical KnowledgeDocument image paths and inject validated images without exposing host storage paths.'
183
+ });
184
+
181
185
  const ActorTokenRuntimeCapability = createRuntimeCapability('platform.actor-token', {
182
186
  description: 'Mint a short-lived host-issued actor bearer token for outbound API calls.'
183
187
  });
@@ -188,7 +192,7 @@ const ArtifactsRuntimeCapability = createRuntimeCapability('platform.artifacts',
188
192
 
189
193
  /** Stable source identifier for portable workspace file references. */ const WORKSPACE_FILES_SOURCE = 'platform.workspace.files';
190
194
  const WorkspaceFilesRuntimeCapability = createRuntimeCapability('platform.workspace.files', {
191
- description: 'Upload, understand, resolve, read, and delete raw files in Xpert workspace volumes.'
195
+ description: 'Upload, understand, search parsed chunks, resolve, read, and delete files in Xpert workspace volumes.'
192
196
  });
193
197
 
194
198
  /** Stable machine-readable failures emitted by the Sandbox Jobs capability. */ const SANDBOX_JOB_ERROR_CODES = [
@@ -230,6 +234,10 @@ const SANDBOX_JOB_ERROR_CODE_SET = new Set(SANDBOX_JOB_ERROR_CODES);
230
234
  description: 'Run registered plugin actions in isolated, short-lived Sandbox Runtime jobs.'
231
235
  });
232
236
 
237
+ const ProjectProvisioningRuntimeCapability = createRuntimeCapability('platform.project.provisioning', {
238
+ description: 'Idempotently provision a platform Chat Project and connect it to an Assistant.'
239
+ });
240
+
233
241
  /**
234
242
  * Shared host-runtime plumbing for built-in tools backed by a configured model provider.
235
243
  * Provider request/response semantics remain owned by each plugin.
@@ -325,4 +333,4 @@ function normalizeOptionalString(value) {
325
333
  return normalized || undefined;
326
334
  }
327
335
 
328
- export { ActorTokenRuntimeCapability as A, BaseTool as B, DefaultRuntimeCapabilityRegistry as D, KnowledgebaseDocumentsRuntimeCapability 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, KnowledgebaseProvisioningRuntimeCapability as e, KnowledgebaseRuntimeCapability as f, SANDBOX_JOB_PROGRESS_PREFIX as g, SandboxJobRuntimeError as h, SandboxJobsRuntimeCapability as i, WorkspaceFilesRuntimeCapability as j, isSandboxJobRuntimeError as k };
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.1",
3
+ "version": "3.17.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.17.1",
20
+ "@xpert-ai/contracts": "3.17.3",
21
21
  "express": "^4.22.1",
22
22
  "js-tiktoken": "^1.0.21"
23
23
  },
@@ -3,7 +3,7 @@ import { BaseLanguageModel } from '@langchain/core/language_models/base';
3
3
  import { BaseChatModel } from '@langchain/core/language_models/chat_models';
4
4
  import type { Runtime as LangGraphRuntime } from '@langchain/langgraph';
5
5
  import type { BaseMessage } from '@langchain/core/messages';
6
- import { ICopilotModel, IXpertAgentExecution, JSONValue, ModelUsagePricingSnapshot, ModelUsageReport, ModelUsageReportResult, ModelUsagePricingContext, TSandboxConfigurable } from '@xpert-ai/contracts';
6
+ import { ICopilotModel, IModelAccessResolution, IXpertAgentExecution, JSONValue, ModelUsagePricingSnapshot, ModelUsageReport, ModelUsageReportResult, ModelUsagePricingContext, TSandboxConfigurable } from '@xpert-ai/contracts';
7
7
  import { Subscriber } from 'rxjs';
8
8
  import { AIGCModelClient, AsyncAIGCModelClient, IRerank, TLLMUsage } from '../../ai-model/types';
9
9
  import type { RuntimeCapabilityRegistry } from '../../core';
@@ -71,6 +71,9 @@ export type AgentMiddlewareCreateModelClientOptions = {
71
71
  /** `observe` reads an existing asynchronous task and must not consume generation quota. */
72
72
  purpose?: 'invoke' | 'observe';
73
73
  };
74
+ export type AgentMiddlewareModelAccessContext = ModelUsagePricingContext & {
75
+ requestId: string;
76
+ };
74
77
  export type AgentMiddlewareModelProviderConnection = {
75
78
  /** Stable host-owned model provider configuration boundary. */
76
79
  providerScopeId: string;
@@ -81,10 +84,12 @@ export type AgentMiddlewareModelProviderConnection = {
81
84
  provider: string;
82
85
  baseURL: string;
83
86
  authorization: string;
87
+ /** Resolve and freeze the host-owned Direct/Grant access decision before provider invocation. */
88
+ resolveModelAccess?: (context: AgentMiddlewareModelAccessContext) => Promise<IModelAccessResolution>;
84
89
  /** Resolve the model YAML price rule and freeze it for one invocation. */
85
90
  resolvePricingSnapshot?: (context: ModelUsagePricingContext) => Promise<ModelUsagePricingSnapshot>;
86
91
  /** Persist final authoritative usage and calculate its charge exactly once. */
87
- reportUsage(report: ModelUsageReport): Promise<ModelUsageReportResult>;
92
+ reportUsage(report: ModelUsageReport, modelAccess?: IModelAccessResolution): Promise<ModelUsageReportResult>;
88
93
  };
89
94
  export type AgentMiddlewareRuntimeScope = {
90
95
  tenantId?: string | null;
@@ -8,6 +8,10 @@ export interface IAIModelProviderStrategy {
8
8
  /**
9
9
  * Provider metadata
10
10
  */
11
+ /**
12
+ * Stable provider identifier from the provider schema.
13
+ */
14
+ readonly name: string;
11
15
  /**
12
16
  * Validate whether the credentials are valid
13
17
  */
@@ -35,7 +39,7 @@ export interface IAIModelProviderStrategy {
35
39
  /**
36
40
  * Return the defined provider models (metadata)
37
41
  */
38
- getProviderModels?(modelType?: AiModelTypeEnum, onlyActive?: boolean): ProviderModel[];
42
+ getProviderModels(modelType?: AiModelTypeEnum, onlyActive?: boolean): ProviderModel[];
39
43
  getProviderSchema(): IAiProviderEntity;
40
44
  getProviderServerPath(): string;
41
45
  getModelManager<T extends AIModel>(modelType: AiModelTypeEnum): T;
@@ -1,6 +1,7 @@
1
1
  export * from './ai-model-provider.interface';
2
2
  export * from './ai-model-provider.decorator';
3
3
  export * from './ai-model-provider.registry';
4
+ export * from './ai-model';
4
5
  export * from './abstract-provider';
5
6
  export * from './types';
6
7
  export * from './llm';
@@ -1,4 +1,4 @@
1
- import { AIModelEntity, ICopilot, ILLMUsage, ParameterRule, TTokenUsage } from '@xpert-ai/contracts';
1
+ import { AIModelEntity, ICopilot, ILLMUsage, LLMPriceContext, LLMReportedPrice, ParameterRule, TTokenUsage } from '@xpert-ai/contracts';
2
2
  import { Logger } from '@nestjs/common';
3
3
  import { BaseCallbackHandler } from '@langchain/core/callbacks/base';
4
4
  import { LLMResult } from '@langchain/core/outputs';
@@ -8,6 +8,13 @@ export type CommonChatModelParameters = {
8
8
  temperature: number;
9
9
  maxRetries?: number | null;
10
10
  };
11
+ export type LLMUsagePricingOptions = {
12
+ context?: LLMPriceContext;
13
+ resolveContext?: (output: LLMResult) => LLMPriceContext;
14
+ resolveReportedPrice?: (output: LLMResult) => LLMReportedPrice | undefined;
15
+ reportedPriceRequired?: boolean;
16
+ };
17
+ export type LLMUsagePricingConfiguration = LLMPriceContext | LLMUsagePricingOptions;
11
18
  export declare class LLMUsage implements ILLMUsage {
12
19
  /**
13
20
  * Model class for llm usage.
@@ -33,8 +40,8 @@ export declare abstract class LargeLanguageModel extends AIModel {
33
40
  #private;
34
41
  protected startedAt: DOMHighResTimeStamp;
35
42
  protected _commonParameterRules(model: string): ParameterRule[];
36
- protected calcResponseUsage(model: string, credentials: Record<string, any>, promptTokens: number, completionTokens: number, startedAt?: number): ILLMUsage;
37
- createHandleUsageCallbacks(copilot: ICopilot, model: string, credentials: any, handleLLMTokens: TChatModelOptions['handleLLMTokens']): {
43
+ protected calcResponseUsage(model: string, credentials: Record<string, any>, promptTokens: number, completionTokens: number, startedAt?: number, tokenUsage?: TTokenUsage, pricingContext?: LLMPriceContext): ILLMUsage;
44
+ createHandleUsageCallbacks(copilot: ICopilot, model: string, credentials: any, handleLLMTokens: TChatModelOptions['handleLLMTokens'], pricingConfiguration?: LLMUsagePricingConfiguration): {
38
45
  name: string;
39
46
  lc_serializable: boolean;
40
47
  readonly lc_namespace: ["langchain_core", "callbacks", string];
@@ -1,4 +1,4 @@
1
- import { type ModelUsageModality, type ModelUsageOperation, type ModelUsagePricingDimensions, type ModelUsagePricingSnapshot } from '@xpert-ai/contracts';
1
+ import { type IModelAccessResolution, type ModelUsageModality, type ModelUsageOperation, type ModelUsagePricingDimensions, type ModelUsagePricingSnapshot } from '@xpert-ai/contracts';
2
2
  import type { AgentMiddlewareModelProviderConnection } from '../agent/middleware/runtime';
3
3
  import type { ManagedQueueJob } from '../managed-queue';
4
4
  import type { AIGCModelObservation, AsyncAIGCModelClient } from './types/aigc';
@@ -16,6 +16,7 @@ export type AsyncAIGCManagedJobPayload<TInput, TResult> = {
16
16
  startedAt: string;
17
17
  providerRequestId?: string;
18
18
  providerState?: AIGCModelObservation['state'];
19
+ modelAccess?: IModelAccessResolution;
19
20
  pricingSnapshot?: ModelUsagePricingSnapshot;
20
21
  usageReported?: boolean;
21
22
  result?: TResult;
@@ -1,5 +1,6 @@
1
- import { type ModelUsagePricingSnapshot, type ModelUsageMetric, type ModelUsagePriceRule, type ModelUsagePricingConfig, type ModelUsagePricingContext, type ModelUsagePricingStatus, PriceConfig, PriceInfo, PriceType } from '@xpert-ai/contracts';
1
+ import { type LLMPriceCalculation, type LLMPriceContext, type ModelUsagePricingSnapshot, type ModelUsageMetric, type ModelUsagePriceRule, type ModelUsagePricingConfig, type ModelUsagePricingContext, type ModelUsagePricingStatus, PriceConfig, PriceInfo, PriceType, type TTokenUsage } from '@xpert-ai/contracts';
2
2
  export declare function calculateModelPrice(pricing: PriceConfig, priceType: PriceType, tokens: number, inputTokens?: number): PriceInfo;
3
+ export declare function calculateLLMUsagePrice(pricing: PriceConfig, usage: TTokenUsage, context?: LLMPriceContext): LLMPriceCalculation;
3
4
  export type ModelUsageChargeCalculation = {
4
5
  pricingStatus: ModelUsagePricingStatus;
5
6
  pricingRule?: ModelUsagePriceRule;
@@ -1,11 +1,15 @@
1
1
  import { BaseChatModel } from '@langchain/core/language_models/chat_models';
2
- import { AIModelEntity, ICopilot, ICopilotModel, ILLMUsage, ModelUsagePricingContext, ModelUsagePricingSnapshot, ParameterRule, ParameterType, PriceInfo, PriceType } from '@xpert-ai/contracts';
2
+ import { AIModelEntity, ICopilot, ICopilotModel, ILLMUsage, ModelUsageReport, ModelUsagePricingContext, ModelUsagePricingSnapshot, ParameterRule, ParameterType, PriceInfo, PriceType } from '@xpert-ai/contracts';
3
3
  export type TModelUsageType = 'estimated';
4
4
  export type TLLMUsage = ILLMUsage & {
5
5
  type?: TModelUsageType;
6
6
  };
7
7
  export type TChatModelOptions = {
8
8
  modelProperties: Record<string, any>;
9
+ /** Final authoritative usage for non-LLM model clients. */
10
+ handleModelUsage?: (report: ModelUsageReport) => void | Promise<void>;
11
+ /** Freeze the active usage price rules at invocation start. */
12
+ resolveUsagePricingSnapshot?: (context: ModelUsagePricingContext) => ModelUsagePricingSnapshot | Promise<ModelUsagePricingSnapshot>;
9
13
  handleLLMTokens: (input: {
10
14
  copilot: ICopilot;
11
15
  model?: string;
@@ -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
  }
@@ -1,6 +1,8 @@
1
1
  export * from './knowledgebase';
2
2
  export * from './knowledgebase-documents';
3
+ export * from './knowledge-document-visual-assets';
3
4
  export * from './actor-token';
4
5
  export * from './artifacts';
5
6
  export * from './workspace-files';
6
7
  export * from './sandbox-jobs';
8
+ export * from './project-provisioning';
@@ -0,0 +1,78 @@
1
+ import type { WorkspacePortableFileReference } from './workspace-files';
2
+ export type KnowledgeDocumentVisualCandidateReason = 'same_block' | 'same_chunk' | 'same_page' | 'adjacent_page' | 'visual_summary_match' | 'visual_only_fallback';
3
+ export type KnowledgeDocumentVisualTextAnchor = {
4
+ page?: number;
5
+ chunkId?: string;
6
+ sourceBlockIds?: string[];
7
+ };
8
+ export type KnowledgeDocumentVisualBusinessScope = {
9
+ namespace: 'bom.requirement-evidence';
10
+ caseId: string;
11
+ baselineId: string;
12
+ runId: string;
13
+ sourceDocumentId: string;
14
+ };
15
+ export type KnowledgeDocumentVisualCandidateRequest = {
16
+ knowledgebaseId: string;
17
+ knowledgeDocumentId: string;
18
+ query: string;
19
+ textAnchors: KnowledgeDocumentVisualTextAnchor[];
20
+ maxAssets: number;
21
+ businessScope: KnowledgeDocumentVisualBusinessScope;
22
+ };
23
+ export type KnowledgeDocumentVisualCandidate = {
24
+ /**
25
+ * Execution-scoped logical path returned by a governed KnowledgeDocument search. This is not a
26
+ * host filesystem path and can only be resolved again by the knowledgebase image viewer.
27
+ */
28
+ filePath: string;
29
+ knowledgeDocumentId: string;
30
+ sourceDocumentId: string;
31
+ page?: number;
32
+ chunkId?: string;
33
+ sourceBlockIds: string[];
34
+ visualAssetId: string;
35
+ candidateReason: KnowledgeDocumentVisualCandidateReason;
36
+ summary?: string;
37
+ };
38
+ export type KnowledgeDocumentVisualCandidateResult = {
39
+ candidates: KnowledgeDocumentVisualCandidate[];
40
+ warnings: string[];
41
+ };
42
+ export type KnowledgeDocumentViewImagesInput = {
43
+ filePaths: string[];
44
+ };
45
+ export type KnowledgeDocumentViewedImage = Omit<KnowledgeDocumentVisualCandidate, 'filePath'> & {
46
+ index: number;
47
+ mimeType: 'image/png' | 'image/jpeg' | 'image/webp';
48
+ size: number;
49
+ width?: number;
50
+ height?: number;
51
+ sha256: string;
52
+ };
53
+ /**
54
+ * Server-only materialization data used to create an immutable ArtifactVersion.
55
+ *
56
+ * This value is returned through the in-process runtime capability and must not
57
+ * be copied into ToolMessage content or persisted chat metadata.
58
+ */
59
+ export type KnowledgeDocumentPreparedImageArtifact = {
60
+ index: number;
61
+ fileName: string;
62
+ workspaceFileRef: WorkspacePortableFileReference;
63
+ };
64
+ export type KnowledgeDocumentViewImagesResult = {
65
+ batchRef: string;
66
+ images: KnowledgeDocumentViewedImage[];
67
+ artifactInputs: KnowledgeDocumentPreparedImageArtifact[];
68
+ };
69
+ export type KnowledgeDocumentVisualImagePayload = KnowledgeDocumentViewedImage & {
70
+ dataBase64: string;
71
+ };
72
+ export interface KnowledgeDocumentVisualAssetsApi {
73
+ issueCandidates(input: KnowledgeDocumentVisualCandidateRequest): Promise<KnowledgeDocumentVisualCandidateResult>;
74
+ prepareImages(input: KnowledgeDocumentViewImagesInput): Promise<KnowledgeDocumentViewImagesResult>;
75
+ consumeImageBatch(batchRef: string): Promise<KnowledgeDocumentVisualImagePayload[]>;
76
+ discardImageBatch(batchRef: string): Promise<void>;
77
+ }
78
+ export declare const KnowledgeDocumentVisualAssetsRuntimeCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<KnowledgeDocumentVisualAssetsApi>;
@@ -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.