@kitionstage/sdk 0.0.0-stage → 0.5.2-stage.2

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 (259) hide show
  1. package/README.md +73 -2
  2. package/dist/LICENSE +177 -0
  3. package/dist/THIRD_PARTY_NOTICES +28 -0
  4. package/dist/lib/assets/kitEngine.worker-3iMvwtlI.js +12732 -0
  5. package/dist/lib/assets/loro_wasm_bg-Gulzks_0.wasm +0 -0
  6. package/dist/lib/chunks/batch-BWpAyHvP.js +789 -0
  7. package/dist/lib/chunks/canonical-BIWfVCL-.js +87 -0
  8. package/dist/lib/chunks/envelope-D6MGY-ZN.js +61 -0
  9. package/dist/lib/chunks/replica-D8w3I4sn.js +2472 -0
  10. package/dist/lib/chunks/runtime-BVJHE1Pg.js +997 -0
  11. package/dist/lib/chunks/session-BqXC9a1-.js +281 -0
  12. package/dist/lib/chunks/toolIds-BCeSGHpV.js +821 -0
  13. package/dist/lib/chunks/workspaceTree-Destqupf.js +23 -0
  14. package/dist/lib/convergence/index.js +1035 -0
  15. package/dist/lib/convergence/node.js +8 -0
  16. package/dist/lib/embed-server/callbacks.js +37 -0
  17. package/dist/lib/embed-server/cli.js +19 -0
  18. package/dist/lib/embed-server/index.js +272 -0
  19. package/dist/lib/extensions/index.js +439 -0
  20. package/dist/lib/extensions/panel.html +208 -0
  21. package/dist/lib/extensions/runtime.js +198 -0
  22. package/dist/lib/extensions/sandbox.html +35 -0
  23. package/dist/lib/kdm/index.js +437 -0
  24. package/dist/lib/kit-dev-host/checkUiIds.mjs +44 -0
  25. package/dist/lib/kit-dev-host/index.js +308 -0
  26. package/dist/lib/kit-dev-host/lineRow.mjs +47 -0
  27. package/dist/lib/kit-dev-host/modeSmoke.mjs +178 -0
  28. package/dist/lib/kit-editor/index.js +6481 -0
  29. package/dist/lib/kit-editor/styles.css +807 -0
  30. package/dist/lib/kit-editor/workspaceTree.js +1 -0
  31. package/dist/lib/kit-engine/index.js +7 -0
  32. package/dist/lib/kit-host/index.js +530 -0
  33. package/dist/lib/kit-ui-protocol/index.js +336 -0
  34. package/dist/lib/node-only/embed-server-callbacks.js +2 -0
  35. package/dist/lib/node-only/embed-server.js +2 -0
  36. package/dist/lib/sync/index.js +1008 -0
  37. package/dist/lib/sync/openToken.js +201 -0
  38. package/dist/lib/sync/replicaVersions.js +51 -0
  39. package/dist/standalone/chunks/batch-CAGYk6m4.js +789 -0
  40. package/dist/standalone/chunks/client-B9xkOcvf.js +772 -0
  41. package/dist/standalone/chunks/collab-CTQZ9h7J.js +1022 -0
  42. package/dist/standalone/chunks/comment-Ds9t8xSE.js +94 -0
  43. package/dist/standalone/chunks/comments-uVDS8Wxp.js +41 -0
  44. package/dist/standalone/chunks/document-B5MMuYyN.js +324 -0
  45. package/dist/standalone/chunks/envelope-GX4Cynkx.js +7612 -0
  46. package/dist/standalone/chunks/index-BEgEEnhU.js +287 -0
  47. package/dist/standalone/chunks/index-EEl8hGbP.js +1967 -0
  48. package/dist/standalone/chunks/kits-Cp51mDlw.js +9 -0
  49. package/dist/standalone/chunks/replica-Di2iCPiD.js +3281 -0
  50. package/dist/standalone/chunks/replicaVersions-C3rJxnk9.js +50 -0
  51. package/dist/standalone/chunks/touched-T9jKJjxn.js +78 -0
  52. package/dist/standalone/index.js +12 -0
  53. package/dist/standalone/script/index.js +339 -0
  54. package/dist/standalone/script/kits/board.js +5 -0
  55. package/dist/standalone/script/kits/cad.js +5 -0
  56. package/dist/standalone/script/kits/design.js +5 -0
  57. package/dist/standalone/script/kits/doc.js +5 -0
  58. package/dist/standalone/script/kits/film.js +5 -0
  59. package/dist/standalone/script/kits/html.js +5 -0
  60. package/dist/standalone/script/kits/index.js +38 -0
  61. package/dist/standalone/script/kits/layout.js +5 -0
  62. package/dist/standalone/script/kits/motion.js +5 -0
  63. package/dist/standalone/script/kits/note.js +5 -0
  64. package/dist/standalone/script/kits/pdf.js +5 -0
  65. package/dist/standalone/script/kits/photo.js +5 -0
  66. package/dist/standalone/script/kits/scene.js +5 -0
  67. package/dist/standalone/script/kits/sheet.js +5 -0
  68. package/dist/standalone/script/kits/slide.js +5 -0
  69. package/dist/standalone/script/kits/table.js +5 -0
  70. package/dist/standalone/script/kits/vector.js +5 -0
  71. package/dist/standalone/script/node.js +401 -0
  72. package/dist/standalone/script/proxy.js +254 -0
  73. package/dist/types/convergence/src/adapter.d.ts +131 -0
  74. package/dist/types/convergence/src/engine.d.ts +66 -0
  75. package/dist/types/convergence/src/index.d.ts +21 -0
  76. package/dist/types/convergence/src/net.d.ts +52 -0
  77. package/dist/types/convergence/src/node.d.ts +6 -0
  78. package/dist/types/convergence/src/report.d.ts +56 -0
  79. package/dist/types/convergence/src/rng.d.ts +12 -0
  80. package/dist/types/convergence/src/scenarios.d.ts +15 -0
  81. package/dist/types/convergence/src/state.d.ts +67 -0
  82. package/dist/types/embed/src/agent.d.ts +88 -0
  83. package/dist/types/embed/src/blobs.d.ts +2 -0
  84. package/dist/types/embed/src/collab.d.ts +250 -0
  85. package/dist/types/embed/src/comments.d.ts +30 -0
  86. package/dist/types/embed/src/errors.d.ts +24 -0
  87. package/dist/types/embed/src/handlers.d.ts +92 -0
  88. package/dist/types/embed/src/index.d.ts +20 -0
  89. package/dist/types/embed/src/mount.d.ts +39 -0
  90. package/dist/types/embed/src/replicaStore.d.ts +3 -0
  91. package/dist/types/embed/src/rooms.d.ts +40 -0
  92. package/dist/types/embed/src/schemas.d.ts +7 -0
  93. package/dist/types/embed/src/syncClients.d.ts +28 -0
  94. package/dist/types/embed/src/theme.d.ts +7 -0
  95. package/dist/types/embed/src/types.d.ts +596 -0
  96. package/dist/types/embed/src/ui.d.ts +33 -0
  97. package/dist/types/embed/src/version.d.ts +2 -0
  98. package/dist/types/embed-server/src/callbacks.d.ts +30 -0
  99. package/dist/types/embed-server/src/cli.d.ts +1 -0
  100. package/dist/types/embed-server/src/index.d.ts +19 -0
  101. package/dist/types/embed-server/src/page.d.ts +15 -0
  102. package/dist/types/embed-server/src/server.d.ts +39 -0
  103. package/dist/types/embed-server/src/session.d.ts +22 -0
  104. package/dist/types/extensions/src/gate.d.ts +17 -0
  105. package/dist/types/extensions/src/generated/runtime.d.ts +8 -0
  106. package/dist/types/extensions/src/host.d.ts +135 -0
  107. package/dist/types/extensions/src/index.d.ts +13 -0
  108. package/dist/types/extensions/src/manifest.d.ts +82 -0
  109. package/dist/types/extensions/src/protocol.d.ts +159 -0
  110. package/dist/types/extensions/src/rpc.d.ts +52 -0
  111. package/dist/types/extensions/src/runtime/document.d.ts +40 -0
  112. package/dist/types/extensions/src/runtime/index.d.ts +10 -0
  113. package/dist/types/extensions/src/runtime/panel.d.ts +19 -0
  114. package/dist/types/extensions/src/runtime/runtime.d.ts +54 -0
  115. package/dist/types/extensions/src/runtime/worker.d.ts +1 -0
  116. package/dist/types/extensions/src/sandbox.d.ts +41 -0
  117. package/dist/types/kdm/src/args.d.ts +12 -0
  118. package/dist/types/kdm/src/batch.d.ts +118 -0
  119. package/dist/types/kdm/src/canonical.d.ts +25 -0
  120. package/dist/types/kdm/src/comment.d.ts +114 -0
  121. package/dist/types/kdm/src/diff.d.ts +125 -0
  122. package/dist/types/kdm/src/envelope.d.ts +27 -0
  123. package/dist/types/kdm/src/errors.d.ts +28 -0
  124. package/dist/types/kdm/src/footprint.d.ts +21 -0
  125. package/dist/types/kdm/src/ids.d.ts +57 -0
  126. package/dist/types/kdm/src/index.d.ts +18 -0
  127. package/dist/types/kdm/src/marks.d.ts +32 -0
  128. package/dist/types/kdm/src/op.d.ts +124 -0
  129. package/dist/types/kdm/src/origin.d.ts +41 -0
  130. package/dist/types/kdm/src/overlay.d.ts +92 -0
  131. package/dist/types/kdm/src/projection.d.ts +29 -0
  132. package/dist/types/kdm/src/read.d.ts +90 -0
  133. package/dist/types/kdm/src/replica.d.ts +403 -0
  134. package/dist/types/kdm/src/schema.d.ts +185 -0
  135. package/dist/types/kdm/src/testing.d.ts +28 -0
  136. package/dist/types/kdm/src/toolIds.d.ts +61 -0
  137. package/dist/types/kdm/src/touched.d.ts +24 -0
  138. package/dist/types/kdm/src/tx.d.ts +215 -0
  139. package/dist/types/kdm/src/value.d.ts +23 -0
  140. package/dist/types/kit-dev-host/src/checkNoPaths.d.ts +19 -0
  141. package/dist/types/kit-dev-host/src/checkUiIds.d.mts +2 -0
  142. package/dist/types/kit-dev-host/src/index.d.ts +179 -0
  143. package/dist/types/kit-dev-host/src/lineRow.d.mts +14 -0
  144. package/dist/types/kit-dev-host/src/memoryFiles.d.ts +15 -0
  145. package/dist/types/kit-dev-host/src/modeSmoke.d.mts +8 -0
  146. package/dist/types/kit-editor/src/CommandDialog.d.ts +22 -0
  147. package/dist/types/kit-editor/src/CommentsPanel.d.ts +45 -0
  148. package/dist/types/kit-editor/src/CustomizeDialog.d.ts +32 -0
  149. package/dist/types/kit-editor/src/HostButtons.d.ts +11 -0
  150. package/dist/types/kit-editor/src/RenderFailure.d.ts +7 -0
  151. package/dist/types/kit-editor/src/TextSink.d.ts +6 -0
  152. package/dist/types/kit-editor/src/brand.d.ts +2 -0
  153. package/dist/types/kit-editor/src/catalogMenus.d.ts +27 -0
  154. package/dist/types/kit-editor/src/chart.d.ts +138 -0
  155. package/dist/types/kit-editor/src/conflicts.d.ts +12 -0
  156. package/dist/types/kit-editor/src/drawing.d.ts +83 -0
  157. package/dist/types/kit-editor/src/editor.d.ts +544 -0
  158. package/dist/types/kit-editor/src/engine/KitCanvas.d.ts +70 -0
  159. package/dist/types/kit-editor/src/engine/backdrop.d.ts +32 -0
  160. package/dist/types/kit-editor/src/engine/createKitFile.d.ts +12 -0
  161. package/dist/types/kit-editor/src/engine/decorations.d.ts +14 -0
  162. package/dist/types/kit-editor/src/engine/engineOverlays.d.ts +197 -0
  163. package/dist/types/kit-editor/src/engine/engineTools.d.ts +116 -0
  164. package/dist/types/kit-editor/src/engine/kitDraft.d.ts +70 -0
  165. package/dist/types/kit-editor/src/engine/kitEngine.d.ts +390 -0
  166. package/dist/types/kit-editor/src/engine/kitEngine.worker.d.ts +30 -0
  167. package/dist/types/kit-editor/src/engine/kitHost.d.ts +41 -0
  168. package/dist/types/kit-editor/src/engine/kitModel.d.ts +32 -0
  169. package/dist/types/kit-editor/src/engine/kitModelRunner.d.ts +99 -0
  170. package/dist/types/kit-editor/src/engine/kitModule.d.ts +185 -0
  171. package/dist/types/kit-editor/src/engine/kitShortcuts.d.ts +32 -0
  172. package/dist/types/kit-editor/src/engine/kitTools.d.ts +79 -0
  173. package/dist/types/kit-editor/src/engine/lazyFonts.d.ts +34 -0
  174. package/dist/types/kit-editor/src/engine/lentFiles.d.ts +29 -0
  175. package/dist/types/kit-editor/src/engine/rasterViewport.d.ts +178 -0
  176. package/dist/types/kit-editor/src/engine/readOnly.d.ts +78 -0
  177. package/dist/types/kit-editor/src/engine/refusal.d.ts +39 -0
  178. package/dist/types/kit-editor/src/engine/replica.d.ts +23 -0
  179. package/dist/types/kit-editor/src/engine/useKitDocument.d.ts +154 -0
  180. package/dist/types/kit-editor/src/engine/workerRelay.d.ts +62 -0
  181. package/dist/types/kit-editor/src/files.d.ts +74 -0
  182. package/dist/types/kit-editor/src/frame/EditorFrame.d.ts +74 -0
  183. package/dist/types/kit-editor/src/frame/FocusBar.d.ts +10 -0
  184. package/dist/types/kit-editor/src/frame/MenuNodes.d.ts +20 -0
  185. package/dist/types/kit-editor/src/frame/MenuRibbon.d.ts +8 -0
  186. package/dist/types/kit-editor/src/frame/ModeButton.d.ts +7 -0
  187. package/dist/types/kit-editor/src/frame/menus.d.ts +64 -0
  188. package/dist/types/kit-editor/src/frame/modes.d.ts +51 -0
  189. package/dist/types/kit-editor/src/frame/useFrameLayout.d.ts +34 -0
  190. package/dist/types/kit-editor/src/host.d.ts +127 -0
  191. package/dist/types/kit-editor/src/index.d.ts +85 -0
  192. package/dist/types/kit-editor/src/ink.d.ts +26 -0
  193. package/dist/types/kit-editor/src/lease.d.ts +53 -0
  194. package/dist/types/kit-editor/src/oneInFlight.d.ts +7 -0
  195. package/dist/types/kit-editor/src/phrases.d.ts +25 -0
  196. package/dist/types/kit-editor/src/presence.d.ts +79 -0
  197. package/dist/types/kit-editor/src/strings.d.ts +6 -0
  198. package/dist/types/kit-editor/src/toolIcons.d.ts +32 -0
  199. package/dist/types/kit-editor/src/uiCatalog.d.ts +59 -0
  200. package/dist/types/kit-editor/src/uiConfig.d.ts +53 -0
  201. package/dist/types/kit-editor/src/uiContext.d.ts +65 -0
  202. package/dist/types/kit-editor/src/uiStore.d.ts +20 -0
  203. package/dist/types/kit-editor/src/useCommentAnchors.d.ts +29 -0
  204. package/dist/types/kit-editor/src/useKitSession.d.ts +115 -0
  205. package/dist/types/kit-editor/src/workspaceTree.d.ts +5 -0
  206. package/dist/types/kit-engine/src/contract.d.ts +154 -0
  207. package/dist/types/kit-engine/src/index.d.ts +2 -0
  208. package/dist/types/kit-engine/src/session.d.ts +133 -0
  209. package/dist/types/kit-host/src/files.d.ts +163 -0
  210. package/dist/types/kit-host/src/index.d.ts +315 -0
  211. package/dist/types/kit-ui-protocol/src/index.d.ts +1145 -0
  212. package/dist/types/loro-crdt.d.ts +9 -0
  213. package/dist/types/script/kits/board.d.ts +534 -0
  214. package/dist/types/script/kits/cad.d.ts +2937 -0
  215. package/dist/types/script/kits/design.d.ts +3213 -0
  216. package/dist/types/script/kits/doc.d.ts +2575 -0
  217. package/dist/types/script/kits/film.d.ts +4067 -0
  218. package/dist/types/script/kits/html.d.ts +38 -0
  219. package/dist/types/script/kits/index.d.ts +20 -0
  220. package/dist/types/script/kits/layout.d.ts +3483 -0
  221. package/dist/types/script/kits/motion.d.ts +4826 -0
  222. package/dist/types/script/kits/note.d.ts +631 -0
  223. package/dist/types/script/kits/pdf.d.ts +829 -0
  224. package/dist/types/script/kits/photo.d.ts +7574 -0
  225. package/dist/types/script/kits/scene.d.ts +2962 -0
  226. package/dist/types/script/kits/sheet.d.ts +2419 -0
  227. package/dist/types/script/kits/slide.d.ts +1894 -0
  228. package/dist/types/script/kits/table.d.ts +654 -0
  229. package/dist/types/script/kits/vector.d.ts +5167 -0
  230. package/dist/types/script/src/agentRelay.d.ts +48 -0
  231. package/dist/types/script/src/capabilities.d.ts +21 -0
  232. package/dist/types/script/src/document.d.ts +87 -0
  233. package/dist/types/script/src/drafts.d.ts +141 -0
  234. package/dist/types/script/src/exchange.d.ts +30 -0
  235. package/dist/types/script/src/headless.d.ts +190 -0
  236. package/dist/types/script/src/index.d.ts +15 -0
  237. package/dist/types/script/src/kitModel.d.ts +17 -0
  238. package/dist/types/script/src/kits.d.ts +8 -0
  239. package/dist/types/script/src/node.d.ts +42 -0
  240. package/dist/types/script/src/port.d.ts +89 -0
  241. package/dist/types/script/src/proxy.d.ts +132 -0
  242. package/dist/types/script/src/room.d.ts +162 -0
  243. package/dist/types/script/src/sources.d.ts +73 -0
  244. package/dist/types/sync/src/backoff.d.ts +9 -0
  245. package/dist/types/sync/src/blobSection.d.ts +23 -0
  246. package/dist/types/sync/src/capabilities.d.ts +20 -0
  247. package/dist/types/sync/src/client.d.ts +253 -0
  248. package/dist/types/sync/src/framing.d.ts +35 -0
  249. package/dist/types/sync/src/hash.d.ts +2 -0
  250. package/dist/types/sync/src/index.d.ts +19 -0
  251. package/dist/types/sync/src/leases.d.ts +82 -0
  252. package/dist/types/sync/src/openToken.d.ts +104 -0
  253. package/dist/types/sync/src/protocol.d.ts +484 -0
  254. package/dist/types/sync/src/relay.d.ts +52 -0
  255. package/dist/types/sync/src/replicaVersions.d.ts +17 -0
  256. package/dist/types/sync/src/saveMachine.d.ts +83 -0
  257. package/dist/types/sync/src/saveRun.d.ts +52 -0
  258. package/dist/types/sync/src/transport.d.ts +19 -0
  259. package/package.json +229 -4
@@ -0,0 +1,48 @@
1
+ /**
2
+ * The server's end of an agent relay to an editor open in a person's page (`@kition/sdk/embed`
3
+ * `editor.agentPort`, `KitEmbed 1.3`). The integrator's agent sends MCP messages (`request`); the
4
+ * page takes them (`next`, for example over HTTP long polling or a WebSocket) into its editor's
5
+ * agent port (`relayAgentPort`) and sends the replies back (`reply`). The relay renumbers requests,
6
+ * so several agents can share one page without their ids colliding.
7
+ *
8
+ * Transport-neutral and dependency-free: it runs in Node and in any server runtime.
9
+ */
10
+ /** One JSON-RPC 2.0 message (MCP). */
11
+ export type RelayMessage = {
12
+ jsonrpc: '2.0';
13
+ id?: string | number | null;
14
+ method?: string;
15
+ params?: unknown;
16
+ result?: unknown;
17
+ error?: {
18
+ code: number;
19
+ message: string;
20
+ data?: unknown;
21
+ };
22
+ };
23
+ export type AgentRelay = {
24
+ /**
25
+ * The agent's side: sends one message to the page's editor and answers its reply (`null` for a
26
+ * notification). Rejects when no page takes it within `timeoutMs` (default 60 s) or the relay closes.
27
+ */
28
+ request: (message: RelayMessage, options?: {
29
+ timeoutMs?: number;
30
+ }) => Promise<RelayMessage | null>;
31
+ /**
32
+ * The page's side: the next message for the editor, or `null` when none came within `waitMs`
33
+ * (default 25 s). Abort `signal` when the page's connection closes (a long poll whose page went
34
+ * away): the relay then stops waiting on it, and keeps a message that arrives meanwhile for the next.
35
+ */
36
+ next: (options?: {
37
+ waitMs?: number;
38
+ signal?: AbortSignal;
39
+ }) => Promise<RelayMessage | null>;
40
+ /** The page's side: the editor's reply to a message `next` gave. */
41
+ reply: (message: RelayMessage) => void;
42
+ /** Whether a page asked for messages within the last `staleMs` (default 30 s). */
43
+ connected: (staleMs?: number) => boolean;
44
+ /** Refuses waiting and later requests. */
45
+ close: () => void;
46
+ };
47
+ /** A relay between an agent and one editor in a page (see the module comment). */
48
+ export declare function createAgentRelay(): AgentRelay;
@@ -0,0 +1,21 @@
1
+ /** The capability sets of the Kition kit platform. */
2
+ export declare const CAPABILITY_SETS: {
3
+ readonly model: "KitModel 1.1";
4
+ readonly collab: "KitCollab 1.0";
5
+ readonly objectModel: "KitObjectModel 1.0";
6
+ readonly extensions: "KitExtensions 1.0";
7
+ readonly embed: "KitEmbed 1.0";
8
+ };
9
+ /**
10
+ * Declares the sets the environment a script runs in serves (a host's `capabilitySets`, a sync
11
+ * server's `sync/hello` capabilities): what `supports` tests when given no list.
12
+ */
13
+ export declare function advertiseCapabilitySets(sets: readonly string[]): void;
14
+ /** The sets `supports` tests by default. */
15
+ export declare function capabilitySets(): readonly string[];
16
+ /**
17
+ * Whether `required` (such as `'KitCollab 1.0'`) is served by `sets` (by default what
18
+ * `advertiseCapabilitySets` declared): a set of the same name and major version with at least its
19
+ * minor version. A malformed name is never supported.
20
+ */
21
+ export declare function supports(required: string, sets?: readonly string[]): boolean;
@@ -0,0 +1,87 @@
1
+ import type { BatchRequest, BatchResult, Origin, Schema } from '../../kdm/src/index.js';
2
+ import { Exchange, type ModelDescription } from './exchange.js';
3
+ import type { DocumentEventName, DocumentEvents, DocumentEventSource, KitCommandInfo } from './port.js';
4
+ import { RequestContext, type CommandMap, type ModelObject } from './proxy.js';
5
+ /** The document moved: by this handle's own `sync()` (`local`) or otherwise (`kit`: a person, a command, a collaborator). */
6
+ export type ChangedEvent = {
7
+ origin: 'local' | 'kit';
8
+ version: Uint8Array | null;
9
+ };
10
+ export type OpenOptions = {
11
+ /** The kit's schema; by default the one registered for the kit's id (`registerKit`). */
12
+ schema?: Schema | object;
13
+ /** The kit's id, for an engine (which does not name its kit). */
14
+ kit?: string;
15
+ /** The origin every batch of this handle carries; `extension`/`script` by default. */
16
+ origin?: Origin;
17
+ };
18
+ /**
19
+ * What answers a document's `model/describe` and `model/batch`: an `Exchange` over a `ModelPort`
20
+ * (the object model on the host's side), or a kit that serves the object model itself (a
21
+ * headless kit executable over the Kit Process Protocol, `@kition/sdk/script/node`'s `launchHeadlessKit`).
22
+ */
23
+ export interface ModelBackend extends DocumentEventSource {
24
+ readonly kitId: string;
25
+ readonly schema: Schema;
26
+ batch(request: BatchRequest): Promise<BatchResult>;
27
+ describe(): Promise<ModelDescription>;
28
+ commands(): Promise<KitCommandInfo[]>;
29
+ /** The document's version after this handle's last batch, when known. */
30
+ version(): Uint8Array | null;
31
+ /** Hears the document move (its version when known). */
32
+ onChanged?(listener: (version: Uint8Array | null) => void): () => void;
33
+ }
34
+ /** An `Exchange` as a `ModelBackend`. */
35
+ export declare function exchangeBackend(exchange: Exchange): ModelBackend;
36
+ /** A document opened for scripting: run batches through request contexts, and hear its changes. */
37
+ export declare class ModelDocument<Root extends ModelObject = ModelObject, C extends CommandMap = CommandMap> {
38
+ readonly backend: ModelBackend;
39
+ private readonly origin?;
40
+ private listeners;
41
+ private unsubscribe;
42
+ /** Unsubscribes of the source's other events this handle hears. */
43
+ private hearing;
44
+ private closed;
45
+ constructor(backend: ModelBackend, origin?: Origin | undefined);
46
+ get kitId(): string;
47
+ get schema(): Schema;
48
+ /**
49
+ * Runs `script` with a new request context; operations it queued and did not `sync()` are sent
50
+ * when it returns. Answers what `script` answers.
51
+ */
52
+ run<T>(script: (context: RequestContext<Root, C>) => Promise<T> | T): Promise<T>;
53
+ /** A request context to keep (`run` makes one per script). */
54
+ context(): RequestContext<Root, C>;
55
+ /** One `model/batch` in its wire form. */
56
+ batch(request: BatchRequest): Promise<BatchResult>;
57
+ /** `model/describe`: the schema, the root's id, and the kit's commands. */
58
+ describe(): Promise<ModelDescription>;
59
+ readonly commands: {
60
+ list: () => Promise<KitCommandInfo[]>;
61
+ /** Whether a command can run now. */
62
+ enabled: (id: string) => Promise<boolean>;
63
+ /** Runs one command now (outside any request context). */
64
+ run: <K extends keyof C & string>(id: K, params?: C[K]) => Promise<unknown>;
65
+ };
66
+ /**
67
+ * Whether this document's source reports `event`: `changed` always; `saved`, `presence`,
68
+ * `conflict`, and `selection` when its host or kit does (an `@kition/sdk/embed` editor reports
69
+ * `saved` and `conflict`, and `presence` when it co-edits; a headless kit and a Node package
70
+ * document report `saved`).
71
+ */
72
+ supports(event: 'changed' | DocumentEventName): boolean;
73
+ /** Hears an event; answers an unsubscribe. An event the source does not report (`supports`) is never heard. */
74
+ on(event: 'changed', listener: (event: ChangedEvent) => void): () => void;
75
+ on<E extends DocumentEventName>(event: E, listener: (event: DocumentEvents[E]) => void): () => void;
76
+ /** Stops listening to the engine; the engine (or the kit's document) itself stays open. */
77
+ close(): void;
78
+ private alive;
79
+ private emit;
80
+ }
81
+ /**
82
+ * Opens a document for scripting. `source` is a `ModelPort`, an `@kition/sdk/embed` editor, a
83
+ * `KitConnection` (`@kition/sdk/host`) whose kit has the `replica` or `model` capability, or a kit
84
+ * engine (`options.kit` names its kit). A kit that answers the object model itself (`port.model`)
85
+ * runs each batch as one undo step of the person's history; otherwise the batch runs here.
86
+ */
87
+ export declare function openDocument<Root extends ModelObject = ModelObject, C extends CommandMap = CommandMap>(source: unknown, options?: OpenOptions): Promise<ModelDocument<Root, C>>;
@@ -0,0 +1,141 @@
1
+ /** A draft as `drafts list` answers it. */
2
+ export type WorkspaceDraft = {
3
+ version: 1;
4
+ /** The file's workspace path. */
5
+ path: string;
6
+ kit: string;
7
+ /** `replica`: a fork of the file's replica; `file`: a copy of the file. Either can have an object comparison. */
8
+ mode: 'replica' | 'file';
9
+ /** In `file` mode: the kit's error that kept the draft from forking the file's replica. */
10
+ replicaError?: string;
11
+ state: 'open' | 'ready';
12
+ /** The file's SHA-256 when the draft forked. */
13
+ baseSha256: string;
14
+ /** Unix milliseconds. */
15
+ created: number;
16
+ updated: number;
17
+ /** The file changed since the draft forked: merging is refused unless `overwrite`. */
18
+ stale: boolean;
19
+ };
20
+ /** The same object id form receipts use: integer tool ids stay numbers. */
21
+ export type DraftObjectId = string | number;
22
+ export type DraftPosition = {
23
+ parent: DraftObjectId;
24
+ field: string;
25
+ index: number;
26
+ };
27
+ /** A JSON field value; long values use the receipt's `{ excerpt, length }` object. */
28
+ export type DraftValue = null | boolean | number | string | DraftValue[] | {
29
+ [key: string]: DraftValue;
30
+ };
31
+ export type DraftObjectChange = {
32
+ id: DraftObjectId;
33
+ type: string;
34
+ fields: string[];
35
+ values?: Record<string, DraftValue>;
36
+ at?: DraftPosition;
37
+ edits?: Array<{
38
+ field: string;
39
+ before: DraftValue;
40
+ after: DraftValue;
41
+ named?: string;
42
+ }>;
43
+ };
44
+ /** The generic receipt change set a person reviews (A13), with bounded text values. */
45
+ export type DraftDiff = {
46
+ created: DraftObjectChange[];
47
+ changed: DraftObjectChange[];
48
+ moved: Array<{
49
+ id: DraftObjectId;
50
+ type: string;
51
+ from: DraftPosition | null;
52
+ to: DraftPosition | null;
53
+ }>;
54
+ deleted: DraftObjectChange[];
55
+ texts: Array<{
56
+ id: DraftObjectId;
57
+ field: string;
58
+ before: string | {
59
+ excerpt: string;
60
+ length: number;
61
+ };
62
+ after: string | {
63
+ excerpt: string;
64
+ length: number;
65
+ };
66
+ }>;
67
+ /** Ambiguous identities on reread, in the generic diff's string form. */
68
+ renumbered?: string[];
69
+ /** Omitted entries by list; nested counts aggregate across retained entries. Absent if complete. */
70
+ truncated?: {
71
+ created: number;
72
+ changed: number;
73
+ moved: number;
74
+ deleted: number;
75
+ texts?: number;
76
+ renumbered?: number;
77
+ fields?: number;
78
+ edits?: number;
79
+ members?: number;
80
+ values?: number;
81
+ };
82
+ };
83
+ /** What `drafts compare` answers. */
84
+ export type DraftComparison = {
85
+ path: string;
86
+ kit: string;
87
+ mode: 'replica' | 'file';
88
+ state: 'open' | 'ready';
89
+ stale: boolean;
90
+ /** Bounded object comparison in either mode; `null` when unavailable (`diffUnavailable` says why). */
91
+ diff: DraftDiff | null;
92
+ diffUnavailable?: string;
93
+ /** One line on each side, from the kit. */
94
+ summary: {
95
+ base?: string;
96
+ draft?: string;
97
+ };
98
+ /** With `previews`: both sides rendered by the kit, base64 PNG. */
99
+ previews?: {
100
+ base?: string;
101
+ draft?: string;
102
+ };
103
+ };
104
+ /** A refused command: `not-found`, `stale`, or a kit tool error code. */
105
+ export declare class DraftCommandError extends Error {
106
+ readonly code: string;
107
+ constructor(code: string, message: string);
108
+ }
109
+ export type WorkspaceDraftsOptions = {
110
+ /** The `kition-kits-mcp` executable. */
111
+ server: string;
112
+ /** Arguments before `drafts`, for a server started through another program. */
113
+ serverArgs?: string[];
114
+ /** The workspace folder the agent's server works in. */
115
+ workspace: string;
116
+ /** Kit executables by kit (`{ note: 'bin/kition-note' }`), passed as `--kit`. */
117
+ kits?: Record<string, string>;
118
+ /** A folder of `kition-<kit>` executables (`--kits-dir`). */
119
+ kitsDir?: string;
120
+ env?: NodeJS.ProcessEnv;
121
+ };
122
+ export type WorkspaceDrafts = {
123
+ list: () => Promise<WorkspaceDraft[]>;
124
+ compare: (path: string, options?: {
125
+ previews?: boolean;
126
+ }) => Promise<DraftComparison>;
127
+ /** Writes the draft as the file. Refused (`stale`) when the file changed since the draft forked, unless `overwrite`. */
128
+ merge: (path: string, options?: {
129
+ overwrite?: boolean;
130
+ }) => Promise<{
131
+ path: string;
132
+ merged: true;
133
+ sha256: string;
134
+ }>;
135
+ discard: (path: string) => Promise<{
136
+ path: string;
137
+ discarded: true;
138
+ }>;
139
+ };
140
+ /** The drafts of `options.workspace`, through `kition-kits-mcp drafts`. */
141
+ export declare function workspaceDrafts(options: WorkspaceDraftsOptions): WorkspaceDrafts;
@@ -0,0 +1,30 @@
1
+ import { describeModel, type BatchRequest, type BatchResult, type Schema, type Version } from '../../kdm/src/index.js';
2
+ import type { KitCommandInfo, ModelPort } from './port.js';
3
+ /** `model/describe`'s answer: the schema, the root's id, and the kit's commands. */
4
+ export type ModelDescription = ReturnType<typeof describeModel> & {
5
+ commands: KitCommandInfo[];
6
+ };
7
+ /**
8
+ * The host's side of the object model over a `ModelPort` (the twin of `kition_kit::session::model::Exchange`):
9
+ * a scratch replica of the document, caught up with the engine's changes before every read and
10
+ * write. A batch's model operations run on it as transactions whose changes go to the engine; its
11
+ * commands go to the engine between them. Batches run one at a time.
12
+ */
13
+ export declare class Exchange {
14
+ readonly port: ModelPort;
15
+ private scratch;
16
+ private queue;
17
+ readonly schema: Schema;
18
+ constructor(port: ModelPort, schema: Schema | object);
19
+ /** The scratch replica's version after the last batch, or `null` before the first. */
20
+ version(): Version | null;
21
+ private catchUp;
22
+ private target;
23
+ private serial;
24
+ /** `model/batch`. */
25
+ batch(request: BatchRequest): Promise<BatchResult>;
26
+ /** `model/describe`: the schema, the root, and the kit's commands. */
27
+ describe(): Promise<ModelDescription>;
28
+ /** Forgets the scratch replica (the engine opened another document). */
29
+ reset(): void;
30
+ }
@@ -0,0 +1,190 @@
1
+ /**
2
+ * Kition's kits from Node, through `kition-kits serve`: the Kits Service API every host language
3
+ * uses (`docs/sdk/hosts.md`). This process starts one service for a workspace folder and opens,
4
+ * edits, and saves its files by path; the service runs each kit's headless executable and serves
5
+ * it the files over the Kit Process Protocol (handles, staged and atomic writes, version checks). A
6
+ * kit that serves the object model is scripted with the same proxies as a page
7
+ * (`HeadlessDocument.model()`).
8
+ *
9
+ * Wire: JSON-RPC 2.0, one message per line, on the service's standard input and output.
10
+ */
11
+ import { type ChildProcess } from 'node:child_process';
12
+ import type { Readable, Writable } from 'node:stream';
13
+ import { type BatchErrorCode } from '../../kdm/src/index.js';
14
+ import { ModelDocument, type OpenOptions } from './document.js';
15
+ import type { ConflictEvent, KitCommandInfo, SavedEvent } from './port.js';
16
+ import type { CommandMap, ModelObject } from './proxy.js';
17
+ /** The Kits Service API version this client speaks (`kits.initialize`'s `serviceVersion`). */
18
+ export declare const KITS_SERVICE_VERSION = 1;
19
+ /**
20
+ * An error the service answered: `reason` is the Kit Process Protocol's (`file_conflict`,
21
+ * `command_not_found`, …) or the service's (`kit_unavailable`, `invalid_path`, `unknown_kit`).
22
+ */
23
+ export declare class KitProtocolError extends Error {
24
+ readonly code: number;
25
+ readonly data?: ({
26
+ reason?: string;
27
+ detail?: string;
28
+ model?: {
29
+ code: BatchErrorCode;
30
+ index: number | null;
31
+ message: string;
32
+ };
33
+ } & Record<string, unknown>) | undefined;
34
+ constructor(code: number, message: string, data?: ({
35
+ reason?: string;
36
+ detail?: string;
37
+ model?: {
38
+ code: BatchErrorCode;
39
+ index: number | null;
40
+ message: string;
41
+ };
42
+ } & Record<string, unknown>) | undefined);
43
+ get reason(): string | undefined;
44
+ }
45
+ /** A JSON-RPC connection over newline-delimited messages: the service's stdout in, stdin out. */
46
+ export declare class KitProtocolConnection {
47
+ private readonly output;
48
+ private next;
49
+ private pending;
50
+ private closedWith;
51
+ constructor(input: Readable, output: Writable);
52
+ /** Sends a request; answers its `result`, or throws its `error` as a `KitProtocolError`. */
53
+ request<T = unknown>(method: string, params?: object): Promise<T>;
54
+ /** Ends the connection: the service shuts its kits down and exits. */
55
+ close(): void;
56
+ private message;
57
+ private fail;
58
+ }
59
+ /** A document open in a kit, as the service reports it. */
60
+ export type HeadlessDocumentState = {
61
+ kitId: string;
62
+ documentId: string;
63
+ /** The workspace path, `/`-separated. */
64
+ path: string | null;
65
+ title: string;
66
+ format: string;
67
+ readOnly: boolean;
68
+ dirty: boolean;
69
+ canUndo: boolean;
70
+ canRedo: boolean;
71
+ /** The file changed under unsaved edits: `save()` fails `file_conflict`; `reload()` or `saveAs()`. */
72
+ conflict: boolean;
73
+ /** Counts the kit's changes, so a view knows when to refresh. */
74
+ version: number;
75
+ summary: string;
76
+ details: Record<string, unknown>;
77
+ };
78
+ /** A kit the service knows (`kits.list`). */
79
+ export type KitStatus = {
80
+ id: string;
81
+ name: string;
82
+ extensions: string[];
83
+ creates: string[];
84
+ installed: boolean;
85
+ };
86
+ export type LaunchOptions = {
87
+ /** The workspace folder: every path is relative to it, and no file outside it is reached. */
88
+ workspace: string;
89
+ /** A folder with one folder per kit holding its `kit.json` (an SDK bundle's `kits/`). */
90
+ kitsDir?: string;
91
+ /** Kit executables, each found with the `kit.json` above it that names it. */
92
+ kits?: string[];
93
+ /** The `kition-kits` executable: `KITION_KITS` by default, else `kition-kits` on the PATH. */
94
+ executable?: string;
95
+ /**
96
+ * Extra environment for the service. Its kits start with the launch environment of the Kit Process
97
+ * Protocol (section 3): a private folder for their current folder, home and temporary folder,
98
+ * and of these variables only `KITION_FONTS_DIR`, `SOURCE_DATE_EPOCH`, `RUST_LOG`,
99
+ * `RUST_BACKTRACE` and the `KITION_KIT_*` ones.
100
+ */
101
+ env?: Record<string, string>;
102
+ /** `inherit` shows the service's and the kits' stderr; `ignore` (default) drops it. */
103
+ stderr?: 'inherit' | 'ignore';
104
+ };
105
+ export type HeadlessOpenOptions = {
106
+ /** For a file that does not exist yet: options for the kit's new document (`width`, …). */
107
+ create?: {
108
+ options?: Record<string, unknown>;
109
+ };
110
+ };
111
+ /** `kition-kits serve` for one workspace, with this process as its host. */
112
+ export declare class KitsService {
113
+ readonly connection: KitProtocolConnection;
114
+ readonly workspace: string;
115
+ readonly kits: KitStatus[];
116
+ private readonly child;
117
+ private constructor();
118
+ /** Starts `kition-kits serve` on `options.workspace` and initializes it. */
119
+ static launch(options: LaunchOptions): Promise<KitsService>;
120
+ /** Initializes a service over an existing connection (tests, or one another process started). */
121
+ static connect(connection: KitProtocolConnection, workspace: string, child?: ChildProcess | null): Promise<KitsService>;
122
+ /** The workspace path of `path` (absolute, or already relative to the workspace). */
123
+ private relative;
124
+ /** Opens the workspace file `path` in the kit that handles its extension. */
125
+ open(path: string): Promise<HeadlessDocument>;
126
+ /**
127
+ * A new document at `path`, saved so the file exists. A new file never replaces one: when
128
+ * `path` exists, the next free name (`Title 2.kslide`) is used; the document's `state.path` says.
129
+ */
130
+ create(path: string, options?: HeadlessOpenOptions['create']): Promise<HeadlessDocument>;
131
+ /** Ends the service, which shuts its kits down (documents close unsaved), and waits for it. */
132
+ shutdown(): Promise<void>;
133
+ }
134
+ /** One document open in a kit. */
135
+ export declare class HeadlessDocument {
136
+ readonly service: KitsService;
137
+ private current;
138
+ private readonly savedListeners;
139
+ private readonly conflictListeners;
140
+ constructor(service: KitsService, current: HeadlessDocumentState);
141
+ get id(): string;
142
+ get kitId(): string;
143
+ /** The document's state as the service last answered it. */
144
+ get state(): HeadlessDocumentState;
145
+ /** Asks the service for the document's state again. */
146
+ refresh(): Promise<HeadlessDocumentState>;
147
+ /**
148
+ * The object model over this document, served by the kit (`model.describe`, `model.batch`).
149
+ * The schema is the one registered for the kit (`@kition/sdk/script/kits/*`), else the kit's own
150
+ * (`model.describe`).
151
+ */
152
+ model<Root extends ModelObject = ModelObject, C extends CommandMap = CommandMap>(options?: OpenOptions): Promise<ModelDocument<Root, C>>;
153
+ /** `commands.list` for this document. */
154
+ commands(): Promise<KitCommandInfo[]>;
155
+ /**
156
+ * Runs a command outside the object model: as the host's person (`user`), the agent, or the
157
+ * host itself on the person's behalf (`system`, by the host feature `originLabel`, `emailsync`).
158
+ * A `system` change is no undo step: neither the person's undo nor an agent's takes it back.
159
+ */
160
+ execute(command: string, params?: Record<string, unknown>, origin?: 'user' | 'agent' | 'system', originLabel?: string): Promise<unknown>;
161
+ /**
162
+ * Writes the document to its file. The save commits only while the file is the version the
163
+ * kit read: a file changed meanwhile is a `KitProtocolError` with reason `file_conflict`.
164
+ */
165
+ save(): Promise<void>;
166
+ /** Writes it to the workspace file `path`, in `format` or the file's; the document then lives there. */
167
+ saveAs(path: string, format?: string): Promise<void>;
168
+ /** Reads the file again, dropping unsaved edits: resolves a conflict in favour of the file. */
169
+ reload(): Promise<void>;
170
+ close(discardChanges?: boolean): Promise<void>;
171
+ /** Hears this document's saves made through this handle. */
172
+ onSaved(listener: (event: SavedEvent) => void): () => void;
173
+ /** Hears this handle's saves refused because the file changed since the kit read it. */
174
+ onConflict(listener: (event: ConflictEvent) => void): () => void;
175
+ private saved;
176
+ request<T>(method: string, params?: object): Promise<T>;
177
+ }
178
+ export type OpenHeadlessOptions = Omit<LaunchOptions, 'workspace' | 'kits'> & HeadlessOpenOptions & {
179
+ /** The workspace folder; the file's folder by default. */
180
+ workspace?: string;
181
+ };
182
+ /** A document in a service this call started: `shutdown()` stops it and its kits. */
183
+ export type OpenedHeadless = HeadlessDocument & {
184
+ shutdown: () => Promise<void>;
185
+ };
186
+ /**
187
+ * Starts `kition-kits serve` with the kit executable `binary` and opens `file` in it; a file that
188
+ * does not exist yet is created by the kit for its extension, and saved.
189
+ */
190
+ export declare function openHeadless(binary: string, file: string, options?: OpenHeadlessOptions): Promise<OpenedHeadless>;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * `@kition/sdk/script`: the Kition object model (`KitObjectModel 1.0`). Open a document from an
3
+ * `@kition/sdk/embed` editor, a `KitConnection`, or a kit engine; queue reads and writes on typed
4
+ * proxies; `sync()` sends them as one batch. `openRoom` opens a document in a sync server's room.
5
+ */
6
+ export { advertiseCapabilitySets, CAPABILITY_SETS, capabilitySets, supports } from './capabilities.js';
7
+ export { BatchError, OBJECT_MODEL_CAPABILITY, type BatchOp, type BatchRequest, type BatchResult, type LoadedObject, type Origin } from '../../kdm/src/index.js';
8
+ export { exchangeBackend, ModelDocument, openDocument, type ChangedEvent, type ModelBackend, type OpenOptions } from './document.js';
9
+ export { Exchange, type ModelDescription } from './exchange.js';
10
+ export { kitModelBackend } from './kitModel.js';
11
+ export { kitDescriptor, registerKit, type KitDescriptor } from './kits.js';
12
+ export type { ConflictEvent, DocumentEventName, DocumentEvents, DocumentEventSource, KitCommandInfo, KitModel, ModelPort, PresenceEvent, SavedEvent, SelectionEvent } from './port.js';
13
+ export { NotSyncedError, PropertyNotLoadedError, RequestContext, type CommandMap, type CommandResult, type ModelList, type ModelMap, type ModelObject, type ModelText, type ModelTree, type ModelTreeNode } from './proxy.js';
14
+ export { createRoom, openRoom, RoomDocument, syncEndpoint, webSocketTransport, type CreateRoomOptions, type RoomOptions } from './room.js';
15
+ export { isModelPort, portFromConnection, portFromEngine, type ConnectionLike, type EngineLike } from './sources.js';
@@ -0,0 +1,17 @@
1
+ import { type Schema } from '../../kdm/src/index.js';
2
+ import type { ModelBackend } from './document.js';
3
+ import type { KitModel, ModelPort } from './port.js';
4
+ /**
5
+ * A kit's refusal of a batch as a `BatchError`: the Kit UI protocol answers it as an error whose
6
+ * `data` is `{ code, index, message }`. Anything else is passed on as it is.
7
+ */
8
+ export declare function batchErrorOf(error: unknown): unknown;
9
+ /**
10
+ * The object model answered by the kit itself (`port.model`, the Kit UI capability `model`): each
11
+ * batch is one `model/batch`, one undo step of the person's history. Batches go one at a time;
12
+ * the kit's `replica/changed` for a batch still running is held until it answers, so this handle
13
+ * knows its own change.
14
+ */
15
+ export declare function kitModelBackend(port: ModelPort & {
16
+ model: KitModel;
17
+ }, schema: Schema | object): ModelBackend;
@@ -0,0 +1,8 @@
1
+ /** A kit the object model knows: its id and its KDM schema (`model/schema.json`). */
2
+ export type KitDescriptor = {
3
+ id: string;
4
+ schema: object;
5
+ };
6
+ /** Makes a kit's schema known to `openDocument` (generated descriptors in `@kition/sdk/script/kits/*`). */
7
+ export declare function registerKit(kit: KitDescriptor): KitDescriptor;
8
+ export declare const kitDescriptor: (id: string) => KitDescriptor | undefined;
@@ -0,0 +1,42 @@
1
+ import '../kits/index.js';
2
+ import { type ModelDocument, type OpenOptions } from './document.js';
3
+ import type { CommandMap, ModelObject } from './proxy.js';
4
+ import { type EngineLike } from './sources.js';
5
+ /** A kit engine's document, as its class exposes it. */
6
+ export type KitEngine = EngineLike & {
7
+ save: (name?: string) => Uint8Array;
8
+ markSaved: () => void;
9
+ readonly dirty: boolean;
10
+ free?: () => void;
11
+ };
12
+ /** One open document of a kit engine in Node. */
13
+ export type NodeKitDocument = {
14
+ readonly kitId: string;
15
+ readonly engine: KitEngine;
16
+ /** The object model over this document. */
17
+ model: <Root extends ModelObject = ModelObject, C extends CommandMap = CommandMap>(options?: OpenOptions) => Promise<ModelDocument<Root, C>>;
18
+ /** The document as file bytes, in `name`'s format or its own. */
19
+ save: (name?: string) => Uint8Array;
20
+ close: () => void;
21
+ };
22
+ export type KitPackage = {
23
+ readonly kitId: string;
24
+ readonly version: string;
25
+ /** The package's KDM schema (`model/schema.json`) when it ships one; documents use it over the bundled kit's. */
26
+ readonly schema?: object;
27
+ open: (name: string, bytes: Uint8Array) => NodeKitDocument;
28
+ create: (name: string, size?: {
29
+ width: number;
30
+ height: number;
31
+ }) => NodeKitDocument;
32
+ };
33
+ /**
34
+ * Loads the engine of the kit package in `dir` (the folder holding `kit-ui.json` and `engine/`).
35
+ * A package that ships its KDM schema (`model/schema.json`) opens its documents with it, since it is
36
+ * the schema its engine was built with; otherwise the bundled kit's (`@kition/sdk/script/kits`) is used.
37
+ */
38
+ export declare function openKitPackage(dir: string): Promise<KitPackage>;
39
+ export { HeadlessDocument, KITS_SERVICE_VERSION, KitProtocolConnection, KitProtocolError, KitsService, openHeadless, type HeadlessDocumentState, type HeadlessOpenOptions, type KitStatus, type LaunchOptions, type OpenedHeadless, type OpenHeadlessOptions, } from './headless.js';
40
+ export { createAgentRelay, type AgentRelay, type RelayMessage } from './agentRelay.js';
41
+ export { DraftCommandError, workspaceDrafts, type DraftComparison, type DraftDiff, type DraftObjectChange, type DraftObjectId, type DraftPosition, type DraftValue, type WorkspaceDraft, type WorkspaceDrafts, type WorkspaceDraftsOptions, } from './drafts.js';
42
+ export * from './index.js';