@nimbalyst/extension-sdk 0.1.5 → 0.2.1

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 (73) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/__tests__/createTextCollabContentAdapter.test.d.ts +2 -0
  3. package/dist/__tests__/createTextCollabContentAdapter.test.d.ts.map +1 -0
  4. package/dist/__tests__/createTextCollabContentAdapter.test.js +60 -0
  5. package/dist/__tests__/hasSeedableContent.test.d.ts +2 -0
  6. package/dist/__tests__/hasSeedableContent.test.d.ts.map +1 -0
  7. package/dist/__tests__/hasSeedableContent.test.js +25 -0
  8. package/dist/__tests__/manifestValidation.agentProviders.test.d.ts +2 -0
  9. package/dist/__tests__/manifestValidation.agentProviders.test.d.ts.map +1 -0
  10. package/dist/__tests__/manifestValidation.agentProviders.test.js +44 -0
  11. package/dist/agents/AgentProtocol.d.ts +227 -0
  12. package/dist/agents/AgentProtocol.d.ts.map +1 -0
  13. package/dist/agents/AgentProtocol.js +23 -0
  14. package/dist/agents/AgentProtocolHost.d.ts +190 -0
  15. package/dist/agents/AgentProtocolHost.d.ts.map +1 -0
  16. package/dist/agents/AgentProtocolHost.js +42 -0
  17. package/dist/agents/index.d.ts +26 -0
  18. package/dist/agents/index.d.ts.map +1 -0
  19. package/dist/agents/index.js +24 -0
  20. package/dist/collab/createTextCollabContentAdapter.d.ts +26 -0
  21. package/dist/collab/createTextCollabContentAdapter.d.ts.map +1 -0
  22. package/dist/collab/createTextCollabContentAdapter.js +79 -0
  23. package/dist/createReadOnlyHost.d.ts +5 -0
  24. package/dist/createReadOnlyHost.d.ts.map +1 -1
  25. package/dist/createReadOnlyHost.js +4 -0
  26. package/dist/externals.d.ts +3 -3
  27. package/dist/externals.d.ts.map +1 -1
  28. package/dist/externals.js +7 -0
  29. package/dist/index.d.ts +4 -0
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +3 -0
  32. package/dist/manifestValidation.d.ts +118 -0
  33. package/dist/manifestValidation.d.ts.map +1 -0
  34. package/dist/manifestValidation.js +475 -0
  35. package/dist/types/collab.d.ts +138 -0
  36. package/dist/types/collab.d.ts.map +1 -0
  37. package/dist/types/collab.js +1 -0
  38. package/dist/types/editor.d.ts +198 -0
  39. package/dist/types/editor.d.ts.map +1 -1
  40. package/dist/types/editors.d.ts +4 -0
  41. package/dist/types/editors.d.ts.map +1 -1
  42. package/dist/types/extension.d.ts +438 -5
  43. package/dist/types/extension.d.ts.map +1 -1
  44. package/dist/types/extension.js +11 -1
  45. package/dist/types/index.d.ts +3 -0
  46. package/dist/types/index.d.ts.map +1 -1
  47. package/dist/types/index.js +3 -0
  48. package/dist/types/panel.d.ts +50 -0
  49. package/dist/types/panel.d.ts.map +1 -1
  50. package/dist/types/permissions.d.ts +117 -0
  51. package/dist/types/permissions.d.ts.map +1 -0
  52. package/dist/types/permissions.js +33 -0
  53. package/dist/types/theme.d.ts +67 -0
  54. package/dist/types/theme.d.ts.map +1 -1
  55. package/dist/types/theme.js +7 -1
  56. package/dist/types/trackerImporter.d.ts +147 -0
  57. package/dist/types/trackerImporter.d.ts.map +1 -0
  58. package/dist/types/trackerImporter.js +33 -0
  59. package/dist/useCollaborativeEditor.d.ts +165 -0
  60. package/dist/useCollaborativeEditor.d.ts.map +1 -0
  61. package/dist/useCollaborativeEditor.js +253 -0
  62. package/dist/useEditorLifecycle.d.ts.map +1 -1
  63. package/dist/useEditorLifecycle.js +9 -5
  64. package/dist/validate.browser.d.ts +5 -0
  65. package/dist/validate.browser.d.ts.map +1 -0
  66. package/dist/validate.browser.js +27 -0
  67. package/dist/validate.d.ts +2 -8
  68. package/dist/validate.d.ts.map +1 -1
  69. package/dist/validate.js +117 -0
  70. package/dist/validationTypes.d.ts +9 -0
  71. package/dist/validationTypes.d.ts.map +1 -0
  72. package/dist/validationTypes.js +1 -0
  73. package/package.json +16 -3
@@ -12,7 +12,162 @@
12
12
  * Your extension code imports from @nimbalyst/runtime, which is externalized
13
13
  * and provided by the host.
14
14
  */
15
+ import type { Doc as YDoc } from 'yjs';
16
+ import type { Awareness } from 'y-protocols/awareness';
15
17
  import type { ExtensionStorage } from './panel.js';
18
+ /**
19
+ * Connection status of a collaborative session.
20
+ *
21
+ * Mirrors `DocumentSyncStatus` in `@nimbalyst/runtime`. Extensions should treat
22
+ * any non-`'connected'` value as "not safe to assume the server has our
23
+ * latest edits" for UI purposes; the underlying Y.Doc remains usable
24
+ * regardless (CRDT updates queue locally until reconnection).
25
+ */
26
+ export type CollaborationStatus = 'disconnected' | 'connecting' | 'syncing' | 'replaying' | 'offline-unsynced' | 'connected' | 'error';
27
+ /**
28
+ * The standard awareness fields the host renders generically (presence
29
+ * avatars, cursors). Extensions may add arbitrary extra keys -- those extras
30
+ * are opaque to the host and handled by the extension itself.
31
+ */
32
+ export interface StandardAwarenessState {
33
+ user: {
34
+ id: string;
35
+ name: string;
36
+ color: string;
37
+ };
38
+ pointer?: {
39
+ x: number;
40
+ y: number;
41
+ };
42
+ selection?: unknown;
43
+ [k: string]: unknown;
44
+ }
45
+ /**
46
+ * Snapshot of a remote collaborator currently in awareness. Provided as a
47
+ * convenience for the SDK hook; extensions that need richer per-editor
48
+ * awareness fields should read `host.collaboration.awareness.getStates()`
49
+ * directly.
50
+ */
51
+ export interface CollaboratorInfo {
52
+ user: {
53
+ id: string;
54
+ name: string;
55
+ color: string;
56
+ };
57
+ }
58
+ /**
59
+ * Available on `EditorHost` only when the document was opened collaboratively.
60
+ *
61
+ * When undefined, the extension should fall back to its standard
62
+ * `host.loadContent()` / `host.saveContent()` flow. When defined, the
63
+ * extension MUST drive its state through the Y.Doc (and the host will not
64
+ * call `host.onSaveRequested` for this document -- persistence is the
65
+ * server's encrypted blob store).
66
+ */
67
+ export interface CollaborationContext {
68
+ /**
69
+ * The shared Y.Doc. Extensions create their own shared types within it
70
+ * (e.g. `yDoc.getArray('elements')`).
71
+ */
72
+ readonly yDoc: YDoc;
73
+ /**
74
+ * `y-protocols/awareness` instance carrying remote presence. Extension
75
+ * bindings register their own local awareness fields here (cursor, tool,
76
+ * selection) and observe changes via `awareness.on('change', ...)`.
77
+ *
78
+ * The host wires this into the encrypted transport so awareness updates
79
+ * are throttled and end-to-end encrypted on the wire.
80
+ */
81
+ readonly awareness: Awareness;
82
+ /** Identity used to drive `awareness` and presence display. */
83
+ readonly user: {
84
+ id: string;
85
+ name: string;
86
+ color: string;
87
+ };
88
+ /** Current connection status. */
89
+ getStatus(): CollaborationStatus;
90
+ /** Subscribe to status changes. Returns an unsubscribe fn. */
91
+ onStatusChange(cb: (status: CollaborationStatus) => void): () => void;
92
+ /**
93
+ * Returns the file content that should be used to seed the Y.Doc when this
94
+ * client is the first to open it. The host owns reading the bytes (from
95
+ * disk, from in-memory Share-to-Team payload, etc.) so extensions never
96
+ * reason about file paths in collab mode.
97
+ */
98
+ loadInitialContent(): Promise<string | ArrayBuffer>;
99
+ /**
100
+ * Flush the current Y.Doc state upstream and resolve ONLY after the server
101
+ * confirms it persisted the update (not merely after the socket write).
102
+ *
103
+ * The SDK awaits this after seeding a first-open collaborative document so the
104
+ * seed is durably on the server before the provider can tear down. Resolves
105
+ * `true` on a server-acked persist, `false` on timeout / not-yet-connected —
106
+ * the host surfaces a failed flush to the user (pending-seed machinery)
107
+ * rather than silently losing the seed. Required on the collab context: a
108
+ * host that can't guarantee the flush would reintroduce the seed data-loss
109
+ * race that made this method necessary.
110
+ */
111
+ flushWithAck(timeoutMs?: number): Promise<boolean>;
112
+ /**
113
+ * True when the transport skipped server payloads it could not decode
114
+ * (stale key epoch, corruption). An "empty" Y.Doc then does NOT mean the
115
+ * room is empty — the SDK must not run the first-open seed, or a default
116
+ * document gets written over real-but-unreadable content for every client.
117
+ */
118
+ hasUndecodedContent?(): boolean;
119
+ /**
120
+ * @deprecated Use {@link flushWithAck}, which awaits a server-persisted ack.
121
+ * `flushLocalState` fires-and-forgets (resolves after the socket write, not
122
+ * the server ack) and rode in the mindmap seed data-loss race. Retained only
123
+ * so existing callers keep compiling.
124
+ */
125
+ flushLocalState?(): Promise<void>;
126
+ /**
127
+ * Register a revision-history snapshot adapter for this collaborative
128
+ * document. Extensions opt in by implementing `exportRevisionSnapshot`
129
+ * and `restoreRevisionSnapshot`; the host wires these into the
130
+ * shared-document History dialog so users can preview and restore past
131
+ * versions of the document.
132
+ *
133
+ * Call this once after binding the editor to the Y.Doc (e.g. inside the
134
+ * same effect that wires `useCollaborativeEditor`). The returned function
135
+ * unregisters the adapter -- call it on unmount.
136
+ *
137
+ * When no adapter is registered, the host falls back to a metadata-only
138
+ * history view: users can see when revisions were taken and by whom, but
139
+ * cannot preview or restore them.
140
+ *
141
+ * Implementations should serialize the editor-native state (e.g. an
142
+ * Excalidraw scene JSON) deterministically so dedupe-on-hash is stable.
143
+ */
144
+ registerRevisionAdapter?(adapter: RevisionSnapshotAdapter): () => void;
145
+ }
146
+ /**
147
+ * Editor-supplied snapshot round-trip for collaborative revision history.
148
+ * See `CollaborationContext.revisionAdapter`.
149
+ */
150
+ export interface RevisionSnapshotAdapter {
151
+ /**
152
+ * Snapshot payload format identifier, e.g. `excalidraw-json` or
153
+ * `mindmap-yaml`. Treated as opaque by the server; used by the dialog to
154
+ * pick a renderer (or fall back to metadata-only display).
155
+ */
156
+ readonly contentFormat: string;
157
+ /** Capture the current document state as bytes. */
158
+ exportRevisionSnapshot(): Uint8Array | Promise<Uint8Array>;
159
+ /**
160
+ * Apply a previously captured snapshot back into the live document.
161
+ * Implementations should produce normal collaborative edits so the
162
+ * change broadcasts to peers via the standard Yjs path.
163
+ */
164
+ restoreRevisionSnapshot(plaintext: Uint8Array): void | Promise<void>;
165
+ /**
166
+ * Optional read-only preview component name for the History dialog. When
167
+ * absent, the dialog shows metadata only.
168
+ */
169
+ readonly previewKind?: 'text' | 'metadata-only';
170
+ }
16
171
  /**
17
172
  * Context that an editor pushes to the chat panel.
18
173
  * When set, the chat UI shows an indicator and includes this context
@@ -106,6 +261,34 @@ export interface EditorHost {
106
261
  * Set to true by the web share viewer's ReadOnlyEditorHost.
107
262
  */
108
263
  readonly readOnly?: boolean;
264
+ /**
265
+ * Whether the editor is rendered inline inside another document
266
+ * (i.e. as an embed in a markdown doc rather than as a full tab).
267
+ *
268
+ * Extensions can use this to suppress persistent chrome that doesn't make
269
+ * sense inside another doc (e.g., side panels, sticky toolbars). The
270
+ * `readOnly` flag is a separate axis; an embed is typically both `embedded`
271
+ * and `readOnly`, but an extension that opts into writable embeds will see
272
+ * `embedded` true and `readOnly` false.
273
+ *
274
+ * Defaults to false (undefined treated as false for backwards compatibility).
275
+ */
276
+ readonly embedded?: boolean;
277
+ /**
278
+ * Subscribe to changes to `readOnly`.
279
+ *
280
+ * Optional: hosts where `readOnly` never changes after construction
281
+ * (TabEditor, share viewer) omit this. Hosts that allow the user to
282
+ * flip between view and edit modes (the inline embed frame) implement
283
+ * it so extensions can react -- e.g. Excalidraw toggles
284
+ * `viewModeEnabled` so toolbars hide in view mode and reappear in
285
+ * edit mode without remounting the canvas.
286
+ *
287
+ * Extensions should read `host.readOnly` for the current value (it is
288
+ * a getter on reactive hosts) and subscribe here for subsequent flips.
289
+ * Returns an unsubscribe function.
290
+ */
291
+ onReadOnlyChanged?(callback: (readOnly: boolean) => void): () => void;
109
292
  /**
110
293
  * Subscribe to theme changes.
111
294
  * Called when the application theme changes.
@@ -273,6 +456,21 @@ export interface EditorHost {
273
456
  * ```
274
457
  */
275
458
  registerEditorAPI(api: unknown | null): void;
459
+ /**
460
+ * Present only when this document was opened collaboratively.
461
+ *
462
+ * When defined, the extension MUST drive its state through `collaboration.yDoc`
463
+ * and use the SDK's `useCollaborativeEditor` hook to manage the binding
464
+ * lifecycle. In collab mode, the host does not invoke `onSaveRequested` --
465
+ * persistence is the server's encrypted blob store.
466
+ *
467
+ * When undefined, the extension operates in local-only mode (load from
468
+ * disk via `loadContent()`, save via `saveContent()`).
469
+ *
470
+ * Extensions opt in by declaring `collaboration.supported: true` in their
471
+ * editor contribution manifest entry.
472
+ */
473
+ readonly collaboration?: CollaborationContext;
276
474
  /**
277
475
  * Register menu items to appear in the editor's "..." actions menu.
278
476
  * Items appear in a dedicated "Extension" section of the dropdown.
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../src/types/editor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAMnD;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;IAEd,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,6CAA6C;IAC7C,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,wDAAwD;IACxD,eAAe,EAAE,MAAM,CAAC;IAExB,iDAAiD;IACjD,eAAe,EAAE,MAAM,CAAC;IAExB,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IAEd,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC;IAEhB,oDAAoD;IACpD,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,UAAU;IAGzB,6CAA6C;IAC7C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,8BAA8B;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,oBAAoB;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,0CAA0C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C3D,cAAc,EAAE,MAAM,CAAC;IAEvB,oBAAoB;IACpB,KAAK,EAAE,MAAM,CAAC;IAEd,0DAA0D;IAC1D,QAAQ,EAAE,OAAO,CAAC;IAElB,yCAAyC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAE7B;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAE3C;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,MAAM,KAAK,IAAI,CAAC;IAEzD,qDAAqD;IACrD,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAE3B,uDAAuD;IACvD,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,0BAA0B;IAC1B,UAAU,EAAE,MAAM,MAAM,CAAC;IAEzB,mCAAmC;IACnC,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAEtC,uBAAuB;IACvB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB"}
@@ -24,6 +24,10 @@ export interface MonacoEditorConfig {
24
24
  extensionThemeId?: string;
25
25
  /** Whether this editor's tab is active */
26
26
  isActive?: boolean;
27
+ /** Optional transform from stored file content to visible editor content */
28
+ transformLoadContent?: (content: string) => string;
29
+ /** Optional transform from visible editor content back to stored file content */
30
+ transformSaveContent?: (content: string) => string;
27
31
  }
28
32
  export interface MonacoEditorProps {
29
33
  /** Host service for all editor-host communication */
@@ -1 +1 @@
1
- {"version":3,"file":"editors.d.ts","sourceRoot":"","sources":["../../src/types/editors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAM9C,MAAM,WAAW,kBAAkB;IACjC,2BAA2B;IAC3B,KA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