@xpert-ai/plugin-sdk 3.33.1 → 3.35.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.
Files changed (45) hide show
  1. package/agent-results.cjs.js +2 -0
  2. package/agent-results.esm.js +1 -1
  3. package/analytics.cjs.js +87 -2
  4. package/analytics.esm.js +86 -1
  5. package/docs/artifact-types.md +30 -0
  6. package/index.cjs.js +69 -25
  7. package/index.esm.js +67 -31
  8. package/model-provider.cjs.js +13 -0
  9. package/model-provider.esm.js +11 -1
  10. package/package.json +2 -2
  11. package/results.cjs.js +8 -0
  12. package/results.esm.js +7 -1
  13. package/src/analytics.d.ts +1 -0
  14. package/src/lib/agent/runtime/dispatch.d.ts +232 -9
  15. package/src/lib/agent/runtime/execution-runner.d.ts +11 -1
  16. package/src/lib/agent/runtime/results.d.ts +17 -0
  17. package/src/lib/agent/runtime/strategy.d.ts +3 -0
  18. package/src/lib/agent/runtime/types.d.ts +2 -0
  19. package/src/lib/artifact-document/dependencies.d.ts +10 -10
  20. package/src/lib/artifact-presentation/index.d.ts +29 -11
  21. package/src/lib/artifact-type/analytics.d.ts +30 -0
  22. package/src/lib/artifact-type/definition.schema.d.ts +181 -1
  23. package/src/lib/artifact-type/index.d.ts +37 -1
  24. package/src/lib/artifact-type/version-context.d.ts +21 -0
  25. package/src/lib/content-resource/discovery.d.ts +11 -0
  26. package/src/lib/content-resource/index.d.ts +3 -0
  27. package/src/lib/data/analytics/analytics-provider.d.ts +3 -0
  28. package/src/lib/data/analytics/resource-analysis.schema.d.ts +19 -0
  29. package/src/lib/evolution/artifact-hash.d.ts +8 -0
  30. package/src/lib/evolution/index.d.ts +1 -0
  31. package/src/lib/evolution/provider.decorator.d.ts +1 -0
  32. package/src/lib/evolution/provider.registry.d.ts +2 -0
  33. package/src/lib/evolution/runtime-capability.d.ts +3 -0
  34. package/src/lib/file/file-storage/provider.interface.d.ts +24 -1
  35. package/src/lib/project-task/acceptance.d.ts +17 -0
  36. package/src/lib/project-task/index.d.ts +4 -0
  37. package/src/lib/runtime/capabilities/artifact-use-grants.d.ts +80 -0
  38. package/src/lib/runtime/capabilities/index.d.ts +3 -0
  39. package/src/lib/runtime/capabilities/plugin-test-access.d.ts +14 -0
  40. package/src/lib/runtime/capabilities/project-configuration.d.ts +164 -0
  41. package/src/lib/runtime/capabilities/project-provisioning.d.ts +9 -1
  42. package/src/lib/tool-provider/claims.d.ts +8 -0
  43. package/src/lib/tool-provider/index.d.ts +1 -0
  44. package/src/lib/tool-provider/registry.d.ts +0 -1
  45. package/src/lib/types.d.ts +5 -0
@@ -0,0 +1,164 @@
1
+ import type { IXpertTask, ProjectConfigurationOverview, ProjectConfigurationUpdate, ProjectConfigurationValues, TXpertTaskScheduleCapabilities, XpertProjectConfigurationView } from '@xpert-ai/contracts';
2
+ import type { ConnectorAuthMethodDefinition, ConnectorBinding, ConnectorRuntimeOptions, ConnectorStrategyDefinition } from '../../connector';
3
+ import type { RuntimeActor } from '../actor';
4
+ /** Supplied by the host from trusted request/execution context, never from an action/tool payload.
5
+ * Background callers restore execution identity before invoking operations that use domain services.
6
+ * assistantId retains the current Assistant-to-Project access check when invoked in its scope. */
7
+ export interface ProjectConfigurationScope {
8
+ actor: RuntimeActor;
9
+ projectId: string;
10
+ assistantId?: string;
11
+ }
12
+ export type ProjectConfigurationMemberRole = 'manager' | 'editor' | 'member';
13
+ export type ProjectConfigurationPageInput = {
14
+ page: number;
15
+ search: string;
16
+ };
17
+ export interface ProjectSkillArchive {
18
+ buffer: Buffer;
19
+ originalname?: string;
20
+ mimetype?: string;
21
+ size?: number;
22
+ }
23
+ export interface ProjectConfigurationPage {
24
+ items: {
25
+ id: string;
26
+ name: string;
27
+ description?: string;
28
+ }[];
29
+ total: number;
30
+ page: number;
31
+ }
32
+ export interface ProjectConfigurationMemberCandidates extends ProjectConfigurationPage {
33
+ canInvite: boolean;
34
+ invitations: {
35
+ id: string;
36
+ email: string;
37
+ role: ProjectConfigurationMemberRole;
38
+ status: string;
39
+ }[];
40
+ }
41
+ export type ProjectConfigurationAutomationInput = Required<Pick<IXpertTask, 'name' | 'prompt' | 'xpertId' | 'options' | 'timeZone'>> & Pick<IXpertTask, 'agentKey'> & {
42
+ taskId?: string;
43
+ runtimeState?: ProjectConfigurationValues;
44
+ };
45
+ export interface ProjectConfigurationAutomationPage {
46
+ items: Pick<IXpertTask, 'id' | 'name' | 'prompt' | 'xpertId' | 'agentKey' | 'options' | 'timeZone' | 'status' | 'scheduleDescription' | 'runAsUserId' | 'pendingRunAsUserId' | 'runtimeState'>[];
47
+ total: number;
48
+ page: number;
49
+ }
50
+ export interface ProjectConfigurationAutomationOptions {
51
+ capabilities: TXpertTaskScheduleCapabilities;
52
+ connectors: ConnectorRuntimeOptions;
53
+ }
54
+ export interface ProjectConfigurationConnectors {
55
+ bindings: ConnectorBinding[];
56
+ definitions: {
57
+ provider: string;
58
+ label: ConnectorStrategyDefinition['label'];
59
+ authMethods: ConnectorAuthMethodDefinition[];
60
+ }[];
61
+ }
62
+ export interface ProjectConfigurationConnectorAuthorization {
63
+ status: string;
64
+ authorizationUrl?: string;
65
+ stateExpiresAt?: string;
66
+ }
67
+ /** Project configuration operations shared by plugins and trusted runtime callers.
68
+ * Each call revalidates identity and domain permissions; this API does not grant machine principals
69
+ * human management or consent authority. Browser OAuth launch still needs an authenticated HTTP origin. */
70
+ export interface ProjectConfigurationApi {
71
+ getOverview(scope: ProjectConfigurationScope): Promise<ProjectConfigurationOverview>;
72
+ get(scope: ProjectConfigurationScope): Promise<XpertProjectConfigurationView>;
73
+ update(scope: ProjectConfigurationScope, input: ProjectConfigurationUpdate): Promise<XpertProjectConfigurationView>;
74
+ listAvailableAssistants(scope: ProjectConfigurationScope, input: ProjectConfigurationPageInput): Promise<ProjectConfigurationPage>;
75
+ addAssistant(scope: ProjectConfigurationScope, input: {
76
+ xpertId: string;
77
+ }): Promise<null>;
78
+ removeAssistant(scope: ProjectConfigurationScope, input: {
79
+ xpertId: string;
80
+ }): Promise<null>;
81
+ listMemberCandidates(scope: ProjectConfigurationScope, input: ProjectConfigurationPageInput): Promise<ProjectConfigurationMemberCandidates>;
82
+ addMember(scope: ProjectConfigurationScope, input: {
83
+ userId: string;
84
+ role?: ProjectConfigurationMemberRole;
85
+ }): Promise<null>;
86
+ updateMemberRole(scope: ProjectConfigurationScope, input: {
87
+ userId: string;
88
+ role: ProjectConfigurationMemberRole;
89
+ }): Promise<null>;
90
+ removeMember(scope: ProjectConfigurationScope, input: {
91
+ userId: string;
92
+ }): Promise<null>;
93
+ transferOwnership(scope: ProjectConfigurationScope, input: {
94
+ userId: string;
95
+ }): Promise<null>;
96
+ inviteMember(scope: ProjectConfigurationScope, input: {
97
+ email: string;
98
+ role: ProjectConfigurationMemberRole;
99
+ }): Promise<null>;
100
+ revokeInvitation(scope: ProjectConfigurationScope, input: {
101
+ invitationId: string;
102
+ }): Promise<null>;
103
+ listSkillCatalog(scope: ProjectConfigurationScope, input: ProjectConfigurationPageInput): Promise<ProjectConfigurationPage>;
104
+ installSkill(scope: ProjectConfigurationScope, input: {
105
+ indexId: string;
106
+ }): Promise<null>;
107
+ setSkillEnabled(scope: ProjectConfigurationScope, input: {
108
+ skillId: string;
109
+ enabled: boolean;
110
+ }): Promise<null>;
111
+ removeSkill(scope: ProjectConfigurationScope, input: {
112
+ skillId: string;
113
+ }): Promise<null>;
114
+ deleteProject(scope: ProjectConfigurationScope, input: {
115
+ name: string;
116
+ }): Promise<null>;
117
+ listAutomations(scope: ProjectConfigurationScope, input: ProjectConfigurationPageInput): Promise<ProjectConfigurationAutomationPage>;
118
+ getAutomationOptions(scope: ProjectConfigurationScope, input: {
119
+ xpertId: string;
120
+ agentKey?: string;
121
+ }): Promise<ProjectConfigurationAutomationOptions>;
122
+ saveAutomation(scope: ProjectConfigurationScope, input: ProjectConfigurationAutomationInput): Promise<null>;
123
+ pauseAutomation(scope: ProjectConfigurationScope, input: {
124
+ taskId: string;
125
+ }): Promise<null>;
126
+ resumeAutomation(scope: ProjectConfigurationScope, input: {
127
+ taskId: string;
128
+ }): Promise<null>;
129
+ deleteAutomation(scope: ProjectConfigurationScope, input: {
130
+ taskId: string;
131
+ }): Promise<null>;
132
+ proposeAutomationRunAs(scope: ProjectConfigurationScope, input: {
133
+ taskId: string;
134
+ userId: string;
135
+ }): Promise<null>;
136
+ acceptAutomationRunAs(scope: ProjectConfigurationScope, input: {
137
+ taskId: string;
138
+ }): Promise<null>;
139
+ updateAutomationConnectors(scope: ProjectConfigurationScope, input: {
140
+ taskId: string;
141
+ runtimeState: ProjectConfigurationValues;
142
+ }): Promise<null>;
143
+ listConnectors(scope: ProjectConfigurationScope): Promise<ProjectConfigurationConnectors>;
144
+ addConnector(scope: ProjectConfigurationScope, input: {
145
+ provider: string;
146
+ }): Promise<null>;
147
+ removeConnector(scope: ProjectConfigurationScope, input: {
148
+ bindingId: string;
149
+ }): Promise<null>;
150
+ getConnectorAuthorizationStatus(scope: ProjectConfigurationScope, input: {
151
+ bindingId: string;
152
+ }): Promise<ProjectConfigurationConnectorAuthorization>;
153
+ cancelConnectorAuthorization(scope: ProjectConfigurationScope, input: {
154
+ bindingId: string;
155
+ }): Promise<null>;
156
+ connectConnector(scope: ProjectConfigurationScope, input: {
157
+ bindingId: string;
158
+ authMethodId?: string;
159
+ values?: Record<string, string>;
160
+ }): Promise<ProjectConfigurationConnectorAuthorization>;
161
+ updateInstructions(scope: ProjectConfigurationScope, content: string): Promise<void>;
162
+ uploadSkill(scope: ProjectConfigurationScope, file: ProjectSkillArchive): Promise<void>;
163
+ }
164
+ export declare const ProjectConfigurationRuntimeCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<ProjectConfigurationApi>;
@@ -39,7 +39,10 @@ export type ProjectEnsureResult = {
39
39
  xpertIds: string[];
40
40
  /** Bindings for the requested role expectations, not all members. Check xpertIds before assigning an executor. */
41
41
  assistantBindings: ProjectAssistantBinding[];
42
- /** Whether this call inserted the Project or reconciled an existing one. */
42
+ /**
43
+ * `created` inserts a new Project; `updated` reuses an existing Project and ensures its content is initialized.
44
+ * `updated` does not guarantee metadata changes: direct creation retries preserve existing names and status.
45
+ */
43
46
  operation: 'created' | 'updated';
44
47
  };
45
48
  /** Host API exposed to plugins that own one-to-one business Project mappings. */
@@ -56,6 +59,11 @@ export interface ProjectProvisioningApi {
56
59
  }>;
57
60
  /** Create or reconcile a Chat Project without changing its caller-supplied id. */
58
61
  ensure(input: ProjectEnsureInput): Promise<ProjectEnsureResult>;
62
+ /** Check the permanent-deletion fence while the caller holds its business record lock, before restoring. */
63
+ assertRestorable?(input: {
64
+ projectId: string;
65
+ xpertId: string;
66
+ }): Promise<void>;
59
67
  /** Owner-only physical deletion of an archived plugin-bound Project and its workspace. */
60
68
  purge?(input: {
61
69
  projectId: string;
@@ -0,0 +1,8 @@
1
+ import type { StrategySource } from '../strategy';
2
+ import type { XpertToolProviderDescriptor } from './types';
3
+ export interface XpertToolProviderClaim {
4
+ source: StrategySource;
5
+ descriptor: XpertToolProviderDescriptor;
6
+ }
7
+ /** Component keys belong to a plugin; public strategy and Tool names retain their scope-wide claims. */
8
+ export declare function assertXpertToolProviderClaims(candidate: XpertToolProviderClaim, existing: XpertToolProviderClaim[]): void;
@@ -1,6 +1,7 @@
1
1
  export * from './types';
2
2
  export * from './decorators';
3
3
  export * from './descriptor';
4
+ export * from './claims';
4
5
  export * from './registry';
5
6
  export * from './adapters';
6
7
  export * from './coordinator';
@@ -6,5 +6,4 @@ export declare class XpertToolProviderRegistry extends BaseStrategyRegistry<Xper
6
6
  constructor(discoveryService: DiscoveryService, reflector: Reflector);
7
7
  upsert(candidate: unknown): void;
8
8
  rollback(instance: XpertToolProviderInstance): void;
9
- private assertUniqueClaims;
10
9
  }
@@ -103,6 +103,11 @@ export interface PluginContext<TConfig extends object = any> {
103
103
  app?: INestApplicationContext;
104
104
  logger: PluginLogger;
105
105
  config: TConfig;
106
+ /** Read current persisted configuration after host initialization or hot installation completes.
107
+ * No background polling or cross-call cache. Errors propagate instead of returning stale configuration.
108
+ * Optional for compatibility with older hosts; `config` remains the synchronous local snapshot.
109
+ */
110
+ readConfig?(): Promise<TConfig>;
106
111
  tenantId?: string | null;
107
112
  organizationId?: string | null;
108
113
  scopeKey?: string | null;