@xpert-ai/plugin-sdk 3.35.0 → 3.37.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 (65) hide show
  1. package/agent-results.cjs.js +5 -3
  2. package/agent-results.esm.js +2 -2
  3. package/analytics-result.cjs.js +64 -27
  4. package/analytics-result.esm.js +62 -28
  5. package/analytics.cjs.js +157 -15
  6. package/analytics.esm.js +154 -17
  7. package/artifact-document.cjs.js +9 -3
  8. package/artifact-document.esm.js +9 -3
  9. package/collaboration-client.cjs.js +274 -140
  10. package/collaboration-client.esm.js +273 -141
  11. package/docs/README.md +23 -0
  12. package/index.cjs.js +227 -10
  13. package/index.esm.js +198 -13
  14. package/package.json +8 -2
  15. package/remote-component.cjs.default.js +1 -0
  16. package/remote-component.cjs.js +143 -0
  17. package/remote-component.cjs.mjs +2 -0
  18. package/remote-component.d.ts +1 -0
  19. package/remote-component.esm.js +139 -0
  20. package/results.cjs.js +2 -14
  21. package/results.esm.js +2 -12
  22. package/src/analytics.d.ts +2 -0
  23. package/src/collaboration-client.d.ts +1 -0
  24. package/src/index.d.ts +1 -0
  25. package/src/lib/agent/handoff/agent-runtime-message.contract.d.ts +24 -24
  26. package/src/lib/agent/middleware/strategy.interface.d.ts +4 -0
  27. package/src/lib/agent/runtime/capability.d.ts +2 -0
  28. package/src/lib/agent/runtime/cli-model-profile.d.ts +14 -1
  29. package/src/lib/agent/runtime/dispatch.d.ts +79 -79
  30. package/src/lib/agent/runtime/execution-runner.d.ts +19 -10
  31. package/src/lib/agent/runtime/pipeline-scope.d.ts +4 -4
  32. package/src/lib/agent/runtime/results.d.ts +14 -234
  33. package/src/lib/agent/runtime/types.d.ts +19 -0
  34. package/src/lib/agent-event/index.d.ts +89 -0
  35. package/src/lib/agent-event/journal.d.ts +30 -0
  36. package/src/lib/artifact-document/dependencies.d.ts +3 -3
  37. package/src/lib/artifact-document/protocol.d.ts +2 -2
  38. package/src/lib/artifact-document/scheduler.d.ts +3 -0
  39. package/src/lib/artifact-type/definition.schema.d.ts +11 -39
  40. package/src/lib/assistant-capability/middleware.d.ts +2 -1
  41. package/src/lib/channel/strategy.interface.d.ts +20 -0
  42. package/src/lib/collaboration/client.d.ts +6 -59
  43. package/src/lib/collaboration/index.d.ts +1 -0
  44. package/src/lib/collaboration/operations-client.d.ts +23 -0
  45. package/src/lib/collaboration/presence.d.ts +36 -0
  46. package/src/lib/collaboration/provider.registry.d.ts +2 -2
  47. package/src/lib/collaboration/transport.d.ts +24 -0
  48. package/src/lib/collaboration/types.d.ts +57 -5
  49. package/src/lib/content-resource/catalog.d.ts +40 -2
  50. package/src/lib/content-resource/editor.d.ts +36 -1
  51. package/src/lib/data/analytics/analysis-evidence.d.ts +757 -0
  52. package/src/lib/data/analytics/analytics-certification.d.ts +64 -0
  53. package/src/lib/data/analytics/analytics-provider.d.ts +9 -0
  54. package/src/lib/data/analytics/analytics-value.d.ts +5 -0
  55. package/src/lib/data/analytics/index.d.ts +1 -0
  56. package/src/lib/evolution/runtime-capability.d.ts +1 -0
  57. package/src/lib/project-pipeline/adapters.d.ts +9 -2
  58. package/src/lib/project-pipeline/registry.d.ts +59 -48
  59. package/src/lib/project-task/acceptance.d.ts +13 -1
  60. package/src/lib/project-task/index.d.ts +4 -2
  61. package/src/lib/runtime/capabilities/project-configuration.d.ts +2 -0
  62. package/src/lib/view-extension/index.d.ts +1 -0
  63. package/src/lib/view-extension/provider.interface.d.ts +51 -0
  64. package/src/lib/view-extension/workbench-decision.d.ts +10 -0
  65. package/src/remote-component.d.ts +13 -0
@@ -1,28 +1,8 @@
1
- import type { ApplyCollaborationUpdateResult, CollaborationPresencePatch, CollaborationSessionDescriptor, ICollaborationActor, ICollaborationPresence } from './types';
2
- export type CollaborationTransportPayload = Record<string, unknown>;
3
- export type CollaborationTransportHandler = (payload: CollaborationTransportPayload) => void;
4
- /** Framework-neutral event transport used by the collaboration client. */
5
- export interface CollaborationTransport {
6
- readonly connected: boolean;
7
- /** Socket/session identifier for this exact browser client, when the transport exposes one. */
8
- readonly clientId?: string | null;
9
- connect(): void;
10
- disconnect(): void;
11
- emit(event: string, payload?: CollaborationTransportPayload): void;
12
- on(event: string, handler: CollaborationTransportHandler): () => void;
13
- }
14
- /** Minimal Socket.IO-compatible shape; keeps socket.io-client out of the SDK bundle. */
15
- export interface CollaborationSocketLike {
16
- readonly connected: boolean;
17
- readonly id?: string;
18
- connect(): unknown;
19
- disconnect(): unknown;
20
- emit(event: string, payload?: CollaborationTransportPayload): unknown;
21
- on(event: string, handler: CollaborationTransportHandler): unknown;
22
- off(event: string, handler: CollaborationTransportHandler): unknown;
23
- }
24
- /** Adapt a caller-owned Socket.IO client to the SDK's framework-neutral transport. */
25
- export declare function createSocketIoTransportAdapter(socket: CollaborationSocketLike): CollaborationTransport;
1
+ import type { CollaborationTransport } from './transport';
2
+ import { type CollaborationPresenceSnapshotMetadata } from './presence';
3
+ export * from './transport';
4
+ export * from './presence';
5
+ import type { ApplyCollaborationUpdateResult, CollaborationPresencePatch, CollaborationSessionDescriptor, ICollaborationPresence } from './types';
26
6
  export type CollaborationDocumentUpdateHandler = (update: Uint8Array, origin: unknown) => void;
27
7
  /** Binary CRDT operations required by the generic collaboration client. */
28
8
  export interface CollaborationBinaryDocumentAdapter {
@@ -74,41 +54,8 @@ export interface CollaborationClient {
74
54
  requestSync(): void;
75
55
  setPresence(patch: CollaborationPresencePatch): void;
76
56
  }
77
- /** Connection-specific metadata delivered with a presence snapshot. */
78
- export type CollaborationPresenceSnapshotMetadata = {
79
- selfClientId: string | null;
80
- };
81
- /** Stable, framework-neutral view of active collaboration sessions and deduplicated actors. */
82
- export type CollaborationPresenceStoreSnapshot = {
83
- selfClientId: string | null;
84
- /** Every active browser/Agent session keyed by `clientId`. */
85
- sessions: ICollaborationPresence[];
86
- /** Sessions excluding only this exact browser client. */
87
- remoteSessions: ICollaborationPresence[];
88
- /** One entry per actor identity, including the local actor when supplied. */
89
- collaborators: ICollaborationPresence[];
90
- };
91
- export type CollaborationPresenceStoreOptions = {
92
- selfActor?: ICollaborationActor | null;
93
- includeSelf?: boolean;
94
- onChange?: (snapshot: CollaborationPresenceStoreSnapshot) => void;
95
- };
96
- /** Mutable presence projection used by plugin UIs without coupling them to a framework. */
97
- export interface CollaborationPresenceStore {
98
- setSelfClientId(clientId: string | null): void;
99
- replace(items: ICollaborationPresence[], selfClientId?: string | null): void;
100
- upsert(item: ICollaborationPresence): void;
101
- remove(clientId: string): void;
102
- clear(): void;
103
- snapshot(): CollaborationPresenceStoreSnapshot;
104
- }
105
- /**
106
- * Keep per-client sessions for cursors while exposing one collaborator per stable actor identity.
107
- * This prevents a second tab owned by the same user from either duplicating or hiding that user.
108
- */
109
- export declare function createCollaborationPresenceStore(options?: CollaborationPresenceStoreOptions): CollaborationPresenceStore;
110
57
  /**
111
- * Create a collaboration client with update batching, state-vector repair, presence heartbeat,
58
+ * Create a Yjs collaboration client with update batching, state-vector repair, presence heartbeat,
112
59
  * and reconnect synchronization. The caller retains ownership of the document and transport.
113
60
  */
114
61
  export declare function createCollaborationClient(options: CollaborationClientOptions): CollaborationClient;
@@ -3,3 +3,4 @@ export * from './runtime-capability';
3
3
  export * from './provider.decorator';
4
4
  export * from './provider.registry';
5
5
  export * from './client';
6
+ export * from './operations-client';
@@ -0,0 +1,23 @@
1
+ import type { CollaborationTransport } from './transport';
2
+ import type { CollaborationPresencePatch, CollaborationSessionDescriptor, ICollaborationPresence } from './types';
3
+ export type OperationCollaborationOptions = {
4
+ session: CollaborationSessionDescriptor;
5
+ transport: CollaborationTransport;
6
+ /** Invalidate/refetch domain state; this is neither an operation payload nor a save acknowledgement. */
7
+ onRevision(revision: number): void;
8
+ onPresence(items: ICollaborationPresence[], selfClientId: string | null): void;
9
+ onConnection(state: 'connected' | 'disconnected'): void;
10
+ onError(error: Error): void;
11
+ };
12
+ /**
13
+ * Notification client for a domain-owned operation log, not an OT/CRDT implementation.
14
+ * The domain API owns writes, validation, conflict handling and persistence. This client
15
+ * only tracks committed revisions and ephemeral presence; it never submits business edits.
16
+ * Revisions coalesce to one high-water mark, so consumers must refetch authoritative state.
17
+ */
18
+ export declare function createOperationCollaborationClient(options: OperationCollaborationOptions): {
19
+ connect(): void;
20
+ disconnect: () => void;
21
+ requestSync: () => void;
22
+ setPresence(value: CollaborationPresencePatch): void;
23
+ };
@@ -0,0 +1,36 @@
1
+ import type { ICollaborationActor, ICollaborationPresence } from './types';
2
+ /** Connection-specific metadata delivered with a presence snapshot. */
3
+ export type CollaborationPresenceSnapshotMetadata = {
4
+ selfClientId: string | null;
5
+ };
6
+ /** Stable, framework-neutral view of active collaboration sessions and deduplicated actors. */
7
+ export type CollaborationPresenceStoreSnapshot = {
8
+ selfClientId: string | null;
9
+ /** Every active browser/Agent session keyed by `clientId`. */
10
+ sessions: ICollaborationPresence[];
11
+ /** Sessions excluding only this exact browser client. */
12
+ remoteSessions: ICollaborationPresence[];
13
+ /** One entry per actor identity, including the local actor when supplied. */
14
+ collaborators: ICollaborationPresence[];
15
+ };
16
+ export type CollaborationPresenceStoreOptions = {
17
+ selfActor?: ICollaborationActor | null;
18
+ includeSelf?: boolean;
19
+ onChange?: (snapshot: CollaborationPresenceStoreSnapshot) => void;
20
+ };
21
+ /** Mutable presence projection used by plugin UIs without coupling them to a framework. */
22
+ export interface CollaborationPresenceStore {
23
+ setSelfClientId(clientId: string | null): void;
24
+ replace(items: ICollaborationPresence[], selfClientId?: string | null): void;
25
+ upsert(item: ICollaborationPresence): void;
26
+ remove(clientId: string): void;
27
+ clear(): void;
28
+ snapshot(): CollaborationPresenceStoreSnapshot;
29
+ }
30
+ /**
31
+ * Keep per-client sessions for cursors while exposing one collaborator per stable actor identity.
32
+ * This prevents a second tab owned by the same user from either duplicating or hiding that user.
33
+ */
34
+ export declare function createCollaborationPresenceStore(options?: CollaborationPresenceStoreOptions): CollaborationPresenceStore;
35
+ /** Parse untrusted presence payloads shared by both engines; document content is ignored. */
36
+ export declare function parseCollaborationPresence(value: unknown): ICollaborationPresence | null;
@@ -1,7 +1,7 @@
1
1
  import { DiscoveryService, Reflector } from '@nestjs/core';
2
2
  import { BaseStrategyRegistry } from '../strategy';
3
- import type { ICollaborationDocumentProvider } from './types';
3
+ import type { CollaborationProvider } from './types';
4
4
  /** Discovers system and organization-scoped collaboration providers from loaded plugins. */
5
- export declare class CollaborationDocumentProviderRegistry extends BaseStrategyRegistry<ICollaborationDocumentProvider> {
5
+ export declare class CollaborationDocumentProviderRegistry extends BaseStrategyRegistry<CollaborationProvider> {
6
6
  constructor(discoveryService: DiscoveryService, reflector: Reflector);
7
7
  }
@@ -0,0 +1,24 @@
1
+ export type CollaborationTransportPayload = Record<string, unknown>;
2
+ export type CollaborationTransportHandler = (payload: CollaborationTransportPayload) => void;
3
+ /** Framework-neutral event transport used by the collaboration client. */
4
+ export interface CollaborationTransport {
5
+ readonly connected: boolean;
6
+ /** Socket/session identifier for this exact browser client, when the transport exposes one. */
7
+ readonly clientId?: string | null;
8
+ connect(): void;
9
+ disconnect(): void;
10
+ emit(event: string, payload?: CollaborationTransportPayload): void;
11
+ on(event: string, handler: CollaborationTransportHandler): () => void;
12
+ }
13
+ /** Minimal Socket.IO-compatible shape; keeps socket.io-client out of the SDK bundle. */
14
+ export interface CollaborationSocketLike {
15
+ readonly connected: boolean;
16
+ readonly id?: string;
17
+ connect(): unknown;
18
+ disconnect(): unknown;
19
+ emit(event: string, payload?: CollaborationTransportPayload): unknown;
20
+ on(event: string, handler: CollaborationTransportHandler): unknown;
21
+ off(event: string, handler: CollaborationTransportHandler): unknown;
22
+ }
23
+ /** Adapt a caller-owned Socket.IO client to the SDK's framework-neutral transport. */
24
+ export declare function createSocketIoTransportAdapter(socket: CollaborationSocketLike): CollaborationTransport;
@@ -16,7 +16,11 @@ export type CollaborationRuntimeActor = {
16
16
  displayName?: string | null;
17
17
  avatarUrl?: string | null;
18
18
  };
19
- /** Metadata-only representation of the platform collaboration document. */
19
+ /**
20
+ * Platform registration metadata. In `operations` mode, sequence/materialization fields
21
+ * are initialization metadata, not the live domain revision; use revision notifications
22
+ * to invalidate the domain API read. Business writes never go through this record.
23
+ */
20
24
  export type CollaborationDocumentRecord = CollaborationScope & {
21
25
  id: string;
22
26
  providerKey: string;
@@ -71,6 +75,8 @@ export type ApplyCollaborationUpdateInput = {
71
75
  origin?: string | null;
72
76
  /** Optional compare-and-set guard for destructive or order-sensitive operations. */
73
77
  expectedSequence?: number | null;
78
+ /** Reject updates from a pre-migration session, including races after its access check. */
79
+ expectedSchemaVersion?: number | null;
74
80
  actor?: CollaborationRuntimeActor | null;
75
81
  };
76
82
  /** Acknowledgement for a unique or deduplicated collaboration update. */
@@ -89,6 +95,8 @@ export type CreateCollaborationSessionInput = {
89
95
  };
90
96
  /** Credentials and backend URL required by a browser transport. */
91
97
  export type CollaborationSessionDescriptor = {
98
+ /** Omitted by legacy hosts; those sessions always use Yjs. */
99
+ engine?: CollaborationEngine;
92
100
  sessionId: string;
93
101
  clientKey: string;
94
102
  documentId: string;
@@ -123,15 +131,34 @@ export type RemoveVirtualPresenceInput = {
123
131
  presenceId?: string | null;
124
132
  actorKey?: string | null;
125
133
  };
134
+ /** Provider-owned schema migration with a revision fence; callers cannot submit replacement state. */
135
+ export type MigrateCollaborationDocumentInput = {
136
+ documentId: string;
137
+ expectedSequence: number;
138
+ expectedSchemaVersion: number;
139
+ targetSchemaVersion: number;
140
+ };
126
141
  /** Runtime capability exposed to scoped plugin and Agent executions. */
127
142
  export interface CollaborationApi {
143
+ /**
144
+ * Operations only: invalidate subscribers after the domain transaction commits.
145
+ * Reads the provider revision; callers cannot supply a fabricated revision. This is
146
+ * not a write acknowledgement or an operation log. Reconnect/periodic sync repairs
147
+ * missed notifications. Optional for compatibility with older hosts.
148
+ */
149
+ notifyRevision?(input: GetCollaborationDocumentInput): Promise<{
150
+ documentId: string;
151
+ revision: number;
152
+ }>;
153
+ /** Yjs only. Optional on older hosts; preserves identity while fencing old schema sessions. */
154
+ migrateDocument?(input: MigrateCollaborationDocumentInput): Promise<CollaborationDocumentRecord>;
128
155
  /** Ensure a provider/resource pair has one platform collaboration document. */
129
156
  ensureDocument(input: EnsureCollaborationDocumentInput): Promise<CollaborationDocumentRecord>;
130
- /** Read document metadata and trigger materialization read repair when required. */
157
+ /** Read registration metadata; trigger projection repair only for Yjs documents. */
131
158
  getDocument(input: GetCollaborationDocumentInput): Promise<CollaborationDocumentRecord>;
132
- /** Read complete state or a state-vector-relative Yjs delta. */
159
+ /** Yjs only: read complete state or a state-vector-relative delta. Rejects operations documents. */
133
160
  getDocumentState(input: GetCollaborationDocumentStateInput): Promise<CollaborationDocumentState>;
134
- /** Authorize, deduplicate, merge, persist, broadcast, and materialize an update. */
161
+ /** Yjs only: authorize, merge, persist and materialize a binary update. Rejects operations documents. */
135
162
  applyUpdate(input: ApplyCollaborationUpdateInput): Promise<ApplyCollaborationUpdateResult>;
136
163
  /** Issue single-document browser credentials with read or write access. */
137
164
  createSession(input: CreateCollaborationSessionInput): Promise<CollaborationSessionDescriptor>;
@@ -182,16 +209,24 @@ export type CollaborationMaterializationEvent = CollaborationProviderContext & {
182
209
  origin?: string | null;
183
210
  };
184
211
  /**
185
- * Plugin-owned adapter between a business resource and the platform collaboration engine.
212
+ * Yjs adapter between a business resource and the platform CRDT engine.
186
213
  * Authorization remains the plugin's responsibility; the platform owns transport and CRDT state.
187
214
  */
188
215
  export interface ICollaborationDocumentProvider {
216
+ readonly engine?: 'yjs';
189
217
  /** Authorize the exact resource and requested operation in the supplied platform scope. */
190
218
  authorize(context: CollaborationProviderContext): Promise<boolean> | boolean;
191
219
  /** Validate the merged state before commit, including updates received through WebSockets. */
192
220
  validateDocument?(context: CollaborationProviderContext & {
193
221
  stateBase64: string;
222
+ schemaVersion?: number;
194
223
  }): Promise<void> | void;
224
+ /** Upgrade a known persisted schema; never infer or downgrade versions. Host serializes and validates it. */
225
+ migrateDocument?(context: CollaborationProviderContext & {
226
+ stateBase64: string;
227
+ schemaVersion: number;
228
+ targetSchemaVersion: number;
229
+ }): Promise<CollaborationDocumentInitialization> | CollaborationDocumentInitialization;
195
230
  /** Return an idempotent initial snapshot without creating a business version. */
196
231
  initializeDocument(context: CollaborationProviderContext): Promise<CollaborationDocumentInitialization> | CollaborationDocumentInitialization;
197
232
  /** Project platform state into plugin query/export entities. The method must be idempotent. */
@@ -199,3 +234,20 @@ export interface ICollaborationDocumentProvider {
199
234
  /** Optionally clean plugin-owned associations after a platform soft delete. */
200
235
  onDocumentDeleted?(context: CollaborationProviderContext): Promise<void> | void;
201
236
  }
237
+ /**
238
+ * Adapter for domain-owned operations; it does not implement OT or CRDT merging.
239
+ * The domain service owns commands, validation, authorization, idempotency, conflicts,
240
+ * persistence and undo. The platform owns sessions, revision invalidation and presence.
241
+ * There are deliberately no initialize/materialize/apply hooks for content here.
242
+ */
243
+ export interface ICollaborationOperationsProvider {
244
+ readonly engine: 'operations';
245
+ /** Session compatibility version; independent of the monotonically increasing domain revision. */
246
+ readonly schemaVersion: number;
247
+ /** Recheck current resource access; a session never grants domain write permission on its own. */
248
+ authorize(context: CollaborationProviderContext): Promise<boolean> | boolean;
249
+ /** Read the committed, monotonic safe-integer revision (>= 0); must not mutate domain state. */
250
+ getRevision(context: CollaborationProviderContext): Promise<number> | number;
251
+ onDocumentDeleted?(context: CollaborationProviderContext): Promise<void> | void;
252
+ }
253
+ export type CollaborationProvider = ICollaborationDocumentProvider | ICollaborationOperationsProvider;
@@ -1,4 +1,4 @@
1
- import type { ContentCatalogItem, ContentResourceSnapshot, ContentTypeImplementation, ContentSearchProjection } from '@xpert-ai/contracts';
1
+ import type { ContentCatalogItem, ContentResourceSnapshot, ContentTypeImplementation, ContentSearchProjection, ContentTransferSnapshot } from '@xpert-ai/contracts';
2
2
  import type { ContentDocumentScope } from './document';
3
3
  import type { ContentResourceReference, ContentSourceInput } from './index';
4
4
  export type ContentResourceMutation = {
@@ -16,7 +16,15 @@ export type ContentResourceMutation = {
16
16
  };
17
17
  /** Plugins retain their native model and ACL. Discovery is scoped and paginated, never a grant. */
18
18
  export interface ContentCatalogProvider {
19
+ /** Live path lookup for file owners before a rebuildable catalog entry exists. */
20
+ resolveFile?(input: ContentDocumentScope & {
21
+ path: string;
22
+ }): Promise<string | null>;
19
23
  readonly types: ContentTypeImplementation[];
24
+ /** Optional scoped implementations supplied by installed file codecs; never a permission grant. */
25
+ listTypes?(scope: ContentDocumentScope): Promise<ContentTypeImplementation[]>;
26
+ /** Explicit opt-in for target creation; omission disables content transfer into this provider. */
27
+ readonly acceptedTransferSchemas?: ReadonlyArray<ContentTransferSnapshot['schema']>;
20
28
  discover(scope: ContentDocumentScope & {
21
29
  cursor?: string;
22
30
  }): Promise<{
@@ -28,11 +36,20 @@ export interface ContentCatalogProvider {
28
36
  extract?(input: ContentSourceInput & {
29
37
  expectedRevision: string;
30
38
  }): Promise<ContentSearchProjection>;
39
+ /** Export only the requested revision in a negotiated schema, without credentials or query payloads.
40
+ * The host validates the envelope and rechecks source access; the producer owns its native consistency rules. */
41
+ transfer?(input: ContentSourceInput & {
42
+ expectedRevision: string;
43
+ acceptedSchemas: ReadonlyArray<ContentTransferSnapshot['schema']>;
44
+ }): Promise<ContentTransferSnapshot>;
45
+ /** Idempotent by requestId. initialContent comes from host validation, never directly from browser input.
46
+ * Native creation retains its own ACL and persistence checks; transferred evidence is not a permission token. */
31
47
  create(input: ContentDocumentScope & {
32
48
  implementationKey: string;
33
49
  requestId: string;
34
50
  title: string;
35
51
  templateId?: string;
52
+ initialContent?: ContentTransferSnapshot;
36
53
  }): Promise<ContentResourceReference>;
37
54
  /** Idempotent repair of derived files only; must never overwrite newer native content. */
38
55
  reconcile?(input: ContentSourceInput): Promise<void>;
@@ -50,7 +67,20 @@ export interface ContentCatalogApi {
50
67
  types(scope: ContentDocumentScope): Promise<Array<ContentTypeImplementation & {
51
68
  providerKey: string;
52
69
  }>>;
53
- /** Reconciles registered providers before listing. The caller may continue with the returned cursor. */
70
+ /** Rebuild derived catalog metadata explicitly, outside the first-page read path. */
71
+ refresh(scope: ContentDocumentScope & {
72
+ excludedProviderKeys?: string[];
73
+ }): Promise<void>;
74
+ /** Project-scoped suppression metadata, including tombstones. These paths only hide
75
+ * duplicate file entries; they must never be displayed or treated as access grants. */
76
+ coverage(scope: ContentDocumentScope & {
77
+ excludedProviderKeys?: string[];
78
+ }): Promise<Array<{
79
+ path: string;
80
+ recursive: boolean;
81
+ }>>;
82
+ /** Reads an authorized page. Use indexed discovery for interactive lists and refresh
83
+ * separately. The default retains synchronous discovery for existing callers. */
54
84
  list(scope: ContentDocumentScope & {
55
85
  excludedProviderKeys?: string[];
56
86
  contentIds?: string[];
@@ -59,9 +89,12 @@ export interface ContentCatalogApi {
59
89
  deleted?: boolean;
60
90
  offset?: number;
61
91
  limit?: number;
92
+ discovery?: 'refresh' | 'indexed';
93
+ cursor?: string;
62
94
  }): Promise<{
63
95
  items: ContentCatalogItem[];
64
96
  hasMore: boolean;
97
+ nextCursor?: string;
65
98
  }>;
66
99
  register(input: ContentDocumentScope & {
67
100
  source: ContentResourceReference;
@@ -79,6 +112,11 @@ export interface ContentCatalogApi {
79
112
  requestId: string;
80
113
  title: string;
81
114
  templateId?: string;
115
+ /** The host reads this exact source revision; callers cannot supply source content. */
116
+ transferFrom?: {
117
+ contentId: string;
118
+ expectedRevision: string;
119
+ };
82
120
  }): Promise<ContentCatalogItem>;
83
121
  mutate(input: ContentDocumentScope & {
84
122
  contentId: string;
@@ -3,6 +3,7 @@ import type { ContentEditorRegistration, FileContentEditorRegistration, Resource
3
3
  import { BaseStrategyRegistry } from '../strategy';
4
4
  import type { ContentDocumentModel, ContentDocumentScope } from './document';
5
5
  import type { ContentResourceReference, ContentSourceInput } from './index';
6
+ import type { CollaborationSessionDescriptor } from '../collaboration/types';
6
7
  export { supportsContentModel } from './editor-compatibility';
7
8
  /** File codecs expose no cells, blocks or plugin-specific edit operations to the platform. */
8
9
  export interface ContentFileEditor {
@@ -35,19 +36,27 @@ export interface ContentResourceEditor {
35
36
  read(input: ContentSourceInput): Promise<{
36
37
  buffer: Buffer;
37
38
  revision: string;
39
+ sequence?: number;
38
40
  }>;
39
41
  write(input: ContentSourceInput & {
40
42
  buffer: Buffer;
41
43
  expectedRevision: string;
42
44
  }): Promise<{
43
45
  revision: string;
46
+ sequence?: number;
44
47
  }>;
45
48
  };
49
+ /** Presence and revision notifications only; file bytes remain owned by the CAS writer above. */
50
+ createSession?(input: ContentSourceInput): Promise<CollaborationSessionDescriptor>;
46
51
  }
47
52
  export type ContentEditorInput = ContentDocumentScope & {
48
53
  source: ContentResourceReference;
49
54
  editorKey?: string;
50
55
  };
56
+ export type ContentFileEditorInput = ContentDocumentScope & {
57
+ path: string;
58
+ editorKey?: string;
59
+ };
51
60
  export type ContentEditorPreferenceScope = 'resource' | 'project' | 'organization';
52
61
  export interface ContentEditorPreferenceState {
53
62
  scope: ContentEditorPreferenceScope;
@@ -67,22 +76,26 @@ export interface ContentEditorResolution {
67
76
  contentId?: string;
68
77
  contentTitle?: string;
69
78
  contentEditor?: string;
79
+ filePath?: string;
70
80
  };
71
81
  editors?: ResourceContentEditorRegistration[];
72
82
  }
73
83
  /** Trusted scope only. Every operation checks Project, Assistant binding and resource permissions. */
74
84
  export interface ContentEditorsApi {
85
+ /** Read resource, Project and organization editor preferences, including permission to change each scope. */
75
86
  preferences(input: ContentDocumentScope & {
76
87
  contentId: string;
77
88
  }): Promise<ContentEditorPreferenceState[]>;
89
+ /** Set or clear a scoped preference using its exact revision; editorKey=null restores inherited selection. */
78
90
  setPreference(input: ContentDocumentScope & {
79
91
  contentId: string;
80
92
  scope: ContentEditorPreferenceScope;
81
93
  editorKey: string | null;
82
94
  expectedRevision: number;
83
95
  }): Promise<ContentEditorPreferenceState>;
96
+ /** List editors available in the authorized scope; discovery alone does not grant access to a resource. */
84
97
  list(scope: ContentDocumentScope): Promise<ContentEditorRegistration[]>;
85
- /** Prepare/validate bytes; does not create a resource or grant access to a destination. */
98
+ /** Validate supplied bytes or create a blank file with the selected codec; does not persist a resource. */
86
99
  prepare(scope: ContentDocumentScope & {
87
100
  editorKey: string;
88
101
  buffer?: Buffer;
@@ -90,16 +103,38 @@ export interface ContentEditorsApi {
90
103
  registration: FileContentEditorRegistration;
91
104
  buffer: Buffer;
92
105
  }>;
106
+ /** Resolve an authorized resource to a compatible editor and host navigation, honoring editor preferences. */
93
107
  resolve(input: ContentEditorInput): Promise<ContentEditorResolution>;
108
+ /** Resolve a Project path through its live resource owner, falling back to a file codec only when unmanaged. */
109
+ resolveFile(input: ContentFileEditorInput): Promise<ContentEditorResolution>;
110
+ /** Read and validate an unmanaged Project file; revision is its current hash. Owned files must use read(). */
111
+ readFile(input: ContentFileEditorInput): Promise<ContentEditorResolution & {
112
+ buffer: Buffer;
113
+ revision: string;
114
+ }>;
115
+ /** Validate and atomically replace an unmanaged file at expectedRevision; reject owned paths and stale hashes. */
116
+ writeFile(input: ContentFileEditorInput & {
117
+ buffer: Buffer;
118
+ expectedRevision: string;
119
+ }): Promise<{
120
+ revision: string;
121
+ }>;
122
+ /** Read a resource owner's current file and opaque revision; sequence and collaboration are optional owner capabilities. */
94
123
  read(input: ContentEditorInput): Promise<ContentEditorResolution & {
95
124
  buffer: Buffer;
96
125
  revision: string;
126
+ sequence?: number;
127
+ collaboration?: boolean;
97
128
  }>;
129
+ /** Validate bytes and publish through the owner using expectedRevision; the owner enforces atomic versions and history. */
98
130
  write(input: ContentEditorInput & {
99
131
  buffer: Buffer;
100
132
  expectedRevision: string;
101
133
  }): Promise<{
102
134
  revision: string;
135
+ sequence?: number;
103
136
  }>;
137
+ /** Create an authorized presence/revision session when supported; file writes still use write(), not this channel. */
138
+ createSession(input: ContentEditorInput): Promise<CollaborationSessionDescriptor>;
104
139
  }
105
140
  export declare const ContentEditorsRuntimeCapability: import("../core/runtime-capability").RuntimeCapabilityKey<ContentEditorsApi>;