@xpert-ai/plugin-sdk 3.18.7 → 3.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +123 -0
- package/MIDDLEWARE_APPS.md +71 -0
- package/README.md +57 -0
- package/RESOURCE-CARDS-VALIDATION.md +51 -0
- package/RESOURCE-CARDS.md +361 -0
- package/TOOL-IMAGES.md +85 -0
- package/agent-results.cjs.default.js +1 -0
- package/agent-results.cjs.js +20 -0
- package/agent-results.cjs.mjs +2 -0
- package/agent-results.d.ts +1 -0
- package/agent-results.esm.js +4 -0
- package/index.cjs.js +586 -162
- package/index.esm.js +530 -167
- package/model-provider.cjs.js +5 -0
- package/model-provider.esm.js +5 -1
- package/package.json +8 -2
- package/results.cjs.js +50 -0
- package/results.esm.js +46 -0
- package/runtime-capabilities.md +35 -0
- package/src/agent-results.d.ts +2 -0
- package/src/index.d.ts +5 -0
- package/src/lib/agent/handoff/agent-chat.contract.d.ts +6 -1
- package/src/lib/agent/handoff/agent-runtime-message.contract.d.ts +319 -0
- package/src/lib/agent/handoff/index.d.ts +1 -0
- package/src/lib/agent/index.d.ts +2 -0
- package/src/lib/agent/middleware/capabilities/assistant-task.d.ts +55 -20
- package/src/lib/agent/middleware/index.d.ts +1 -0
- package/src/lib/agent/middleware/model-requirements.d.ts +9 -0
- package/src/lib/agent/middleware/strategy.interface.d.ts +4 -0
- package/src/lib/agent/middleware/types.d.ts +20 -3
- package/src/lib/agent/resource-card.d.ts +3 -0
- package/src/lib/agent/runtime/activity.d.ts +6 -0
- package/src/lib/agent/runtime/capability.d.ts +37 -0
- package/src/lib/agent/runtime/cli-model-profile.d.ts +62 -0
- package/src/lib/agent/runtime/dispatch.d.ts +517 -0
- package/src/lib/agent/runtime/execution-runner.d.ts +66 -0
- package/src/lib/agent/runtime/index.d.ts +10 -0
- package/src/lib/agent/runtime/model-execution.d.ts +15 -0
- package/src/lib/agent/runtime/results.d.ts +335 -0
- package/src/lib/agent/runtime/strategy.d.ts +53 -0
- package/src/lib/agent/runtime/task-wait.d.ts +35 -0
- package/src/lib/agent/runtime/types.d.ts +156 -0
- package/src/lib/ai-model/ai-model-provider.interface.d.ts +2 -0
- package/src/lib/ai-model/ai-model.d.ts +2 -0
- package/src/lib/ai-model/index.d.ts +3 -0
- package/src/lib/ai-model/llm.d.ts +4 -2
- package/src/lib/ai-model/native-model.d.ts +22 -0
- package/src/lib/ai-model/realtime.d.ts +36 -0
- package/src/lib/ai-model/token-usage.d.ts +13 -0
- package/src/lib/assistant-capability/index.d.ts +42 -0
- package/src/lib/connector/runtime-capability.d.ts +2 -0
- package/src/lib/connector/strategy.interface.d.ts +8 -0
- package/src/lib/core/context/request-context.d.ts +6 -0
- package/src/lib/core/strategy-bus.d.ts +0 -3
- package/src/lib/evolution/runtime-capability.d.ts +2 -1
- package/src/lib/integration/strategy.interface.d.ts +22 -0
- package/src/lib/mcp/app.d.ts +14 -1
- package/src/lib/project-task/index.d.ts +66 -0
- package/src/lib/project-type/index.d.ts +71 -0
- package/src/lib/resource-card-provider/index.d.ts +3 -0
- package/src/lib/resource-card-provider/provider.decorator.d.ts +4 -0
- package/src/lib/resource-card-provider/provider.registry.d.ts +14 -0
- package/src/lib/resource-card-provider/types.d.ts +36 -0
- package/src/lib/resource-card.d.ts +6 -0
- package/src/lib/runtime/capabilities/index.d.ts +1 -0
- package/src/lib/runtime/capabilities/knowledge-graph.d.ts +59 -0
- package/src/lib/runtime/capabilities/knowledgebase-documents.d.ts +21 -0
- package/src/lib/runtime/capabilities/knowledgebase.d.ts +8 -3
- package/src/lib/runtime/capabilities/project-access.d.ts +2 -1
- package/src/lib/runtime/capabilities/project-provisioning.d.ts +13 -0
- package/src/lib/runtime/capabilities/tool-images.d.ts +24 -0
- package/src/lib/runtime/runtime-scope.d.ts +7 -1
- package/src/lib/sandbox/execution-environment.d.ts +12 -0
- package/src/lib/sandbox/execution.d.ts +13 -0
- package/src/lib/sandbox/index.d.ts +1 -0
- package/src/lib/sandbox/managed-service.d.ts +1 -0
- package/src/lib/sandbox/protocol.d.ts +2 -0
- package/src/lib/tool-provider/types.d.ts +6 -0
- package/src/lib/types.d.ts +2 -1
- package/src/lib/workflow/trigger/strategy.interface.d.ts +2 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { RealtimeModelEvent, RealtimeToolResult, RealtimeTaskContext } from '@xpert-ai/contracts';
|
|
2
|
+
import type { JSONSchema7 } from 'json-schema';
|
|
3
|
+
export interface RealtimeSessionOptions {
|
|
4
|
+
voice: string;
|
|
5
|
+
instructions: string;
|
|
6
|
+
tools: {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
parameters: JSONSchema7;
|
|
10
|
+
}[];
|
|
11
|
+
}
|
|
12
|
+
/** The host owns networking, credentials, backpressure and authorization. */
|
|
13
|
+
export interface RealtimeProtocolSink {
|
|
14
|
+
send(event: object): void;
|
|
15
|
+
emit(event: RealtimeModelEvent): void;
|
|
16
|
+
}
|
|
17
|
+
export interface RealtimeProtocol {
|
|
18
|
+
start(): void;
|
|
19
|
+
receive(event: unknown): void;
|
|
20
|
+
appendAudio(audio: Uint8Array): void;
|
|
21
|
+
setMuted(muted: boolean): void;
|
|
22
|
+
cancelResponse(): void;
|
|
23
|
+
submitToolResults(results: RealtimeToolResult[]): void;
|
|
24
|
+
/** Synchronize task facts without requesting speech or emitting a user transcript. */
|
|
25
|
+
updateTaskContext?(tasks: RealtimeTaskContext[]): void;
|
|
26
|
+
notify(text: string): boolean;
|
|
27
|
+
close(): void;
|
|
28
|
+
}
|
|
29
|
+
/** Server-only connection descriptor. Never serialize this object to clients. */
|
|
30
|
+
export interface RealtimeModelConnection {
|
|
31
|
+
url: string;
|
|
32
|
+
headers: {
|
|
33
|
+
[header: string]: string;
|
|
34
|
+
};
|
|
35
|
+
createProtocol(options: RealtimeSessionOptions, sink: RealtimeProtocolSink): RealtimeProtocol;
|
|
36
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TTokenUsage } from '@xpert-ai/contracts';
|
|
2
|
+
export interface ResolvedTokenUsage {
|
|
3
|
+
usage: TTokenUsage;
|
|
4
|
+
source: 'provider' | 'estimated' | 'legacy' | 'unavailable';
|
|
5
|
+
}
|
|
6
|
+
/** Select a whole candidate. Never fill missing actual counts using estimates. */
|
|
7
|
+
export declare function resolveTokenUsageCandidates(input: {
|
|
8
|
+
canonical?: Partial<TTokenUsage> | null;
|
|
9
|
+
actual?: Partial<TTokenUsage> | null;
|
|
10
|
+
estimated?: Partial<TTokenUsage> | null;
|
|
11
|
+
legacyTotal?: number;
|
|
12
|
+
}): ResolvedTokenUsage;
|
|
13
|
+
export declare function normalizeTokenUsage(candidate?: Partial<TTokenUsage> | null): TTokenUsage | null;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { DiscoveryService, Reflector } from '@nestjs/core';
|
|
2
|
+
import type { I18nObject, LanguagesEnum, ModelFeature, TXpertTeamDraft, TXpertTemplate } from '@xpert-ai/contracts';
|
|
3
|
+
import { BaseStrategyRegistry } from '../strategy';
|
|
4
|
+
export interface AssistantCapabilityContext {
|
|
5
|
+
template: TXpertTemplate;
|
|
6
|
+
draft: TXpertTeamDraft;
|
|
7
|
+
language: LanguagesEnum;
|
|
8
|
+
/** Provided again at installation; providers must not silently select a fallback. */
|
|
9
|
+
sandboxProviders?: {
|
|
10
|
+
type: string;
|
|
11
|
+
}[];
|
|
12
|
+
}
|
|
13
|
+
export interface AssistantCapabilityApplyContext extends AssistantCapabilityContext {
|
|
14
|
+
loadTemplate: (id: string) => Promise<TXpertTemplate>;
|
|
15
|
+
}
|
|
16
|
+
/** Optional capabilities default to off. IDs are stable machine-readable keys. */
|
|
17
|
+
export interface IAssistantCapabilityProvider {
|
|
18
|
+
readonly key: string;
|
|
19
|
+
readonly label: string | I18nObject;
|
|
20
|
+
readonly description: string | I18nObject;
|
|
21
|
+
readonly requiredModelFeatures?: ModelFeature[];
|
|
22
|
+
/** Explicitly opt into the blank Assistant creation flow. */
|
|
23
|
+
readonly availableForBlankAssistant?: boolean;
|
|
24
|
+
/** Distribution extensions to specific templates, without changing their portable source. */
|
|
25
|
+
readonly templates?: {
|
|
26
|
+
templateId: string;
|
|
27
|
+
required: boolean;
|
|
28
|
+
}[];
|
|
29
|
+
/** Detect a capability already owned by the base workflow; it cannot be removed by a new overlay. */
|
|
30
|
+
isEnabled?(draft: TXpertTeamDraft): boolean;
|
|
31
|
+
check(context: AssistantCapabilityContext): Promise<{
|
|
32
|
+
available: boolean;
|
|
33
|
+
reason?: string;
|
|
34
|
+
}>;
|
|
35
|
+
/** Deterministic draft composition; never creates external resources. */
|
|
36
|
+
apply(context: AssistantCapabilityApplyContext): Promise<void>;
|
|
37
|
+
}
|
|
38
|
+
export declare const ASSISTANT_CAPABILITY_PROVIDER = "ASSISTANT_CAPABILITY_PROVIDER";
|
|
39
|
+
export declare const AssistantCapabilityProvider: (key: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
40
|
+
export declare class AssistantCapabilityProviderRegistry extends BaseStrategyRegistry<IAssistantCapabilityProvider> {
|
|
41
|
+
constructor(discovery: DiscoveryService, reflector: Reflector);
|
|
42
|
+
}
|
|
@@ -3,6 +3,8 @@ import type { ConnectorRuntimeApi } from './strategy.interface';
|
|
|
3
3
|
export declare const ConnectorRuntimeCapability: import("../core").RuntimeCapabilityKey<ConnectorRuntimeApi>;
|
|
4
4
|
/** No binding or provider grants means no connector access. */
|
|
5
5
|
export type ConnectorRuntimeScope = RuntimeIdentityScope & {
|
|
6
|
+
/** Host-validated Agent Plugin dependencies may use their workspace binding in an authorized project. */
|
|
7
|
+
allowWorkspaceBindingsInProject?: boolean;
|
|
6
8
|
/** Host-selected bindings, including IDs pinned by enabled graph Connector nodes. */
|
|
7
9
|
connectorBindingIds?: string[] | null;
|
|
8
10
|
/** Providers configured by enabled graph Connector nodes without a pinned ID. */
|
|
@@ -72,6 +72,7 @@ export type ConnectorPermissionDeclaration = {
|
|
|
72
72
|
required?: boolean;
|
|
73
73
|
};
|
|
74
74
|
export type ConnectorDefinitionBase = {
|
|
75
|
+
runtimeUsage?: 'middleware' | 'credential';
|
|
75
76
|
provider: string;
|
|
76
77
|
label: RuntimeI18nText;
|
|
77
78
|
description?: RuntimeI18nText;
|
|
@@ -139,6 +140,10 @@ export type ConnectorBindingCreateRequest = {
|
|
|
139
140
|
authorizationMode: ConnectorAuthorizationMode;
|
|
140
141
|
};
|
|
141
142
|
export type ConnectorRuntimeOption = {
|
|
143
|
+
scope?: ConnectorScope;
|
|
144
|
+
canManage?: boolean;
|
|
145
|
+
managementUrl?: string;
|
|
146
|
+
runtimeUsage?: 'middleware' | 'credential';
|
|
142
147
|
bindingId: string;
|
|
143
148
|
provider: string;
|
|
144
149
|
authorizationMode: ConnectorAuthorizationMode;
|
|
@@ -152,6 +157,9 @@ export type ConnectorRuntimeOption = {
|
|
|
152
157
|
profile?: ConnectorProfile | null;
|
|
153
158
|
};
|
|
154
159
|
export type ConnectorRuntimeOptions = {
|
|
160
|
+
workspaceScope?: ConnectorScope;
|
|
161
|
+
canManageWorkspace?: boolean;
|
|
162
|
+
managementUrl?: string;
|
|
155
163
|
scope: ConnectorScope;
|
|
156
164
|
items: ConnectorRuntimeOption[];
|
|
157
165
|
};
|
|
@@ -28,6 +28,11 @@ export declare class RequestContext {
|
|
|
28
28
|
static isTenantScope(): boolean;
|
|
29
29
|
static isOrganizationScope(): boolean;
|
|
30
30
|
static requireOrganizationScope(): string;
|
|
31
|
+
/**
|
|
32
|
+
* Check the authenticated principal's enabled role permissions, matching the
|
|
33
|
+
* server RequestContext. Authentication guards resolve JWTs, API keys and
|
|
34
|
+
* ChatKit client secrets before this check; the bearer is not always a JWT.
|
|
35
|
+
*/
|
|
31
36
|
static hasPermissions(findPermissions: Array<PermissionsEnum | string>, throwError?: boolean): boolean;
|
|
32
37
|
static hasAnyPermission(findPermissions: PermissionsEnum[], throwError?: boolean): boolean;
|
|
33
38
|
static currentToken(throwError?: boolean): any;
|
|
@@ -46,6 +51,7 @@ export declare class RequestContext {
|
|
|
46
51
|
* @returns True if any of the required roles are found, otherwise false.
|
|
47
52
|
*/
|
|
48
53
|
static hasRoles(roles: RolesEnum[], throwError?: boolean): boolean;
|
|
54
|
+
private static currentPermissions;
|
|
49
55
|
}
|
|
50
56
|
/**
|
|
51
57
|
* One process-wide context store shared by source, built, and dynamically loaded
|
|
@@ -11,9 +11,6 @@ export type StrategyBusEvent<S = any> = {
|
|
|
11
11
|
cause?: 'refresh' | 'uninstall';
|
|
12
12
|
};
|
|
13
13
|
export declare class StrategyBus {
|
|
14
|
-
private readonly removalGuards;
|
|
15
|
-
registerRemovalGuard(guard: (scopeKey: string, pluginNames: readonly string[]) => Promise<void>): () => void;
|
|
16
|
-
assertCanRemove(scopeKey: string, pluginNames: readonly string[]): Promise<void>;
|
|
17
14
|
private readonly subject;
|
|
18
15
|
readonly events$: import("rxjs").Observable<StrategyBusEvent<any>>;
|
|
19
16
|
upsert<S>(strategyType: string, entry: StrategyEntry<S>): void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { EvolutionRuntimeApi, EvolutionChangeRuntimeApi } from '@xpert-ai/contracts';
|
|
1
|
+
import type { EvolutionRuntimeApi, EvolutionChangeRuntimeApi, EvolutionBaselineRuntimeApi } from '@xpert-ai/contracts';
|
|
2
2
|
export declare const EVOLUTION_RUNTIME_SERVICE_TOKEN = "XPERT_EVOLUTION_RUNTIME_SERVICE";
|
|
3
|
+
export declare const EvolutionBaselineRuntimeCapability: import("../core").RuntimeCapabilityKey<EvolutionBaselineRuntimeApi>;
|
|
3
4
|
export declare const EvolutionRuntimeCapability: import("../core").RuntimeCapabilityKey<EvolutionRuntimeApi>;
|
|
4
5
|
export declare const EvolutionChangeRuntimeCapability: import("../core").RuntimeCapabilityKey<EvolutionChangeRuntimeApi>;
|
|
@@ -40,4 +40,26 @@ export interface IntegrationStrategy<T = unknown> {
|
|
|
40
40
|
validateConfig?(config: T, integration?: IIntegration<T>): Promise<void | IntegrationTestResult>;
|
|
41
41
|
getIdentityBootstrap?(integration: IIntegration<T>): Promise<IntegrationIdentityBootstrap>;
|
|
42
42
|
exchangeIdentity?(integration: IIntegration<T>, grant: IntegrationIdentityGrant): Promise<IntegrationExternalIdentity>;
|
|
43
|
+
beginQrAuthorization?(): Promise<IntegrationQrAuthorization>;
|
|
44
|
+
pollQrAuthorization?(deviceCode: string): Promise<IntegrationQrAuthorizationResult>;
|
|
45
|
+
/** Stable provider account identity used to reuse integrations within the same tenant and organization. */
|
|
46
|
+
getQrAuthorizationIdentity?(options: unknown): string | null;
|
|
43
47
|
}
|
|
48
|
+
/** Server-only setup contract. Never forward deviceCode or options to the browser. */
|
|
49
|
+
export interface IntegrationQrAuthorization {
|
|
50
|
+
deviceCode: string;
|
|
51
|
+
authorizationUrl: string;
|
|
52
|
+
expiresInSeconds: number;
|
|
53
|
+
intervalSeconds: number;
|
|
54
|
+
}
|
|
55
|
+
export type IntegrationQrAuthorizationResult =
|
|
56
|
+
/** Additive provider backoff, persisted by the host for the rest of the session. */
|
|
57
|
+
{
|
|
58
|
+
status: 'waiting';
|
|
59
|
+
intervalIncrementSeconds?: number;
|
|
60
|
+
} | {
|
|
61
|
+
status: 'expired' | 'denied' | 'failed';
|
|
62
|
+
} | {
|
|
63
|
+
status: 'authorized';
|
|
64
|
+
options: Record<string, unknown>;
|
|
65
|
+
};
|
package/src/lib/mcp/app.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { I18nObject, TMcpAppRefresh } from '@xpert-ai/contracts';
|
|
1
2
|
export interface McpAppCsp {
|
|
2
3
|
connectDomains?: string[];
|
|
3
4
|
resourceDomains?: string[];
|
|
@@ -11,9 +12,21 @@ export interface McpAppPermissions {
|
|
|
11
12
|
export interface McpAppDefinition {
|
|
12
13
|
key: string;
|
|
13
14
|
entry: string;
|
|
14
|
-
title?: string;
|
|
15
|
+
title?: string | I18nObject;
|
|
15
16
|
description?: string;
|
|
17
|
+
/** Read-only tool called by the host Refresh action; never replays the entry tool. */
|
|
18
|
+
refresh?: TMcpAppRefresh;
|
|
16
19
|
csp?: McpAppCsp;
|
|
17
20
|
permissions?: McpAppPermissions;
|
|
18
21
|
}
|
|
22
|
+
/** App exposure is independent of publishing a tool on an external MCP server. */
|
|
23
|
+
export interface MiddlewareMcpApps {
|
|
24
|
+
definitions: readonly McpAppDefinition[];
|
|
25
|
+
tools: Readonly<Record<string, {
|
|
26
|
+
resourceKey?: string;
|
|
27
|
+
visibility: readonly ('model' | 'app')[];
|
|
28
|
+
/** Trusted plugin policy; omitted writes use the host approval flow. */
|
|
29
|
+
approval?: 'required' | 'none';
|
|
30
|
+
}>>;
|
|
31
|
+
}
|
|
19
32
|
export declare function defineMcpApp(definition: McpAppDefinition): Readonly<McpAppDefinition>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { DiscoveryService, Reflector } from '@nestjs/core';
|
|
2
|
+
import type { ProjectTaskGraph, ProjectTaskGraphChange, ProjectTaskExecutionTarget, ProjectTaskTypeDefinition, TXpertProjectTaskStatus } from '@xpert-ai/contracts';
|
|
3
|
+
import { BaseStrategyRegistry } from '../strategy';
|
|
4
|
+
import type { ProjectAccessActor } from '../runtime/capabilities/project-access';
|
|
5
|
+
export interface ProjectTaskContext {
|
|
6
|
+
actor: ProjectAccessActor;
|
|
7
|
+
projectId: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ProjectTaskProjection {
|
|
10
|
+
key: string;
|
|
11
|
+
title: string;
|
|
12
|
+
status: TXpertProjectTaskStatus;
|
|
13
|
+
/** Completion percentage (0–100), independent of status. Omit to preserve; null clears it. */
|
|
14
|
+
progress?: number | null;
|
|
15
|
+
kind: 'task' | 'summary' | 'milestone';
|
|
16
|
+
/** Registered business type; omitted values preserve legacy persisted types. Null explicitly clears it. */
|
|
17
|
+
taskType?: string | null;
|
|
18
|
+
parentKey?: string;
|
|
19
|
+
predecessorKeys: string[];
|
|
20
|
+
diagnostic?: string;
|
|
21
|
+
assigneeXpertId?: string;
|
|
22
|
+
executions: Array<{
|
|
23
|
+
key: string;
|
|
24
|
+
attempt: number;
|
|
25
|
+
agentExecutionId?: string;
|
|
26
|
+
conversationId?: string;
|
|
27
|
+
threadId?: string;
|
|
28
|
+
xpertId?: string;
|
|
29
|
+
agentKey?: string;
|
|
30
|
+
status: 'queued' | 'running' | 'succeeded' | 'failed' | 'cancelled';
|
|
31
|
+
startedAt?: string;
|
|
32
|
+
completedAt?: string;
|
|
33
|
+
error?: string;
|
|
34
|
+
outputSummary?: string;
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
37
|
+
/** Domain facts remain durable in the provider; projection can be replayed after interruption. */
|
|
38
|
+
export interface ProjectTaskSnapshot {
|
|
39
|
+
revision: string;
|
|
40
|
+
tasks: ProjectTaskProjection[];
|
|
41
|
+
}
|
|
42
|
+
export interface IProjectTaskProvider {
|
|
43
|
+
readonly key: string;
|
|
44
|
+
/** Presentation declarations belong to this provider and never contain executable icon code. */
|
|
45
|
+
readonly taskTypes?: readonly ProjectTaskTypeDefinition[];
|
|
46
|
+
/** Return null when the project is not owned by this provider. Always scope domain reads. */
|
|
47
|
+
snapshot(context: ProjectTaskContext): Promise<ProjectTaskSnapshot | null>;
|
|
48
|
+
/** Called after projection commits; retries must be idempotent. Never start work here. */
|
|
49
|
+
linked?(context: ProjectTaskContext, links: Array<{
|
|
50
|
+
sourceKey: string;
|
|
51
|
+
taskId: string;
|
|
52
|
+
}>): Promise<void>;
|
|
53
|
+
}
|
|
54
|
+
export type { ProjectTaskIconName, ProjectTaskTypeDefinition, ProjectTaskTypePresentation } from '@xpert-ai/contracts';
|
|
55
|
+
export declare const PROJECT_TASK_PROVIDER = "PROJECT_TASK_PROVIDER";
|
|
56
|
+
export declare const ProjectTaskProvider: (key: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
57
|
+
export declare class ProjectTaskProviderRegistry extends BaseStrategyRegistry<IProjectTaskProvider> {
|
|
58
|
+
constructor(discovery: DiscoveryService, reflector: Reflector);
|
|
59
|
+
}
|
|
60
|
+
/** ORM-independent project task management; actor values come from trusted server context. */
|
|
61
|
+
export interface ProjectTasksApi {
|
|
62
|
+
graph(context: ProjectTaskContext): Promise<ProjectTaskGraph>;
|
|
63
|
+
change(context: ProjectTaskContext, input: ProjectTaskGraphChange): Promise<ProjectTaskGraph>;
|
|
64
|
+
resolveExecution(context: ProjectTaskContext, taskExecutionId: string): Promise<ProjectTaskExecutionTarget>;
|
|
65
|
+
}
|
|
66
|
+
export declare const ProjectTasksRuntimeCapability: import("../core/runtime-capability").RuntimeCapabilityKey<ProjectTasksApi>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { DiscoveryService, Reflector } from '@nestjs/core';
|
|
2
|
+
import type { XpertProjectTypeRef, ConversationResourceCard } from '@xpert-ai/contracts';
|
|
3
|
+
import { BaseStrategyRegistry } from '../strategy';
|
|
4
|
+
export type { XpertProjectTypeRef, ConversationResourceCard };
|
|
5
|
+
export interface ProjectTypeContext extends XpertProjectTypeRef {
|
|
6
|
+
tenantId: string;
|
|
7
|
+
organizationId?: string | null;
|
|
8
|
+
userId: string;
|
|
9
|
+
xpertId: string;
|
|
10
|
+
purpose: 'provision' | 'open' | 'create';
|
|
11
|
+
}
|
|
12
|
+
export interface ProjectTypeBinding {
|
|
13
|
+
/** Persisted business Assistant used when opening a Project from the global list. */
|
|
14
|
+
xpertId?: string;
|
|
15
|
+
viewKey: string;
|
|
16
|
+
selectionId?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* ORM-independent write access to the host's current creation transaction.
|
|
20
|
+
* The host owns commit/rollback; this object is valid only during the awaited
|
|
21
|
+
* creation hook. Entities must be instances of registered plugin entity classes.
|
|
22
|
+
*/
|
|
23
|
+
export interface ProjectCreationTransaction {
|
|
24
|
+
/** Save an entity and return its persisted values without committing the transaction. */
|
|
25
|
+
save<T extends object>(entity: T): Promise<T>;
|
|
26
|
+
}
|
|
27
|
+
/** Host-owned identity and transaction for an empty conversation's first send. */
|
|
28
|
+
export interface ConversationProjectCreation {
|
|
29
|
+
projectId: string;
|
|
30
|
+
conversationId: string;
|
|
31
|
+
workspaceId: string;
|
|
32
|
+
name: string;
|
|
33
|
+
/** Present only for a human-confirmed setup; the application validates its own configuration. */
|
|
34
|
+
confirmation?: {
|
|
35
|
+
id: string;
|
|
36
|
+
configuration: object;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Persist only application records through this writer. The host creates the
|
|
40
|
+
* platform Project and binds the conversation in the same transaction. Do not
|
|
41
|
+
* call provisioning, start agents, or perform external I/O from this hook.
|
|
42
|
+
*/
|
|
43
|
+
transaction: ProjectCreationTransaction;
|
|
44
|
+
}
|
|
45
|
+
/** Host calls this provider before claiming or synchronizing an entity Project. */
|
|
46
|
+
export interface IProjectTypeProvider {
|
|
47
|
+
/** Must verify the persisted domain-to-project link and actor before returning. */
|
|
48
|
+
resolve(context: ProjectTypeContext, projectId: string): Promise<ProjectTypeBinding & {
|
|
49
|
+
name: string;
|
|
50
|
+
status: 'active' | 'archived';
|
|
51
|
+
}>;
|
|
52
|
+
/** Opens the application's governed creation workflow. */
|
|
53
|
+
createEntry(context: ProjectTypeContext): Promise<ProjectTypeBinding>;
|
|
54
|
+
/**
|
|
55
|
+
* Optional opt-in to first-send creation. Persist the business entity and its
|
|
56
|
+
* link to input.projectId atomically using input.transaction, then return its entry
|
|
57
|
+
* and desired name. Exceptions roll back the whole bootstrap. The host checks
|
|
58
|
+
* permissions and serializes retries with a conversation row lock first.
|
|
59
|
+
*/
|
|
60
|
+
createForConversation?(context: ProjectTypeContext, input: ConversationProjectCreation): Promise<ProjectTypeBinding & {
|
|
61
|
+
name: string;
|
|
62
|
+
status: 'active';
|
|
63
|
+
resourceCards?: ConversationResourceCard[];
|
|
64
|
+
}>;
|
|
65
|
+
}
|
|
66
|
+
export declare const PROJECT_TYPE_PROVIDER = "PROJECT_TYPE_PROVIDER";
|
|
67
|
+
/** Register the stable provider key used by entity-backed App project type declarations. */
|
|
68
|
+
export declare const ProjectTypeProvider: (key: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
69
|
+
export declare class ProjectTypeProviderRegistry extends BaseStrategyRegistry<IProjectTypeProvider> {
|
|
70
|
+
constructor(discovery: DiscoveryService, reflector: Reflector);
|
|
71
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ResourceCardType } from './types';
|
|
2
|
+
export declare const RESOURCE_CARD_PROVIDER = "RESOURCE_CARD_PROVIDER";
|
|
3
|
+
/** Register exact resource types whose message cards opt in to live refresh. */
|
|
4
|
+
export declare const ResourceCardProvider: (...resources: ResourceCardType[]) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type OnModuleDestroy } from '@nestjs/common';
|
|
2
|
+
import { DiscoveryService, Reflector } from '@nestjs/core';
|
|
3
|
+
import { BaseStrategyRegistry } from '../strategy';
|
|
4
|
+
import type { IResourceCardProvider, ResourceCardType } from './types';
|
|
5
|
+
export declare class ResourceCardProviderRegistry extends BaseStrategyRegistry<IResourceCardProvider> implements OnModuleDestroy {
|
|
6
|
+
private readonly resourceLogger;
|
|
7
|
+
private subscription?;
|
|
8
|
+
constructor(discovery: DiscoveryService, reflector: Reflector);
|
|
9
|
+
onModuleInit(): void;
|
|
10
|
+
onModuleDestroy(): void;
|
|
11
|
+
remove(scopeKey: string, pluginName: string): void;
|
|
12
|
+
upsert(instance: unknown): void;
|
|
13
|
+
find(resource: ResourceCardType, organizationId?: string): IResourceCardProvider | undefined;
|
|
14
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ConversationResourceCard } from '@xpert-ai/contracts';
|
|
2
|
+
export interface ResourceCardType {
|
|
3
|
+
namespace: string;
|
|
4
|
+
type: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ResourceCardContext {
|
|
7
|
+
tenantId: string;
|
|
8
|
+
organizationId?: string | null;
|
|
9
|
+
userId: string;
|
|
10
|
+
conversationId: string;
|
|
11
|
+
threadId: string;
|
|
12
|
+
projectId?: string | null;
|
|
13
|
+
/** Stop external reads when the host's observation deadline expires. */
|
|
14
|
+
signal: AbortSignal;
|
|
15
|
+
}
|
|
16
|
+
export interface ResourceCardReadRequest {
|
|
17
|
+
/** Opaque correlation key. Echo it; never choose another message binding. */
|
|
18
|
+
key: string;
|
|
19
|
+
card: ConversationResourceCard;
|
|
20
|
+
messageId: string;
|
|
21
|
+
executionId?: string;
|
|
22
|
+
}
|
|
23
|
+
export type ResourceCardResolution = {
|
|
24
|
+
key: string;
|
|
25
|
+
} & ({
|
|
26
|
+
status: 'resolved';
|
|
27
|
+
card: ConversationResourceCard;
|
|
28
|
+
} | {
|
|
29
|
+
status: 'unavailable';
|
|
30
|
+
reason: 'forbidden' | 'not_found';
|
|
31
|
+
});
|
|
32
|
+
/** Optional live presentation of committed resources; never starts work or changes business state. */
|
|
33
|
+
export interface IResourceCardProvider {
|
|
34
|
+
/** Recheck resource access for the host-supplied actor and return one result per request. */
|
|
35
|
+
resolveMany(context: ResourceCardContext, requests: readonly ResourceCardReadRequest[]): Promise<readonly ResourceCardResolution[]>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { RunnableConfig } from '@langchain/core/runnables';
|
|
2
|
+
import { type ConversationResourceCard } from '@xpert-ai/contracts';
|
|
3
|
+
export { createResourceCardContent, parseResourceCard, resourceCardId } from '@xpert-ai/contracts';
|
|
4
|
+
export type { ConversationResourceCard, ResourceCardContent, ResourceCardField, ResourceCardFile, ResourceCardFileReference, ResourceCardImage, ResourceCardOpenTarget, ResourceCardScalar, TMessageContentResourceCard } from '@xpert-ai/contracts';
|
|
5
|
+
/** Call after the business mutation commits. A display failure must not retry that mutation. */
|
|
6
|
+
export declare function emitResourceCard(card: ConversationResourceCard, config?: RunnableConfig): Promise<void>;
|
|
@@ -46,6 +46,9 @@ export type KnowledgeGraphPublicationResult = {
|
|
|
46
46
|
error?: string | null;
|
|
47
47
|
};
|
|
48
48
|
export interface KnowledgeGraphApi {
|
|
49
|
+
/** Bounded, source-version-checked reads; the host verifies the current Agent's KB connection. */
|
|
50
|
+
queryEntities?(input: KnowledgeGraphEntityQuery): Promise<KnowledgeGraphReadResult>;
|
|
51
|
+
readNeighborhood?(input: KnowledgeGraphNeighborhoodQuery): Promise<KnowledgeGraphReadResult>;
|
|
49
52
|
/** Atomically accepts a complete, validated snapshot. Indexing is durable and retryable. */
|
|
50
53
|
publish(input: KnowledgeGraphPublishInput): Promise<KnowledgeGraphPublicationResult>;
|
|
51
54
|
status(input: KnowledgeGraphPublicationOwner): Promise<KnowledgeGraphPublicationResult | null>;
|
|
@@ -56,4 +59,60 @@ export interface KnowledgeGraphApi {
|
|
|
56
59
|
chunkIds: string[];
|
|
57
60
|
}): Promise<KnowledgeGraphPublicationResult>;
|
|
58
61
|
}
|
|
62
|
+
export type KnowledgeGraphReadScope = {
|
|
63
|
+
knowledgebaseId: string;
|
|
64
|
+
xpertId: string;
|
|
65
|
+
agentKey: string;
|
|
66
|
+
sources: {
|
|
67
|
+
documentId: string;
|
|
68
|
+
sourceVersion: string;
|
|
69
|
+
}[];
|
|
70
|
+
};
|
|
71
|
+
export type KnowledgeGraphEntityQuery = KnowledgeGraphReadScope & {
|
|
72
|
+
entityIds?: string[];
|
|
73
|
+
namespace?: string;
|
|
74
|
+
nodeKey?: string;
|
|
75
|
+
type?: string;
|
|
76
|
+
search?: string;
|
|
77
|
+
/** Opaque continuation bound to this query and its source versions. */
|
|
78
|
+
cursor?: string;
|
|
79
|
+
limit?: number;
|
|
80
|
+
};
|
|
81
|
+
export type KnowledgeGraphNeighborhoodQuery = KnowledgeGraphReadScope & {
|
|
82
|
+
entityIds: string[];
|
|
83
|
+
relationTypes: string[];
|
|
84
|
+
depth?: number;
|
|
85
|
+
direction?: 'incoming' | 'outgoing' | 'both';
|
|
86
|
+
/** Continuation is supported for one-hop reads only. */
|
|
87
|
+
cursor?: string;
|
|
88
|
+
limit?: number;
|
|
89
|
+
};
|
|
90
|
+
export type KnowledgeGraphReadEntity = {
|
|
91
|
+
id: string;
|
|
92
|
+
name: string;
|
|
93
|
+
type: string;
|
|
94
|
+
properties: Record<string, JSONValue>;
|
|
95
|
+
documentId: string;
|
|
96
|
+
documentIds?: string[];
|
|
97
|
+
};
|
|
98
|
+
export type KnowledgeGraphReadRelation = {
|
|
99
|
+
id: string;
|
|
100
|
+
source: string;
|
|
101
|
+
target: string;
|
|
102
|
+
type: string;
|
|
103
|
+
properties: Record<string, JSONValue>;
|
|
104
|
+
documentId: string;
|
|
105
|
+
documentIds?: string[];
|
|
106
|
+
};
|
|
107
|
+
export type KnowledgeGraphReadResult = {
|
|
108
|
+
entities: KnowledgeGraphReadEntity[];
|
|
109
|
+
relations: KnowledgeGraphReadRelation[];
|
|
110
|
+
truncated: boolean;
|
|
111
|
+
nextCursor?: string;
|
|
112
|
+
sources: {
|
|
113
|
+
documentId: string;
|
|
114
|
+
sourceVersion: string;
|
|
115
|
+
status: KnowledgeGraphPublicationResult['status'] | 'unavailable' | 'stale';
|
|
116
|
+
}[];
|
|
117
|
+
};
|
|
59
118
|
export declare const KnowledgeGraphRuntimeCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<KnowledgeGraphApi>;
|
|
@@ -219,6 +219,25 @@ export type KnowledgebaseReadTextResult = {
|
|
|
219
219
|
version: number;
|
|
220
220
|
}>;
|
|
221
221
|
};
|
|
222
|
+
/** Pre-split conversion evidence. Index chunk size and embedding models do not affect this view. */
|
|
223
|
+
export type KnowledgebaseReadSourceInput = KnowledgebaseReadTextInput & {
|
|
224
|
+
/** Pin all pages to the revision returned by the first page. */
|
|
225
|
+
revision?: string;
|
|
226
|
+
};
|
|
227
|
+
export type KnowledgebaseReadSourceResult = {
|
|
228
|
+
knowledgebaseId: string;
|
|
229
|
+
documentId: string;
|
|
230
|
+
/** Content identity of the complete parsed source, independent of index/document versions. */
|
|
231
|
+
revision: string;
|
|
232
|
+
sourceHash?: string | null;
|
|
233
|
+
total: number;
|
|
234
|
+
/** Complete converter blocks in source order, never vector fragments or overlapping windows. */
|
|
235
|
+
chunks: Array<{
|
|
236
|
+
id: string;
|
|
237
|
+
text: string;
|
|
238
|
+
page?: number;
|
|
239
|
+
}>;
|
|
240
|
+
};
|
|
222
241
|
export type KnowledgebaseProcessingOptionsInput = {
|
|
223
242
|
knowledgebaseId: string;
|
|
224
243
|
fileName: string;
|
|
@@ -249,6 +268,8 @@ export type KnowledgebaseProcessingOptionsResult = {
|
|
|
249
268
|
export interface KnowledgebaseDocumentsApi {
|
|
250
269
|
getProcessingOptions(input: KnowledgebaseProcessingOptionsInput): Promise<KnowledgebaseProcessingOptionsResult>;
|
|
251
270
|
readText(input: KnowledgebaseReadTextInput): Promise<KnowledgebaseReadTextResult>;
|
|
271
|
+
/** Missing/stale conversion snapshots fail explicitly; this never falls back to indexed chunks. */
|
|
272
|
+
readSource(input: KnowledgebaseReadSourceInput): Promise<KnowledgebaseReadSourceResult>;
|
|
252
273
|
listDocuments(input: KnowledgebaseListDocumentsInput): Promise<KnowledgebaseListDocumentsResult>;
|
|
253
274
|
createFolder(input: KnowledgebaseCreateFolderInput): Promise<KnowledgebaseCreateFolderResult>;
|
|
254
275
|
moveDocument(input: KnowledgebaseMoveDocumentInput): Promise<KnowledgebaseMoveDocumentResult>;
|
|
@@ -129,14 +129,19 @@ export type KnowledgebaseProvisioningSpec = {
|
|
|
129
129
|
score?: number;
|
|
130
130
|
metadataSchema?: KnowledgebaseProvisioningMetadataField[];
|
|
131
131
|
incrementalSyncEnabled?: boolean;
|
|
132
|
+
/** Set the graph switch without replacing existing graph retrieval or extraction settings. */
|
|
133
|
+
graphRag?: {
|
|
134
|
+
enabled: boolean;
|
|
135
|
+
};
|
|
132
136
|
};
|
|
133
137
|
export type KnowledgebaseEnsureInput = {
|
|
134
138
|
workspaceId: string;
|
|
135
139
|
namespace: string;
|
|
136
140
|
/**
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
141
|
+
* Fill missing embedding bindings from the current user's available Copilot provider catalog,
|
|
142
|
+
* falling back to the most recently updated ordinary knowledgebase in this workspace.
|
|
143
|
+
* Existing bindings are preserved. No provider credentials are exposed to plugins.
|
|
144
|
+
* Provisioning fails explicitly when a missing binding cannot be resolved.
|
|
140
145
|
*/
|
|
141
146
|
inheritEmbeddingModel?: boolean;
|
|
142
147
|
knowledgebases: KnowledgebaseProvisioningSpec[];
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { XpertProjectClassification } from '@xpert-ai/contracts';
|
|
1
2
|
/** Trusted server actor. View providers derive this from host context; jobs persist that actor. */
|
|
2
3
|
export interface ProjectAccessActor {
|
|
3
4
|
tenantId: string;
|
|
4
5
|
organizationId?: string | null;
|
|
5
6
|
userId: string;
|
|
6
7
|
}
|
|
7
|
-
export interface ProjectHumanAccess {
|
|
8
|
+
export interface ProjectHumanAccess extends XpertProjectClassification {
|
|
8
9
|
projectId: string;
|
|
9
10
|
role: 'owner' | 'manager' | 'editor' | 'member';
|
|
10
11
|
canManage: boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { XpertProjectTypeRef } from '@xpert-ai/contracts';
|
|
1
2
|
/** Lifecycle states that plugin-managed Projects may synchronize to the platform. */
|
|
2
3
|
export type ProjectProvisioningStatus = 'active' | 'archived';
|
|
3
4
|
/** Portable identity of one required, direct External Assistant binding. */
|
|
@@ -8,6 +9,8 @@ export type ProjectExternalAssistantExpectation = {
|
|
|
8
9
|
};
|
|
9
10
|
/** Stable identity and desired state for an idempotently provisioned Chat Project. */
|
|
10
11
|
export type ProjectEnsureInput = {
|
|
12
|
+
/** Registered application type. Omission preserves legacy unclassified callers. */
|
|
13
|
+
projectType?: XpertProjectTypeRef;
|
|
11
14
|
/** Caller-generated id reused across retries to prevent duplicate Projects. */
|
|
12
15
|
projectId: string;
|
|
13
16
|
/** @deprecated Projects no longer belong to a Workspace. Accepted only for legacy callers. */
|
|
@@ -35,6 +38,16 @@ export type ProjectEnsureResult = {
|
|
|
35
38
|
};
|
|
36
39
|
/** Host API exposed to plugins that own one-to-one business Project mappings. */
|
|
37
40
|
export interface ProjectProvisioningApi {
|
|
41
|
+
/** App-only confirmation of a pending conversation's first Project; never moves an existing binding. */
|
|
42
|
+
confirmConversation?(input: {
|
|
43
|
+
conversationId: string;
|
|
44
|
+
xpertId: string;
|
|
45
|
+
confirmationId: string;
|
|
46
|
+
name: string;
|
|
47
|
+
configuration: object;
|
|
48
|
+
}): Promise<{
|
|
49
|
+
projectId: string;
|
|
50
|
+
}>;
|
|
38
51
|
/** Create or reconcile a Chat Project without changing its caller-supplied id. */
|
|
39
52
|
ensure(input: ProjectEnsureInput): Promise<ProjectEnsureResult>;
|
|
40
53
|
/** Owner-only physical deletion of an archived plugin-bound Project and its workspace. */
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { BaseMessage } from '@langchain/core/messages';
|
|
2
|
+
import type { ToolOutputImageAttachment, ToolOutputPresentation } from '@xpert-ai/chatkit-types';
|
|
3
|
+
import type { ModelRequirements } from '../../agent/middleware/model-requirements';
|
|
4
|
+
export type { ToolOutputImageAttachment, ToolOutputPresentation } from '@xpert-ai/chatkit-types';
|
|
5
|
+
export type ToolImageModelInput = {
|
|
6
|
+
messages: BaseMessage[];
|
|
7
|
+
requirements?: ModelRequirements;
|
|
8
|
+
};
|
|
9
|
+
/** Images stay in immutable Artifacts; tool results and graph checkpoints contain references only. */
|
|
10
|
+
export interface ToolImagesApi {
|
|
11
|
+
/** Host identity, conversation and Workspace scope are bound to the current execution. */
|
|
12
|
+
save(input: {
|
|
13
|
+
buffer: Buffer;
|
|
14
|
+
mimeType: ToolOutputImageAttachment['mimeType'];
|
|
15
|
+
title: string;
|
|
16
|
+
}): Promise<ToolOutputPresentation>;
|
|
17
|
+
/**
|
|
18
|
+
* Project the current complete tool round into one outbound model request. Names identify tools
|
|
19
|
+
* whose successful result must contain an image presentation; error results remain text.
|
|
20
|
+
* Never persist the returned messages. Merge requirements into the request with mergeModelRequirements.
|
|
21
|
+
*/
|
|
22
|
+
prepareModelInput(messages: BaseMessage[], toolNames: readonly string[]): Promise<ToolImageModelInput>;
|
|
23
|
+
}
|
|
24
|
+
export declare const ToolImagesRuntimeCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<ToolImagesApi>;
|