@xpert-ai/plugin-sdk 3.30.2 → 3.31.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.
@@ -270,7 +270,7 @@ const ProjectProvisioningRuntimeCapability = createRuntimeCapability('platform.p
270
270
  });
271
271
 
272
272
  const ProjectAccessRuntimeCapability = createRuntimeCapability('platform.project.access', {
273
- description: 'Resolve human Project membership for platform and plugin operations.'
273
+ description: 'Resolve Project membership and Assistant execution access for platform and plugin operations.'
274
274
  });
275
275
 
276
276
  const ProjectFilesRuntimeCapability = createRuntimeCapability('platform.project.files', {
@@ -268,7 +268,7 @@ const ProjectProvisioningRuntimeCapability = createRuntimeCapability('platform.p
268
268
  });
269
269
 
270
270
  const ProjectAccessRuntimeCapability = createRuntimeCapability('platform.project.access', {
271
- description: 'Resolve human Project membership for platform and plugin operations.'
271
+ description: 'Resolve Project membership and Assistant execution access for platform and plugin operations.'
272
272
  });
273
273
 
274
274
  const ProjectFilesRuntimeCapability = createRuntimeCapability('platform.project.files', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpert-ai/plugin-sdk",
3
- "version": "3.30.2",
3
+ "version": "3.31.0",
4
4
  "license": "AGPL-3.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -74,7 +74,7 @@
74
74
  },
75
75
  "dependencies": {
76
76
  "@langchain/openai": "0.6.9",
77
- "@xpert-ai/contracts": "3.30.2",
77
+ "@xpert-ai/contracts": "3.31.0",
78
78
  "express": "^4.22.1",
79
79
  "js-tiktoken": "^1.0.21"
80
80
  },
@@ -1,5 +1,5 @@
1
1
  import type { AnalyticsDefinitionAuthoring } from './analytics-authoring';
2
- import type { AnalyticsSourceRef, AnalyticsConfigurationEntry, AnalyticsBinding, AnalyticsProviderDescriptor, AnalyticsQueryRequest, AnalyticsSourceSummary, AnalyticalDataset, AnalyticsValue, JSONValue, AnalyticsDiscoveryRequest, AnalyticsDiscoveryResult } from '@xpert-ai/contracts';
2
+ import type { AnalyticsSourceRef, AnalyticsConfigurationEntry, AnalyticsBinding, AnalyticsField, AnalyticsProviderDescriptor, AnalyticsQueryRequest, AnalyticsSourceSummary, AnalyticalDataset, AnalyticsValue, JSONValue, AnalyticsDiscoveryRequest, AnalyticsDiscoveryResult } from '@xpert-ai/contracts';
3
3
  import type { DataSourceActor } from '../datasource/workbench';
4
4
  /** Host-created execution scope. Providers must not accept replacements from payload or controls. */
5
5
  export interface AnalyticsProviderContext {
@@ -21,13 +21,14 @@ export interface AnalyticsProviderContext {
21
21
  /** Provider IDs through the current call; forward to child queries for cycle/depth checks. */
22
22
  ancestry: readonly string[];
23
23
  }
24
+ /** Source-declared metadata, never inferred from names or sampled cells. */
25
+ export type AnalyticsResultColumn = {
26
+ key: string;
27
+ } & Partial<Pick<AnalyticsField, 'semanticRef' | 'logicalType' | 'role' | 'nullable' | 'label' | 'unit'>>;
24
28
  /** Native-column result before host projection; cells already use canonical AnalyticsValue encodings. */
25
29
  export interface AnalyticsProviderResult {
26
- /** Native row keys and optional exact semantic selectors; declare columns even for zero rows. */
27
- columns: Array<{
28
- key: string;
29
- semanticRef?: string;
30
- }>;
30
+ /** Declare columns even for zero rows. Optional metadata supports authoring; it never overrides Binding.output. */
31
+ columns: AnalyticsResultColumn[];
31
32
  /** Keys match columns[].key; the host maps them to Binding.output.fields[].id without coercion. */
32
33
  rows: Array<Record<string, AnalyticsValue>>;
33
34
  /** Describe the actual result scope/counts; successful transport does not imply a complete result. */
@@ -48,6 +48,8 @@ export interface ProjectPipelineNodeHandler {
48
48
  /** The host binds the authorized published Assistant, Project and stable runtime IDs. */
49
49
  export interface ProjectPipelineAssistantContext extends ProjectPipelineOperationContext {
50
50
  executor: {
51
+ /** Persisted execution actor, independent of the business run owner. */
52
+ userId?: string;
51
53
  xpertId: string;
52
54
  workspaceId: string;
53
55
  publishedVersion: string;
@@ -12,17 +12,17 @@ export type AssistantMiddlewareAccessScope = {
12
12
  projectId: string;
13
13
  };
14
14
  export interface AssistantMiddlewareAccessApi {
15
- /** Authorize an Assistant capability entry on every invocation, without caching grants.
16
- * Standalone access uses the Assistant catalog policy; Project use requires current
17
- * membership and an Assistant binding instead. Both require active organization membership.
18
- * View providers needing configuration/runtime should use ViewMiddlewareRuntimeCapability.
19
- * This does not grant file/resource operations. Resource ACLs and collaboration delivery
20
- * retain their own checks and must not depend on this middleware feature remaining installed.
21
- */
15
+ /** Live authorization for the exact published Assistant and middleware; resource operations retain their own ACLs. */
22
16
  assertAccess(input: AssistantMiddlewareRequirement & {
23
17
  actor: OrganizationRuntimeActor;
24
18
  assistantId: string;
25
19
  scope: AssistantMiddlewareAccessScope;
26
20
  }): Promise<void>;
21
+ /** Execute under the bound Assistant account, subject to live actor and middleware authorization. */
22
+ runAsAssistant<T>(input: AssistantMiddlewareRequirement & {
23
+ actor: OrganizationRuntimeActor;
24
+ assistantId: string;
25
+ scope: AssistantMiddlewareAccessScope;
26
+ }, work: () => Promise<T>): Promise<T>;
27
27
  }
28
28
  export declare const AssistantMiddlewareAccessRuntimeCapability: import("../../core/runtime-capability").RuntimeCapabilityKey<AssistantMiddlewareAccessApi>;
@@ -4,13 +4,13 @@ export type ProjectAccessActor = RuntimeActor;
4
4
  export interface ProjectHumanAccess extends XpertProjectClassification {
5
5
  projectId: string;
6
6
  name?: string;
7
- role: 'owner' | 'manager' | 'editor' | 'member';
7
+ role: 'owner' | 'manager' | 'editor' | 'member' | 'assistant';
8
8
  canManage: boolean;
9
9
  archived: boolean;
10
10
  /** Explicit Project bindings, for plugins that choose to use assignment as business policy. */
11
11
  assistantIds?: string[];
12
12
  }
13
- /** Project membership and explicit Assistant bindings. Feature activation remains Assistant-owned. */
13
+ /** Project membership, Assistant execution access and explicit Assistant bindings. Feature activation remains Assistant-owned. */
14
14
  export interface ProjectAccessApi {
15
15
  listReadable(input: {
16
16
  actor: ProjectAccessActor;
@@ -15,6 +15,7 @@ export type TWorkflowTriggerParams<T> = {
15
15
  tenantId: string;
16
16
  organizationId: string | null;
17
17
  userId?: string;
18
+ assistantUserId?: string;
18
19
  workspaceId?: string;
19
20
  };
20
21
  /**