@xpert-ai/plugin-sdk 3.26.2 → 3.28.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 (67) hide show
  1. package/artifact-document.cjs.js +55 -16
  2. package/artifact-document.esm.js +53 -17
  3. package/collaboration-client.cjs.js +31 -5
  4. package/collaboration-client.esm.js +31 -5
  5. package/data-workbench.cjs.js +4 -2
  6. package/data-workbench.esm.js +4 -2
  7. package/docs/artifact-documents.md +8 -2
  8. package/docs/en/runtime-capabilities.md +103 -0
  9. package/index.cjs.js +479 -70
  10. package/index.esm.js +461 -73
  11. package/model-provider.cjs.js +17 -1
  12. package/model-provider.esm.js +15 -2
  13. package/package.json +2 -2
  14. package/src/artifact-document.d.ts +1 -0
  15. package/src/index.d.ts +2 -0
  16. package/src/lib/agent/handoff/types.d.ts +5 -0
  17. package/src/lib/agent/middleware/capabilities/assistant-task.d.ts +6 -1
  18. package/src/lib/agent/middleware/runtime.d.ts +2 -0
  19. package/src/lib/agent/runtime/capability.d.ts +4 -0
  20. package/src/lib/agent/runtime/cli-model-profile.d.ts +1 -1
  21. package/src/lib/agent/runtime/execution-runner.d.ts +11 -0
  22. package/src/lib/agent/runtime/index.d.ts +2 -0
  23. package/src/lib/agent/runtime/managed.d.ts +94 -0
  24. package/src/lib/agent/runtime/process-supervisor.d.ts +1 -0
  25. package/src/lib/agent/runtime/strategy.d.ts +14 -0
  26. package/src/lib/agent/runtime/types.d.ts +30 -1
  27. package/src/lib/ai-model/native-model.d.ts +5 -1
  28. package/src/lib/artifact-document/host.d.ts +3 -0
  29. package/src/lib/artifact-document/network.d.ts +21 -0
  30. package/src/lib/artifact-document/runtime.d.ts +2 -1
  31. package/src/lib/assistant-capability/index.d.ts +3 -0
  32. package/src/lib/assistant-capability/middleware.d.ts +10 -0
  33. package/src/lib/collaboration/types.d.ts +12 -1
  34. package/src/lib/connector/document-source.d.ts +31 -0
  35. package/src/lib/connector/documents.d.ts +38 -0
  36. package/src/lib/connector/index.d.ts +1 -0
  37. package/src/lib/connector/strategy.interface.d.ts +3 -0
  38. package/src/lib/content-resource/catalog.d.ts +88 -0
  39. package/src/lib/content-resource/document.d.ts +142 -0
  40. package/src/lib/content-resource/editor-compatibility.d.ts +3 -0
  41. package/src/lib/content-resource/editor.d.ts +105 -0
  42. package/src/lib/content-resource/index.d.ts +94 -0
  43. package/src/lib/content-resource/reference.d.ts +38 -0
  44. package/src/lib/data/datasource/workbench-adapter.d.ts +5 -3
  45. package/src/lib/data/datasource/workbench-sql.d.ts +0 -4
  46. package/src/lib/execution-control/context.d.ts +7 -0
  47. package/src/lib/execution-control/index.d.ts +2 -0
  48. package/src/lib/managed-queue/index.d.ts +12 -0
  49. package/src/lib/project-pipeline/contribution-failure.d.ts +17 -0
  50. package/src/lib/project-pipeline/registry.d.ts +16 -1
  51. package/src/lib/runtime/actor.d.ts +10 -0
  52. package/src/lib/runtime/capabilities/artifact-drafts.d.ts +10 -1
  53. package/src/lib/runtime/capabilities/artifacts.d.ts +5 -0
  54. package/src/lib/runtime/capabilities/assistant-middleware-access.d.ts +28 -0
  55. package/src/lib/runtime/capabilities/index.d.ts +4 -0
  56. package/src/lib/runtime/capabilities/mcp-client-runtime.d.ts +2 -0
  57. package/src/lib/runtime/capabilities/project-access.d.ts +10 -7
  58. package/src/lib/runtime/capabilities/project-files.d.ts +40 -0
  59. package/src/lib/runtime/capabilities/project-knowledge.d.ts +14 -0
  60. package/src/lib/runtime/capabilities/project-provisioning.d.ts +6 -0
  61. package/src/lib/runtime/capabilities/sandbox-jobs.d.ts +12 -3
  62. package/src/lib/runtime/capabilities/workspace-files.d.ts +2 -0
  63. package/src/lib/sandbox/file-edit-command.d.ts +2 -0
  64. package/src/lib/sandbox/file-edit-diff.d.ts +1 -0
  65. package/src/lib/sandbox/protocol.d.ts +13 -1
  66. package/src/lib/sandbox/runtime-provider.d.ts +12 -0
  67. package/src/lib/view-extension/middleware-runtime.d.ts +2 -3
@@ -1,3 +1,4 @@
1
+ import type { ConnectorDocumentSource } from './document-source';
1
2
  import type { I18nText, IconDefinition } from '@xpert-ai/contracts';
2
3
  export type RuntimeI18nText = I18nText;
3
4
  export type RuntimeCapabilityIcon = IconDefinition;
@@ -413,6 +414,8 @@ export type ConnectorAuthorizationPollResult = {
413
414
  metadata?: Record<string, unknown>;
414
415
  };
415
416
  export interface ConnectorStrategyRuntime {
417
+ /** Optional read-only document adapter, independent of knowledge ingestion and remote editing. */
418
+ documents?: ConnectorDocumentSource;
416
419
  definition: ConnectorStrategyDefinition;
417
420
  connect?(input: ConnectorConnectInput): Promise<ConnectorConnectResult>;
418
421
  exchangeAuthorizationCode?(input: ConnectorAuthorizationCodeInput): Promise<ConnectorCredential>;
@@ -0,0 +1,88 @@
1
+ import type { ContentCatalogItem, ContentResourceSnapshot, ContentTypeImplementation, ContentSearchProjection } from '@xpert-ai/contracts';
2
+ import type { ContentDocumentScope } from './document';
3
+ import type { ContentResourceReference, ContentSourceInput } from './index';
4
+ export type ContentResourceMutation = {
5
+ action: 'rename';
6
+ title: string;
7
+ } | {
8
+ action: 'move';
9
+ rootPath: string;
10
+ } | {
11
+ action: 'trash' | 'restore';
12
+ } | {
13
+ action: 'duplicate';
14
+ requestId: string;
15
+ title: string;
16
+ };
17
+ /** Plugins retain their native model and ACL. Discovery is scoped and paginated, never a grant. */
18
+ export interface ContentCatalogProvider {
19
+ readonly types: ContentTypeImplementation[];
20
+ discover(scope: ContentDocumentScope & {
21
+ cursor?: string;
22
+ }): Promise<{
23
+ resourceIds: string[];
24
+ nextCursor?: string;
25
+ }>;
26
+ describe(input: ContentSourceInput): Promise<ContentResourceSnapshot>;
27
+ /** Optional safe text extractor. Must read the requested revision or reject a concurrent change. */
28
+ extract?(input: ContentSourceInput & {
29
+ expectedRevision: string;
30
+ }): Promise<ContentSearchProjection>;
31
+ create(input: ContentDocumentScope & {
32
+ implementationKey: string;
33
+ requestId: string;
34
+ title: string;
35
+ templateId?: string;
36
+ }): Promise<ContentResourceReference>;
37
+ /** Idempotent repair of derived files only; must never overwrite newer native content. */
38
+ reconcile?(input: ContentSourceInput): Promise<void>;
39
+ /** Optional project-local derived index consumer. Called by durable reconciliation,
40
+ * including tombstones; must revalidate revision and never change the resource. */
41
+ onResourceReconciled?(input: ContentDocumentScope & {
42
+ item: ContentCatalogItem;
43
+ }): Promise<void>;
44
+ mutate?(input: ContentSourceInput & {
45
+ expectedRevision: string;
46
+ change: ContentResourceMutation;
47
+ }): Promise<ContentResourceReference>;
48
+ }
49
+ export interface ContentCatalogApi {
50
+ types(scope: ContentDocumentScope): Promise<Array<ContentTypeImplementation & {
51
+ providerKey: string;
52
+ }>>;
53
+ /** Reconciles registered providers before listing. The caller may continue with the returned cursor. */
54
+ list(scope: ContentDocumentScope & {
55
+ excludedProviderKeys?: string[];
56
+ contentIds?: string[];
57
+ typeId?: string;
58
+ search?: string;
59
+ deleted?: boolean;
60
+ offset?: number;
61
+ limit?: number;
62
+ }): Promise<{
63
+ items: ContentCatalogItem[];
64
+ hasMore: boolean;
65
+ }>;
66
+ register(input: ContentDocumentScope & {
67
+ source: ContentResourceReference;
68
+ }): Promise<ContentCatalogItem>;
69
+ get(input: ContentDocumentScope & {
70
+ contentId: string;
71
+ }): Promise<ContentCatalogItem>;
72
+ projectText(input: ContentDocumentScope & {
73
+ contentId: string;
74
+ expectedRevision: string;
75
+ }): Promise<ContentSearchProjection | null>;
76
+ create(input: ContentDocumentScope & {
77
+ providerKey: string;
78
+ implementationKey: string;
79
+ requestId: string;
80
+ title: string;
81
+ templateId?: string;
82
+ }): Promise<ContentCatalogItem>;
83
+ mutate(input: ContentDocumentScope & {
84
+ contentId: string;
85
+ expectedRevision: string;
86
+ change: ContentResourceMutation;
87
+ }): Promise<ContentCatalogItem>;
88
+ }
@@ -0,0 +1,142 @@
1
+ import type { ContentDocumentBlock, ContentDocumentDescriptor, ContentDocumentRevision, ContentDocumentProposal, TextContentEditorRegistration, ContentDocumentComment, ContentPageHierarchy } from '@xpert-ai/contracts';
2
+ import type { CollaborationSessionDescriptor } from '../collaboration/types';
3
+ import type { ContentActor, ContentResourceReference } from './index';
4
+ export type ContentDocumentScope = {
5
+ actor: ContentActor;
6
+ projectId: string;
7
+ assistantId?: string;
8
+ };
9
+ /** resourceId identifies a platform ContentDocument. Source hooks use ContentSourceInput.sourceResourceId. */
10
+ export type ContentDocumentInput = ContentDocumentScope & {
11
+ resourceId: string;
12
+ };
13
+ export type ContentLocationChangeInput = ContentDocumentScope & {
14
+ source: ContentResourceReference;
15
+ path: string;
16
+ destination: string;
17
+ title: string;
18
+ parentResourceId: string | null;
19
+ deleted: boolean;
20
+ expectedSourceVersion: number;
21
+ };
22
+ export type ContentTextPatch = {
23
+ blockId: string;
24
+ before: string;
25
+ after: string;
26
+ expectedSequence: number;
27
+ epoch: number;
28
+ mutationId: string;
29
+ };
30
+ export type ContentDocumentState = {
31
+ document: ContentDocumentDescriptor;
32
+ stateBase64: string;
33
+ markdown: string;
34
+ blocks: ContentDocumentBlock[];
35
+ canWrite: boolean;
36
+ externalChange: boolean;
37
+ };
38
+ export interface ContentDocumentModel {
39
+ readonly descriptor: TextContentEditorRegistration;
40
+ /** Explicit, lossless upgrade only. Throw for unsupported source versions; never guess from content. */
41
+ upgrade?(stateBase64: string, fromSchemaVersion: number): string;
42
+ initialize(markdown: string, anchors?: Array<{
43
+ id: string;
44
+ text: string;
45
+ }>): string;
46
+ validate(stateBase64: string): void;
47
+ read(stateBase64: string): {
48
+ markdown: string;
49
+ blocks: ContentDocumentBlock[];
50
+ };
51
+ patch(stateBase64: string, patch: Pick<ContentTextPatch, 'blockId' | 'before' | 'after'>): string;
52
+ }
53
+ /** Callers supply only server-authenticated scope. Each operation rechecks current resource access. */
54
+ export interface ContentDocumentsApi {
55
+ /** Provider-owned logical hierarchy; file locations and project permissions remain unchanged. */
56
+ hierarchy(input: ContentDocumentInput): Promise<ContentPageHierarchy>;
57
+ /** Retry with the same requestId/title after an unknown outcome; creates exactly one independent file. */
58
+ createChild(input: ContentDocumentInput & {
59
+ title: string;
60
+ requestId: string;
61
+ }): Promise<ContentDocumentDescriptor>;
62
+ /** Recent documents visible to the caller in the current project, limited to 100. */
63
+ list(input: ContentDocumentScope & {
64
+ modelKey: string;
65
+ }): Promise<ContentDocumentDescriptor[]>;
66
+ /** Durable move/trash/restore; freezes rooms before filesystem mutation and projects metadata after commit. */
67
+ move(input: ContentLocationChangeInput): Promise<void>;
68
+ validateImport(input: ContentDocumentScope & {
69
+ modelKey: string;
70
+ markdown: string;
71
+ }): Promise<void>;
72
+ register(input: ContentDocumentScope & {
73
+ resourceId: string;
74
+ path: string;
75
+ title: string;
76
+ modelKey: string;
77
+ source: ContentResourceReference;
78
+ anchors?: Array<{
79
+ id: string;
80
+ text: string;
81
+ }>;
82
+ }): Promise<ContentDocumentDescriptor>;
83
+ get(input: ContentDocumentInput): Promise<ContentDocumentState>;
84
+ session(input: ContentDocumentInput & {
85
+ schemaVersion: number;
86
+ }): Promise<ContentDocumentState & {
87
+ session: CollaborationSessionDescriptor;
88
+ }>;
89
+ update(input: ContentDocumentInput & {
90
+ epoch: number;
91
+ schemaVersion: number;
92
+ updateBase64: string;
93
+ }): Promise<{
94
+ sequenceNumber: number;
95
+ materializationStatus: 'ready' | 'pending' | 'failed';
96
+ }>;
97
+ history(input: ContentDocumentInput): Promise<ContentDocumentRevision[]>;
98
+ preview(input: ContentDocumentInput & {
99
+ revisionId: string;
100
+ }): Promise<{
101
+ revision: ContentDocumentRevision;
102
+ markdown: string;
103
+ }>;
104
+ checkpoint(input: ContentDocumentInput & {
105
+ label: string;
106
+ }): Promise<ContentDocumentRevision>;
107
+ propose(input: ContentDocumentInput & ContentTextPatch): Promise<ContentDocumentProposal>;
108
+ proposals(input: ContentDocumentInput): Promise<ContentDocumentProposal[]>;
109
+ decide(input: ContentDocumentInput & {
110
+ proposalId: string;
111
+ accept: boolean;
112
+ }): Promise<ContentDocumentProposal>;
113
+ comments(input: ContentDocumentInput): Promise<ContentDocumentComment[]>;
114
+ comment(input: ContentDocumentInput & {
115
+ body: string;
116
+ blockId: string | null;
117
+ }): Promise<ContentDocumentComment>;
118
+ resolveComment(input: ContentDocumentInput & {
119
+ commentId: string;
120
+ resolved: boolean;
121
+ }): Promise<ContentDocumentComment>;
122
+ restore(input: ContentDocumentInput & {
123
+ revisionId: string;
124
+ expectedSequence: number;
125
+ epoch: number;
126
+ }): Promise<ContentDocumentDescriptor>;
127
+ reconcile(input: ContentDocumentInput & {
128
+ choice: 'file' | 'document';
129
+ expectedHash: string;
130
+ expectedSequence: number;
131
+ epoch: number;
132
+ }): Promise<ContentDocumentDescriptor>;
133
+ setDeleted(input: ContentDocumentInput & {
134
+ deleted: boolean;
135
+ }): Promise<void>;
136
+ /** File moves retain resource identity; source authorization must already reflect the new path. */
137
+ relocate(input: ContentDocumentInput & {
138
+ path: string;
139
+ title: string;
140
+ }): Promise<void>;
141
+ }
142
+ export declare const ContentDocumentsRuntimeCapability: import("../core/runtime-capability").RuntimeCapabilityKey<ContentDocumentsApi>;
@@ -0,0 +1,3 @@
1
+ import type { ContentModelIdentity, ResourceContentEditorRegistration } from '@xpert-ai/contracts';
2
+ /** Matching semantic type alone never grants a writer access to an incompatible native model. */
3
+ export declare function supportsContentModel(editor: ResourceContentEditorRegistration, model: ContentModelIdentity, access: 'view' | 'edit'): boolean;
@@ -0,0 +1,105 @@
1
+ import { DiscoveryService, Reflector } from '@nestjs/core';
2
+ import type { ContentEditorRegistration, FileContentEditorRegistration, ResourceContentEditorRegistration } from '@xpert-ai/contracts';
3
+ import { BaseStrategyRegistry } from '../strategy';
4
+ import type { ContentDocumentModel, ContentDocumentScope } from './document';
5
+ import type { ContentResourceReference, ContentSourceInput } from './index';
6
+ export { supportsContentModel } from './editor-compatibility';
7
+ /** File codecs expose no cells, blocks or plugin-specific edit operations to the platform. */
8
+ export interface ContentFileEditor {
9
+ readonly descriptor: FileContentEditorRegistration;
10
+ create(): Promise<Buffer>;
11
+ validateFile(buffer: Buffer): Promise<void>;
12
+ }
13
+ export interface ContentResourceEditorImplementation {
14
+ readonly descriptor: ResourceContentEditorRegistration;
15
+ }
16
+ export type IContentEditorProvider = ContentDocumentModel | ContentFileEditor | ContentResourceEditorImplementation;
17
+ export declare function isTextContentEditor(provider: IContentEditorProvider): provider is ContentDocumentModel;
18
+ export declare function isFileContentEditor(provider: IContentEditorProvider): provider is ContentFileEditor;
19
+ export declare function isResourceContentEditor(provider: IContentEditorProvider): provider is ContentResourceEditorImplementation;
20
+ export declare const ContentEditorProvider: (key: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
21
+ export declare class ContentEditorRegistry extends BaseStrategyRegistry<IContentEditorProvider> {
22
+ constructor(discovery: DiscoveryService, reflector: Reflector);
23
+ getTextModel(key: string, organizationId: string): ContentDocumentModel;
24
+ }
25
+ export interface ContentEditorFile {
26
+ editorKey: string;
27
+ projectId: string;
28
+ path: string;
29
+ title: string;
30
+ }
31
+ /** Resource owner supplies current identity/location and owns atomic versions, independent of format. */
32
+ export interface ContentResourceEditor {
33
+ describe(input: ContentSourceInput): Promise<ContentEditorFile>;
34
+ files?: {
35
+ read(input: ContentSourceInput): Promise<{
36
+ buffer: Buffer;
37
+ revision: string;
38
+ }>;
39
+ write(input: ContentSourceInput & {
40
+ buffer: Buffer;
41
+ expectedRevision: string;
42
+ }): Promise<{
43
+ revision: string;
44
+ }>;
45
+ };
46
+ }
47
+ export type ContentEditorInput = ContentDocumentScope & {
48
+ source: ContentResourceReference;
49
+ editorKey?: string;
50
+ };
51
+ export type ContentEditorPreferenceScope = 'resource' | 'project' | 'organization';
52
+ export interface ContentEditorPreferenceState {
53
+ scope: ContentEditorPreferenceScope;
54
+ editorKey: string | null;
55
+ revision: number;
56
+ canSet: boolean;
57
+ }
58
+ export interface ContentEditorResolution {
59
+ registration: ContentEditorRegistration;
60
+ file?: ContentEditorFile;
61
+ resource?: import('@xpert-ai/contracts').ContentCatalogItem;
62
+ canWrite: boolean;
63
+ viewKey: string;
64
+ selectionId?: string;
65
+ parameters?: {
66
+ contentProvider: string;
67
+ contentId?: string;
68
+ contentTitle?: string;
69
+ contentEditor?: string;
70
+ };
71
+ editors?: ResourceContentEditorRegistration[];
72
+ }
73
+ /** Trusted scope only. Every operation checks Project, Assistant binding and resource permissions. */
74
+ export interface ContentEditorsApi {
75
+ preferences(input: ContentDocumentScope & {
76
+ contentId: string;
77
+ }): Promise<ContentEditorPreferenceState[]>;
78
+ setPreference(input: ContentDocumentScope & {
79
+ contentId: string;
80
+ scope: ContentEditorPreferenceScope;
81
+ editorKey: string | null;
82
+ expectedRevision: number;
83
+ }): Promise<ContentEditorPreferenceState>;
84
+ list(scope: ContentDocumentScope): Promise<ContentEditorRegistration[]>;
85
+ /** Prepare/validate bytes; does not create a resource or grant access to a destination. */
86
+ prepare(scope: ContentDocumentScope & {
87
+ editorKey: string;
88
+ buffer?: Buffer;
89
+ }): Promise<{
90
+ registration: FileContentEditorRegistration;
91
+ buffer: Buffer;
92
+ }>;
93
+ resolve(input: ContentEditorInput): Promise<ContentEditorResolution>;
94
+ read(input: ContentEditorInput): Promise<ContentEditorResolution & {
95
+ buffer: Buffer;
96
+ revision: string;
97
+ }>;
98
+ write(input: ContentEditorInput & {
99
+ buffer: Buffer;
100
+ expectedRevision: string;
101
+ }): Promise<{
102
+ revision: string;
103
+ }>;
104
+ }
105
+ export declare const ContentEditorsRuntimeCapability: import("../core/runtime-capability").RuntimeCapabilityKey<ContentEditorsApi>;
@@ -0,0 +1,94 @@
1
+ import type { ContentReferenceProvider } from './reference';
2
+ import { DiscoveryService, Reflector } from '@nestjs/core';
3
+ import { BaseStrategyRegistry } from '../strategy';
4
+ import type { OrganizationRuntimeActor } from '../runtime/actor';
5
+ export type ContentActor = OrganizationRuntimeActor;
6
+ export interface ContentPrincipal extends ContentActor {
7
+ groupIds: string[];
8
+ }
9
+ export type ContentOperation = 'read' | 'comment' | 'write' | 'manage';
10
+ export interface ContentResourceReference {
11
+ providerKey: string;
12
+ resourceId: string;
13
+ }
14
+ export interface ContentResourceRequest extends ContentResourceReference {
15
+ actor: ContentActor;
16
+ operation: ContentOperation;
17
+ /** Relative immutable file path. Providers must validate its owning item. */
18
+ filePath?: string;
19
+ }
20
+ export interface ContentResourceDescriptor extends ContentResourceReference {
21
+ title: string;
22
+ role: string;
23
+ canWrite: boolean;
24
+ canManage: boolean;
25
+ }
26
+ /** Source hook scope uses the provider's identifier; it is never a platform document id. */
27
+ export type ContentSourceInput = import('./document').ContentDocumentScope & {
28
+ sourceResourceId: string;
29
+ };
30
+ export interface ContentPageProvider {
31
+ pageHierarchy(input: ContentSourceInput): Promise<import('@xpert-ai/contracts').ContentPageHierarchy>;
32
+ /** Retry requestId after unknown outcomes. Return the registered platform document id. */
33
+ createChildPage(input: ContentSourceInput & {
34
+ title: string;
35
+ requestId: string;
36
+ }): Promise<{
37
+ documentId: string;
38
+ }>;
39
+ }
40
+ export interface ContentPublicationObserver {
41
+ /** Retryable projection: compare the supplied head before updating derived data. */
42
+ onDocumentPublished(input: ContentSourceInput & {
43
+ path: string;
44
+ hash: string;
45
+ revisionId: string;
46
+ sequence: number;
47
+ }): Promise<void>;
48
+ }
49
+ export interface ContentLocationProvider {
50
+ validateLocationChange(input: import('./document').ContentLocationChangeInput): Promise<void>;
51
+ onLocationPrepared?(input: import('./document').ContentLocationChangeInput & {
52
+ operationId: string;
53
+ }): Promise<void>;
54
+ onLocationChanged(input: import('./document').ContentLocationChangeInput & {
55
+ operationId: string;
56
+ }): Promise<void>;
57
+ }
58
+ /** Resource authorization is mandatory. Content extensions are explicitly composed, never inferred. */
59
+ export interface IContentResourceProvider {
60
+ readonly title: string;
61
+ authorize(input: ContentResourceRequest & {
62
+ principal: ContentPrincipal;
63
+ }): Promise<ContentResourceDescriptor>;
64
+ readonly editor?: import('./editor').ContentResourceEditor;
65
+ readonly references?: ContentReferenceProvider;
66
+ readonly pages?: ContentPageProvider;
67
+ readonly publication?: ContentPublicationObserver;
68
+ readonly locations?: ContentLocationProvider;
69
+ readonly catalog?: import('./catalog').ContentCatalogProvider;
70
+ }
71
+ export declare const CONTENT_RESOURCE_PROVIDER = "XPERT_CONTENT_RESOURCE_PROVIDER";
72
+ export declare const ContentResourceProvider: (key: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
73
+ export declare class ContentResourceProviderRegistry extends BaseStrategyRegistry<IContentResourceProvider> {
74
+ constructor(discovery: DiscoveryService, reflector: Reflector);
75
+ }
76
+ export interface ContentIdentitiesApi {
77
+ /** Checks current active organization membership, then resolves current groups. */
78
+ principal(actor: ContentActor): Promise<ContentPrincipal>;
79
+ directory(actor: ContentActor, query: string): Promise<Array<{
80
+ id: string;
81
+ type: 'user' | 'group';
82
+ label: string;
83
+ }>>;
84
+ }
85
+ export interface ContentResourcesApi {
86
+ readonly identities: ContentIdentitiesApi;
87
+ authorize(input: ContentResourceRequest): Promise<ContentResourceDescriptor>;
88
+ readonly catalog: import('./catalog').ContentCatalogApi;
89
+ }
90
+ export declare const ContentResourcesRuntimeCapability: import("../core/runtime-capability").RuntimeCapabilityKey<ContentResourcesApi>;
91
+ export * from './document';
92
+ export * from './reference';
93
+ export * from './editor';
94
+ export * from './catalog';
@@ -0,0 +1,38 @@
1
+ import type { ContentReferenceEntry, ContentReferencePage, ContentReferenceTarget } from '@xpert-ai/contracts';
2
+ import type { ContentSourceInput } from './index';
3
+ import type { ContentDocumentInput } from './document';
4
+ import type { WorkspacePortableFileReference } from '../runtime/capabilities/workspace-files';
5
+ export type ContentReferenceQuery = {
6
+ kind: ContentReferenceTarget['kind'];
7
+ query: string;
8
+ cursor?: string;
9
+ pageSize: number;
10
+ };
11
+ export type ContentReferenceUpload = {
12
+ kind: 'image' | 'file';
13
+ fileName: string;
14
+ mimeType: string;
15
+ buffer: Buffer;
16
+ };
17
+ export type ContentReferenceFile = {
18
+ reference: WorkspacePortableFileReference;
19
+ fileName: string;
20
+ mimeType: string;
21
+ size?: number;
22
+ };
23
+ /** Optional source-provider hooks use the containing document's SOURCE id, not its platform id. */
24
+ export interface ContentReferenceProvider {
25
+ listReferences?(input: ContentSourceInput & ContentReferenceQuery): Promise<ContentReferencePage>;
26
+ uploadReference?(input: ContentSourceInput & ContentReferenceUpload): Promise<ContentReferenceEntry>;
27
+ resolveReference?(input: ContentSourceInput & {
28
+ target: ContentReferenceTarget;
29
+ }): Promise<ContentReferenceFile>;
30
+ }
31
+ export interface ContentReferencesApi {
32
+ list(input: ContentDocumentInput & ContentReferenceQuery): Promise<ContentReferencePage>;
33
+ upload(input: ContentDocumentInput & ContentReferenceUpload): Promise<ContentReferenceEntry>;
34
+ resolve(input: ContentDocumentInput & {
35
+ target: ContentReferenceTarget;
36
+ }): Promise<ContentReferenceFile>;
37
+ }
38
+ export declare const ContentReferencesRuntimeCapability: import("../core/runtime-capability").RuntimeCapabilityKey<ContentReferencesApi>;
@@ -1,8 +1,10 @@
1
1
  /**
2
2
  * Why this exists: existing SQL Workbench plugins share this SDK implementation.
3
- * Metadata and transaction SQL still couple it to PostgreSQL/MySQL/Doris.
4
- * TODO: delegate dialect behavior to plugin-owned strategies behind DatabaseWorkbenchAdapter.
5
- * Keep host authorization/execution limits and generic Dataset/Binding independent of dialects.
3
+ * Validation, quoting, pagination, metadata and transaction SQL couple it to PostgreSQL/MySQL/Doris.
4
+ * TODO: move those behaviors into plugin-owned implementations of DatabaseWorkbenchAdapter;
5
+ * retain SDK interfaces/result types and dialect-independent execution helpers for reuse.
6
+ * Migrate existing callers with equivalent read-only/security tests before removing legacy guards.
7
+ * Host authorization/execution limits and generic Dataset/Binding must remain independent of dialects.
6
8
  */
7
9
  import type { DatabaseCapabilities, DatabaseEngine, DatabaseImportInput, DatabaseImportReceipt, DatabaseLocation, DatabaseObjectDetail, DatabaseObjectPage, DatabaseObjectRef, DatabaseQueryInput, DatabaseResult, DatabaseValue, DatabaseWorkbenchAdapter } from './workbench';
8
10
  export interface WorkbenchTransport {
@@ -1,7 +1,3 @@
1
- /** Invariants: comments/literals are lexed, never stripped with a keyword regex.
2
- * This guard is defense in depth; the database principal remains an authority boundary.
3
- * Unrecognized statements fail closed. Driver multi-statements stay disabled.
4
- */
5
1
  export interface SqlStatement {
6
2
  sql: string;
7
3
  words: string[];
@@ -0,0 +1,7 @@
1
+ import type { TaskControlRef, TaskControlIntent } from '@xpert-ai/contracts';
2
+ /** A handler may check control at a safe boundary; abort alone is not an exit receipt. */
3
+ export interface TaskControlContext {
4
+ reference: TaskControlRef;
5
+ signal: AbortSignal;
6
+ desired(): Promise<TaskControlIntent>;
7
+ }
@@ -0,0 +1,2 @@
1
+ export type { TaskControlRef, TaskControlPolicy, TaskControlIntent, TaskControlKind, TaskControlState } from '@xpert-ai/contracts';
2
+ export * from './context';
@@ -1,7 +1,10 @@
1
+ import type { TaskControlContext, TaskControlPolicy } from '../execution-control';
1
2
  export declare const MANAGED_QUEUE_SERVICE_TOKEN = "XPERT_MANAGED_QUEUE_SERVICE";
2
3
  export declare const MANAGED_QUEUE_HANDLER_REGISTRY_TOKEN = "XPERT_MANAGED_QUEUE_HANDLER_REGISTRY";
3
4
  export declare const PLUGIN_JOB_PROCESSOR_METADATA = "XPERT_PLUGIN_JOB_PROCESSOR_METADATA";
4
5
  export type PluginJobProcessorOptions = {
6
+ /** Explicit handler compatibility contract for controlled jobs; not a package version. */
7
+ controlContract?: string;
5
8
  pluginName: string;
6
9
  queueName?: string;
7
10
  queue?: string;
@@ -10,6 +13,7 @@ export type PluginJobProcessorOptions = {
10
13
  concurrency?: number;
11
14
  };
12
15
  export type PluginJobProcessorMetadata = {
16
+ controlContract?: string;
13
17
  pluginName: string;
14
18
  queueName: string;
15
19
  jobName: string;
@@ -42,6 +46,12 @@ export type ManagedQueueRedis = {
42
46
  eval(script: string, numKeys: number, ...args: Array<string | number>): Promise<unknown>;
43
47
  };
44
48
  export type ManagedQueueEnqueueInput<TPayload = unknown> = {
49
+ /** Trusted producer lifecycle policy; omission inherits an active host control scope. */
50
+ /** Explicitly enroll work in the current host task context; omitted retains the existing independent queue lifecycle. */
51
+ controlPolicy?: TaskControlPolicy;
52
+ /** Required when enrolling a new controlled job. Must match the registered handler. */
53
+ controlContract?: string;
54
+ drainOnPause?: boolean;
45
55
  pluginName: string;
46
56
  queueName: string;
47
57
  jobName: string;
@@ -84,6 +94,7 @@ export type ManagedQueueJob<TPayload = unknown> = {
84
94
  updateData(data: TPayload): Promise<void>;
85
95
  };
86
96
  export type ManagedQueueJobContext = {
97
+ control?: TaskControlContext;
87
98
  pluginName: string;
88
99
  queueName: string;
89
100
  jobName: string;
@@ -107,6 +118,7 @@ export interface ManagedQueueJobProcessor<TPayload = unknown> {
107
118
  handle(job: ManagedQueueJob<TPayload>, context: ManagedQueueJobContext): Promise<void> | void;
108
119
  }
109
120
  export type ManagedQueueHandlerRegistration<TPayload = unknown> = {
121
+ controlContract?: string;
110
122
  pluginName: string;
111
123
  queueName: string;
112
124
  jobName: string;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Plugin metadata may be parsed in a provider constructor, before registry discovery.
3
+ * Preserve Nest injection metadata while isolating validation failures from external plugins.
4
+ * Failed contributions never become executable templates; built-in and non-validation errors still throw.
5
+ */
6
+ import { z } from 'zod/v3';
7
+ export type PipelineContributionIssue = {
8
+ path: (string | number)[];
9
+ code: string;
10
+ };
11
+ export declare class UnavailablePipelineContribution {
12
+ readonly metatype: Function;
13
+ readonly issues: PipelineContributionIssue[];
14
+ constructor(metatype: Function, issues: PipelineContributionIssue[]);
15
+ }
16
+ export declare function pipelineContributionIssues(error: z.ZodError): PipelineContributionIssue[];
17
+ export declare function isolatePipelineContribution<T extends Function>(target: T): T;
@@ -2,13 +2,28 @@ import { DiscoveryService, Reflector } from '@nestjs/core';
2
2
  import { type ProjectPipelineContribution, type ProjectPipelineJsonValue } from '@xpert-ai/contracts';
3
3
  import { BaseStrategyRegistry, type StrategySource } from '../strategy';
4
4
  import type { ProjectAccessActor } from '../runtime/capabilities/project-access';
5
+ import { type PipelineContributionIssue } from './contribution-failure';
5
6
  export { projectPipelineContributionSchema, type ProjectPipelineContribution } from '@xpert-ai/contracts';
6
7
  export declare const PROJECT_PIPELINE_CONTRIBUTION = "PROJECT_PIPELINE_CONTRIBUTION";
7
- export declare const ProjectPipelineContributor: (key: string) => <TFunction extends Function, Y>(target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor<Y>) => void;
8
+ export declare const ProjectPipelineContributor: (key: string) => ClassDecorator;
9
+ export interface ProjectPipelineContributionFailure {
10
+ key: string;
11
+ source: Extract<StrategySource, {
12
+ kind: 'plugin';
13
+ }>;
14
+ code: 'PIPELINE_CONTRIBUTION_INVALID';
15
+ issues: PipelineContributionIssue[];
16
+ }
8
17
  export declare class ProjectPipelineContributionRegistry extends BaseStrategyRegistry<ProjectPipelineContribution> {
9
18
  private readonly parsedContributions;
19
+ private readonly failures;
20
+ private readonly failureLogger;
10
21
  constructor(discovery: DiscoveryService, reflector: Reflector);
11
22
  upsert(instance: unknown): void;
23
+ getRegistrationFailures(): ProjectPipelineContributionFailure[];
24
+ remove(scopeKey: string, pluginName: string): void;
25
+ private failureIdentity;
26
+ private rejectContribution;
12
27
  register(key: string, contribution: ProjectPipelineContribution, source: StrategySource): {
13
28
  key: string;
14
29
  configurations: {
@@ -0,0 +1,10 @@
1
+ /** Trusted execution identity supplied by the host or a persisted job, never by client payloads. */
2
+ export interface RuntimeActor {
3
+ tenantId: string;
4
+ userId: string;
5
+ organizationId?: string | null;
6
+ }
7
+ /** Organization-bound operations require an explicit organization, including background executions. */
8
+ export interface OrganizationRuntimeActor extends RuntimeActor {
9
+ organizationId: string;
10
+ }
@@ -21,7 +21,16 @@ export type PublishArtifactDraftInput = {
21
21
  };
22
22
  export interface ArtifactDraftsApi {
23
23
  list(artifactIds: string[]): Promise<ArtifactDraftRecord[]>;
24
- get(artifactId: string): Promise<ArtifactDraftRecord | null>;
24
+ /** Catalog/recycle-bin reads only; ordinary editors must leave includeArchived unset. */
25
+ get(artifactId: string, options?: {
26
+ includeArchived?: boolean;
27
+ }): Promise<ArtifactDraftRecord | null>;
28
+ /** Manager-only CAS lifecycle; recycling revokes all links, restoring never reactivates them. */
29
+ setRecycled(input: {
30
+ artifactId: string;
31
+ expectedRevision: number;
32
+ recycled: boolean;
33
+ }): Promise<ArtifactDraftRecord>;
25
34
  save(input: SaveArtifactDraftInput): Promise<ArtifactDraftRecord>;
26
35
  /** Trusted application action only; never expose this operation as an Agent tool. */
27
36
  publish(input: PublishArtifactDraftInput): Promise<ArtifactVersionRecord>;