@soulcraft/sdk 1.0.0 → 1.2.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 (112) hide show
  1. package/dist/client/index.d.ts +3 -0
  2. package/dist/client/index.d.ts.map +1 -1
  3. package/dist/client/index.js +2 -0
  4. package/dist/client/index.js.map +1 -1
  5. package/dist/index.d.ts +7 -6
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +1 -0
  8. package/dist/index.js.map +1 -1
  9. package/dist/modules/auth/service-token.d.ts +62 -0
  10. package/dist/modules/auth/service-token.d.ts.map +1 -0
  11. package/dist/modules/auth/service-token.js +99 -0
  12. package/dist/modules/auth/service-token.js.map +1 -0
  13. package/dist/modules/billing/firestore-provider.d.ts +60 -0
  14. package/dist/modules/billing/firestore-provider.d.ts.map +1 -0
  15. package/dist/modules/billing/firestore-provider.js +314 -0
  16. package/dist/modules/billing/firestore-provider.js.map +1 -0
  17. package/dist/modules/billing/index.d.ts +58 -0
  18. package/dist/modules/billing/index.d.ts.map +1 -0
  19. package/dist/modules/billing/index.js +164 -0
  20. package/dist/modules/billing/index.js.map +1 -0
  21. package/dist/modules/billing/local-provider.d.ts +38 -0
  22. package/dist/modules/billing/local-provider.d.ts.map +1 -0
  23. package/dist/modules/billing/local-provider.js +242 -0
  24. package/dist/modules/billing/local-provider.js.map +1 -0
  25. package/dist/modules/billing/portal-provider.d.ts +70 -0
  26. package/dist/modules/billing/portal-provider.d.ts.map +1 -0
  27. package/dist/modules/billing/portal-provider.js +204 -0
  28. package/dist/modules/billing/portal-provider.js.map +1 -0
  29. package/dist/modules/billing/types.d.ts +323 -3
  30. package/dist/modules/billing/types.d.ts.map +1 -1
  31. package/dist/modules/billing/types.js +22 -2
  32. package/dist/modules/billing/types.js.map +1 -1
  33. package/dist/modules/billing/usage-buffer.d.ts +72 -0
  34. package/dist/modules/billing/usage-buffer.d.ts.map +1 -0
  35. package/dist/modules/billing/usage-buffer.js +141 -0
  36. package/dist/modules/billing/usage-buffer.js.map +1 -0
  37. package/dist/modules/formats/types.d.ts +65 -3
  38. package/dist/modules/formats/types.d.ts.map +1 -1
  39. package/dist/modules/formats/types.js +40 -3
  40. package/dist/modules/formats/types.js.map +1 -1
  41. package/dist/modules/formats/wdoc.d.ts +263 -0
  42. package/dist/modules/formats/wdoc.d.ts.map +1 -0
  43. package/dist/modules/formats/wdoc.js +21 -0
  44. package/dist/modules/formats/wdoc.js.map +1 -0
  45. package/dist/modules/formats/wquiz.d.ts +122 -0
  46. package/dist/modules/formats/wquiz.d.ts.map +1 -0
  47. package/dist/modules/formats/wquiz.js +23 -0
  48. package/dist/modules/formats/wquiz.js.map +1 -0
  49. package/dist/modules/formats/wslide.d.ts +130 -0
  50. package/dist/modules/formats/wslide.d.ts.map +1 -0
  51. package/dist/modules/formats/wslide.js +23 -0
  52. package/dist/modules/formats/wslide.js.map +1 -0
  53. package/dist/modules/formats/wviz.d.ts +114 -0
  54. package/dist/modules/formats/wviz.d.ts.map +1 -0
  55. package/dist/modules/formats/wviz.js +21 -0
  56. package/dist/modules/formats/wviz.js.map +1 -0
  57. package/dist/modules/hall/browser.d.ts +88 -0
  58. package/dist/modules/hall/browser.d.ts.map +1 -0
  59. package/dist/modules/hall/browser.js +265 -0
  60. package/dist/modules/hall/browser.js.map +1 -0
  61. package/dist/modules/hall/protocol.d.ts +39 -0
  62. package/dist/modules/hall/protocol.d.ts.map +1 -0
  63. package/dist/modules/hall/protocol.js +52 -0
  64. package/dist/modules/hall/protocol.js.map +1 -0
  65. package/dist/modules/hall/server.d.ts +172 -0
  66. package/dist/modules/hall/server.d.ts.map +1 -0
  67. package/dist/modules/hall/server.js +457 -0
  68. package/dist/modules/hall/server.js.map +1 -0
  69. package/dist/modules/hall/types.d.ts +502 -31
  70. package/dist/modules/hall/types.d.ts.map +1 -1
  71. package/dist/modules/hall/types.js +13 -8
  72. package/dist/modules/hall/types.js.map +1 -1
  73. package/dist/modules/kits/index.d.ts +41 -0
  74. package/dist/modules/kits/index.d.ts.map +1 -0
  75. package/dist/modules/kits/index.js +85 -0
  76. package/dist/modules/kits/index.js.map +1 -0
  77. package/dist/modules/kits/types.d.ts +107 -3
  78. package/dist/modules/kits/types.d.ts.map +1 -1
  79. package/dist/modules/kits/types.js +15 -2
  80. package/dist/modules/kits/types.js.map +1 -1
  81. package/dist/modules/license/index.d.ts +53 -0
  82. package/dist/modules/license/index.d.ts.map +1 -0
  83. package/dist/modules/license/index.js +233 -0
  84. package/dist/modules/license/index.js.map +1 -0
  85. package/dist/modules/license/types.d.ts +222 -3
  86. package/dist/modules/license/types.d.ts.map +1 -1
  87. package/dist/modules/license/types.js +21 -2
  88. package/dist/modules/license/types.js.map +1 -1
  89. package/dist/modules/notifications/index.d.ts +40 -0
  90. package/dist/modules/notifications/index.d.ts.map +1 -0
  91. package/dist/modules/notifications/index.js +280 -0
  92. package/dist/modules/notifications/index.js.map +1 -0
  93. package/dist/modules/notifications/types.d.ts +152 -3
  94. package/dist/modules/notifications/types.d.ts.map +1 -1
  95. package/dist/modules/notifications/types.js +21 -2
  96. package/dist/modules/notifications/types.js.map +1 -1
  97. package/dist/server/create-sdk.d.ts +4 -0
  98. package/dist/server/create-sdk.d.ts.map +1 -1
  99. package/dist/server/create-sdk.js +19 -26
  100. package/dist/server/create-sdk.js.map +1 -1
  101. package/dist/server/hall-handlers.d.ts +90 -151
  102. package/dist/server/hall-handlers.d.ts.map +1 -1
  103. package/dist/server/hall-handlers.js +84 -204
  104. package/dist/server/hall-handlers.js.map +1 -1
  105. package/dist/server/index.d.ts +10 -2
  106. package/dist/server/index.d.ts.map +1 -1
  107. package/dist/server/index.js +9 -2
  108. package/dist/server/index.js.map +1 -1
  109. package/dist/types.d.ts +35 -25
  110. package/dist/types.d.ts.map +1 -1
  111. package/docs/USAGE.md +224 -1
  112. package/package.json +13 -5
@@ -0,0 +1,141 @@
1
+ /**
2
+ * @module billing/usage-buffer
3
+ * @description Fire-and-forget write-behind buffer for AI usage tracking.
4
+ *
5
+ * The usage buffer accumulates per-user token increments in memory and flushes
6
+ * them to the billing provider in a single batch write every 5 seconds. This
7
+ * pattern eliminates billing writes from the critical path of AI responses —
8
+ * the SSE `done` event is emitted before any billing I/O.
9
+ *
10
+ * Up to 5 seconds of usage may be lost on unclean process exits. This is
11
+ * acceptable for the billing use case — users are not double-charged on restart,
12
+ * and a few messages of under-counting per process lifetime is tolerable.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const buffer = new UsageBuffer(billingProvider)
17
+ *
18
+ * // Fire-and-forget — never await this:
19
+ * buffer.increment('user-123', 500, 200, 'claude-haiku-4-5-20251001', false)
20
+ *
21
+ * // On graceful shutdown:
22
+ * await buffer.flush()
23
+ * buffer.stop()
24
+ * ```
25
+ */
26
+ /** Flush interval in milliseconds. */
27
+ const FLUSH_INTERVAL_MS = 5_000;
28
+ /**
29
+ * Write-behind usage buffer.
30
+ *
31
+ * Thread-safe within a single Node.js/Bun process (single-threaded event loop).
32
+ * Accumulates increments in memory and flushes to the billing provider on a
33
+ * 5-second interval. Also exposes `flush()` for explicit drain on shutdown.
34
+ */
35
+ export class UsageBuffer {
36
+ provider;
37
+ pending = new Map();
38
+ _timer;
39
+ /**
40
+ * @param provider - The billing provider to flush to.
41
+ */
42
+ constructor(provider) {
43
+ this.provider = provider;
44
+ this._start();
45
+ }
46
+ /**
47
+ * Record a usage increment for a user.
48
+ *
49
+ * This method is synchronous and never throws. Usage is accumulated in memory
50
+ * and written to the billing backend on the next flush.
51
+ *
52
+ * @param userId - The authenticated user's ID.
53
+ * @param inputTokens - Input tokens consumed.
54
+ * @param outputTokens - Output tokens consumed.
55
+ * @param model - Model ID (e.g. `'claude-haiku-4-5-20251001'`).
56
+ * @param useTopUp - Whether this message drew from the top-up balance.
57
+ */
58
+ increment(userId, inputTokens, outputTokens, model, useTopUp) {
59
+ let acc = this.pending.get(userId);
60
+ if (!acc) {
61
+ acc = { messageCount: 0, inputTokens: 0, outputTokens: 0, topUpUsed: 0, byModel: {} };
62
+ this.pending.set(userId, acc);
63
+ }
64
+ acc.messageCount += 1;
65
+ acc.inputTokens += inputTokens;
66
+ acc.outputTokens += outputTokens;
67
+ if (useTopUp)
68
+ acc.topUpUsed += 1;
69
+ const existing = acc.byModel[model] ?? { input: 0, output: 0 };
70
+ acc.byModel[model] = {
71
+ input: existing.input + inputTokens,
72
+ output: existing.output + outputTokens,
73
+ };
74
+ }
75
+ /**
76
+ * Flush all pending usage increments to the billing provider.
77
+ *
78
+ * Called automatically on the 5-second interval, and on explicit calls from
79
+ * the billing module's `flush()` method (e.g. graceful shutdown).
80
+ *
81
+ * Errors are caught and logged — a flush failure never propagates to callers.
82
+ */
83
+ async flush() {
84
+ if (this.pending.size === 0)
85
+ return;
86
+ const snapshot = new Map(this.pending);
87
+ this.pending.clear();
88
+ const promises = [];
89
+ for (const [userId, acc] of snapshot) {
90
+ const batch = {
91
+ messageCount: acc.messageCount,
92
+ inputTokens: acc.inputTokens,
93
+ outputTokens: acc.outputTokens,
94
+ topUpUsed: acc.topUpUsed,
95
+ byModel: acc.byModel,
96
+ };
97
+ promises.push(this.provider.batchIncrementUsage(userId, batch).catch((err) => {
98
+ console.error(`[SDK/billing] Usage flush failed for user ${userId}:`, err);
99
+ // Re-enqueue the failed batch so it is retried on the next flush.
100
+ this._requeue(userId, acc);
101
+ }));
102
+ }
103
+ await Promise.allSettled(promises);
104
+ }
105
+ /**
106
+ * Stop the background flush interval.
107
+ * Call this during graceful shutdown after flushing.
108
+ */
109
+ stop() {
110
+ if (this._timer) {
111
+ clearInterval(this._timer);
112
+ this._timer = undefined;
113
+ }
114
+ }
115
+ // ── Private ──────────────────────────────────────────────────────────────
116
+ _start() {
117
+ this._timer = setInterval(() => {
118
+ void this.flush();
119
+ }, FLUSH_INTERVAL_MS);
120
+ // Allow the process to exit normally even if the interval is running.
121
+ if (this._timer.unref)
122
+ this._timer.unref();
123
+ }
124
+ _requeue(userId, acc) {
125
+ const existing = this.pending.get(userId);
126
+ if (!existing) {
127
+ this.pending.set(userId, acc);
128
+ return;
129
+ }
130
+ // Merge the failed batch back into any new accumulation.
131
+ existing.messageCount += acc.messageCount;
132
+ existing.inputTokens += acc.inputTokens;
133
+ existing.outputTokens += acc.outputTokens;
134
+ existing.topUpUsed += acc.topUpUsed;
135
+ for (const [model, counts] of Object.entries(acc.byModel)) {
136
+ const cur = existing.byModel[model] ?? { input: 0, output: 0 };
137
+ existing.byModel[model] = { input: cur.input + counts.input, output: cur.output + counts.output };
138
+ }
139
+ }
140
+ }
141
+ //# sourceMappingURL=usage-buffer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usage-buffer.js","sourceRoot":"","sources":["../../../src/modules/billing/usage-buffer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,sCAAsC;AACtC,MAAM,iBAAiB,GAAG,KAAK,CAAA;AAW/B;;;;;;GAMG;AACH,MAAM,OAAO,WAAW;IAOO;IANZ,OAAO,GAAG,IAAI,GAAG,EAA2B,CAAA;IACrD,MAAM,CAA4C;IAE1D;;OAEG;IACH,YAA6B,QAAyB;QAAzB,aAAQ,GAAR,QAAQ,CAAiB;QACpD,IAAI,CAAC,MAAM,EAAE,CAAA;IACf,CAAC;IAED;;;;;;;;;;;OAWG;IACH,SAAS,CACP,MAAc,EACd,WAAmB,EACnB,YAAoB,EACpB,KAAa,EACb,QAAiB;QAEjB,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QAClC,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,GAAG,GAAG,EAAE,YAAY,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAA;YACrF,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;QAC/B,C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CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YAC1D,MAAM,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAA;YAC9D,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,CAAA;QACnG,CAAC;IACH,CAAC;CACF"}
@@ -1,7 +1,69 @@
1
1
  /**
2
2
  * @module formats/types
3
- * @description Type definitions for sdk.formats.*
4
- * Implementation: Phase 4 per ADR-001.
3
+ * @description Soulcraft portable content format type definitions.
4
+ *
5
+ * This module exports the four core document formats used across the Soulcraft
6
+ * platform. All formats are pure data — JSON documents stored in the VFS and
7
+ * passed between products, AI tools, and rendering components.
8
+ *
9
+ * | Format | Extension | Purpose |
10
+ * |---------|------------------|----------------------------------------------|
11
+ * | WVIZ | `.wviz.json` | Knowledge graph visualizations |
12
+ * | WDOC | `.wdoc` | Rich text documents (TipTap/ProseMirror) |
13
+ * | WSLIDE | `.wslide.json` | Slide deck presentations |
14
+ * | WQUIZ | `.wquiz.json` | Assessments and quizzes |
15
+ *
16
+ * Formats contain no runtime behavior — they are schema contracts. Products
17
+ * read them from the VFS, parse with `JSON.parse()`, and cast to the appropriate
18
+ * interface. The `SoulcraftFormat` discriminant on each document's `format` field
19
+ * enables safe narrowing at runtime.
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * import type { WdocDocument, WvizDocument, SoulcraftFormatDocument } from '@soulcraft/sdk'
24
+ *
25
+ * // Read from VFS and narrow to the correct type
26
+ * const buf = await sdk.vfs.readFile('/projects/notes.wdoc')
27
+ * const doc = JSON.parse(buf.toString('utf-8')) as SoulcraftFormatDocument
28
+ * if (doc.format === 'wdoc') {
29
+ * const wdoc = doc as WdocDocument
30
+ * console.log(wdoc.meta.title)
31
+ * }
32
+ * ```
5
33
  */
6
- export type {};
34
+ export type { WvizDocument, WvizEntity, WvizEdge, WvizSnapshot, WvizViewType, } from './wviz.js';
35
+ export type { WdocDocument, WdocMeta, WdocBlock, WdocInlineContent, WdocTextNode, WdocMark, WdocParagraphBlock, WdocHeadingBlock, WdocBlockquoteBlock, WdocCodeBlock, WdocBulletListBlock, WdocOrderedListBlock, WdocListItemBlock, WdocTaskListBlock, WdocTaskItemBlock, WdocImageBlock, WdocVideoBlock, WdocIconBlock, WdocSvgEmbedBlock, WdocEmbedBlock, WdocTableBlock, WdocTableRowBlock, WdocTableCellBlock, WdocTableHeaderBlock, WdocHorizontalRuleBlock, WdocCalloutBlock, } from './wdoc.js';
36
+ export type { WslideDocument, WslideSlide, WslideBackground, WslideLayout, WslideTransition, WslideConfig, } from './wslide.js';
37
+ export type { WquizDocument, WquizQuestion, WquizQuestionType, WquizAnswer, WquizScoringRules, } from './wquiz.js';
38
+ /**
39
+ * Discriminant string identifying the Soulcraft document format.
40
+ *
41
+ * Stored as the `format` field on every document. Use this for narrowing:
42
+ * ```typescript
43
+ * if (doc.format === 'wdoc') { ... }
44
+ * ```
45
+ */
46
+ export type SoulcraftFormat = 'wviz' | 'wdoc' | 'wslide' | 'wquiz';
47
+ /**
48
+ * All Soulcraft format strings as a const array — useful for validation.
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * const isKnownFormat = (s: string): s is SoulcraftFormat =>
53
+ * (SOULCRAFT_FORMATS as readonly string[]).includes(s)
54
+ * ```
55
+ */
56
+ export declare const SOULCRAFT_FORMATS: readonly ["wviz", "wdoc", "wslide", "wquiz"];
57
+ /**
58
+ * Minimal base shape shared by all Soulcraft format documents.
59
+ *
60
+ * Every Soulcraft document has a `format` discriminant and a `version` string.
61
+ * Cast an unknown JSON object to this type first, then narrow by `format`.
62
+ */
63
+ export interface SoulcraftFormatDocument {
64
+ /** Format discriminant. Use to narrow to the specific document type. */
65
+ format: SoulcraftFormat;
66
+ /** Schema version string (e.g. `'1.0'`). */
67
+ version: string;
68
+ }
7
69
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/modules/formats/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,YAAY,EAAE,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/modules/formats/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,YAAY,EACV,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,YAAY,GACb,MAAM,WAAW,CAAA;AAElB,YAAY,EACV,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,iBAAiB,EACjB,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,WAAW,CAAA;AAElB,YAAY,EACV,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,YAAY,GACb,MAAM,aAAa,CAAA;AAEpB,YAAY,EACV,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,iBAAiB,GAClB,MAAM,YAAY,CAAA;AAMnB;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;AAElE;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,8CAAoF,CAAA;AAElH;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC,wEAAwE;IACxE,MAAM,EAAE,eAAe,CAAA;IACvB,4CAA4C;IAC5C,OAAO,EAAE,MAAM,CAAA;CAChB"}
@@ -1,7 +1,44 @@
1
1
  /**
2
2
  * @module formats/types
3
- * @description Type definitions for sdk.formats.*
4
- * Implementation: Phase 4 per ADR-001.
3
+ * @description Soulcraft portable content format type definitions.
4
+ *
5
+ * This module exports the four core document formats used across the Soulcraft
6
+ * platform. All formats are pure data — JSON documents stored in the VFS and
7
+ * passed between products, AI tools, and rendering components.
8
+ *
9
+ * | Format | Extension | Purpose |
10
+ * |---------|------------------|----------------------------------------------|
11
+ * | WVIZ | `.wviz.json` | Knowledge graph visualizations |
12
+ * | WDOC | `.wdoc` | Rich text documents (TipTap/ProseMirror) |
13
+ * | WSLIDE | `.wslide.json` | Slide deck presentations |
14
+ * | WQUIZ | `.wquiz.json` | Assessments and quizzes |
15
+ *
16
+ * Formats contain no runtime behavior — they are schema contracts. Products
17
+ * read them from the VFS, parse with `JSON.parse()`, and cast to the appropriate
18
+ * interface. The `SoulcraftFormat` discriminant on each document's `format` field
19
+ * enables safe narrowing at runtime.
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * import type { WdocDocument, WvizDocument, SoulcraftFormatDocument } from '@soulcraft/sdk'
24
+ *
25
+ * // Read from VFS and narrow to the correct type
26
+ * const buf = await sdk.vfs.readFile('/projects/notes.wdoc')
27
+ * const doc = JSON.parse(buf.toString('utf-8')) as SoulcraftFormatDocument
28
+ * if (doc.format === 'wdoc') {
29
+ * const wdoc = doc as WdocDocument
30
+ * console.log(wdoc.meta.title)
31
+ * }
32
+ * ```
5
33
  */
6
- export {};
34
+ /**
35
+ * All Soulcraft format strings as a const array — useful for validation.
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * const isKnownFormat = (s: string): s is SoulcraftFormat =>
40
+ * (SOULCRAFT_FORMATS as readonly string[]).includes(s)
41
+ * ```
42
+ */
43
+ export const SOULCRAFT_FORMATS = ['wviz', 'wdoc', 'wslide', 'wquiz'];
7
44
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/modules/formats/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/modules/formats/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAsEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAA+C,CAAA"}
@@ -0,0 +1,263 @@
1
+ /**
2
+ * @module formats/wdoc
3
+ * @description Type definitions for the WDOC (Workshop Document) format.
4
+ *
5
+ * WDOC is a block-based JSON document format compatible with the TipTap/ProseMirror
6
+ * document schema. It extends plain Markdown with rich content blocks (video, icon,
7
+ * table, callout, embed) and is the native format for Workshop's document editor.
8
+ *
9
+ * WDOC files are stored in the VFS with the `.wdoc` extension. The format is a
10
+ * strict superset of Markdown — all Markdown content can be represented as WDOC,
11
+ * but not vice versa.
12
+ *
13
+ * @example Reading a WDOC from the VFS
14
+ * ```typescript
15
+ * const buf = await sdk.vfs.readFile('/projects/my-project/README.wdoc')
16
+ * const doc: WdocDocument = JSON.parse(buf.toString('utf-8'))
17
+ * console.log(doc.meta.title)
18
+ * ```
19
+ */
20
+ /**
21
+ * A WDOC document — the top-level container for all block content.
22
+ */
23
+ export interface WdocDocument {
24
+ /** Format discriminator. Always `'doc'`. */
25
+ type: 'doc';
26
+ /** Schema version. Currently `'1.0'`. */
27
+ version: string;
28
+ /** Document metadata (title, author, timestamps, tags). */
29
+ meta: WdocMeta;
30
+ /** Ordered list of content blocks. */
31
+ content: WdocBlock[];
32
+ }
33
+ /**
34
+ * Document-level metadata stored in the WDOC header.
35
+ */
36
+ export interface WdocMeta {
37
+ /** Human-readable document title. */
38
+ title?: string;
39
+ /** Template ID this document was created from. */
40
+ template?: string;
41
+ /** ISO 8601 creation timestamp. */
42
+ created?: string;
43
+ /** ISO 8601 last-modified timestamp. */
44
+ modified?: string;
45
+ /** Document author (user ID or display name). */
46
+ author?: string;
47
+ /** Arbitrary tags for categorization. */
48
+ tags?: string[];
49
+ /** Whether this document was assembled from multiple source files. */
50
+ merged?: boolean;
51
+ /** Number of source files when `merged` is true. */
52
+ sourceCount?: number;
53
+ }
54
+ /**
55
+ * A text leaf node with optional formatting marks.
56
+ */
57
+ export interface WdocTextNode {
58
+ type: 'text';
59
+ /** The raw text content. */
60
+ text: string;
61
+ /** Applied inline formatting marks. */
62
+ marks?: WdocMark[];
63
+ }
64
+ /**
65
+ * An inline formatting mark applied to a text node.
66
+ */
67
+ export type WdocMark = {
68
+ type: 'bold';
69
+ } | {
70
+ type: 'italic';
71
+ } | {
72
+ type: 'strike';
73
+ } | {
74
+ type: 'code';
75
+ } | {
76
+ type: 'underline';
77
+ } | {
78
+ type: 'link';
79
+ attrs: {
80
+ href: string;
81
+ target?: string;
82
+ };
83
+ } | {
84
+ type: 'highlight';
85
+ attrs?: {
86
+ color?: string;
87
+ };
88
+ } | {
89
+ type: 'textStyle';
90
+ attrs?: {
91
+ color?: string;
92
+ fontSize?: string;
93
+ };
94
+ };
95
+ /** Inline content — text nodes or inline icon blocks. */
96
+ export type WdocInlineContent = WdocTextNode | WdocIconBlock;
97
+ /**
98
+ * Union of all block types that can appear in a WDOC document.
99
+ */
100
+ export type WdocBlock = WdocParagraphBlock | WdocHeadingBlock | WdocBlockquoteBlock | WdocCodeBlock | WdocBulletListBlock | WdocOrderedListBlock | WdocListItemBlock | WdocTaskListBlock | WdocTaskItemBlock | WdocImageBlock | WdocVideoBlock | WdocIconBlock | WdocSvgEmbedBlock | WdocEmbedBlock | WdocTableBlock | WdocTableRowBlock | WdocTableCellBlock | WdocTableHeaderBlock | WdocHorizontalRuleBlock | WdocCalloutBlock;
101
+ /** A paragraph block. */
102
+ export interface WdocParagraphBlock {
103
+ type: 'paragraph';
104
+ attrs?: {
105
+ textAlign?: 'left' | 'center' | 'right' | 'justify';
106
+ };
107
+ content?: WdocInlineContent[];
108
+ }
109
+ /** A heading block (H1–H6). */
110
+ export interface WdocHeadingBlock {
111
+ type: 'heading';
112
+ attrs: {
113
+ level: 1 | 2 | 3 | 4 | 5 | 6;
114
+ textAlign?: 'left' | 'center' | 'right';
115
+ };
116
+ content?: WdocInlineContent[];
117
+ }
118
+ /** A block quotation. */
119
+ export interface WdocBlockquoteBlock {
120
+ type: 'blockquote';
121
+ content?: WdocBlock[];
122
+ }
123
+ /** A fenced code block with optional language syntax highlighting. */
124
+ export interface WdocCodeBlock {
125
+ type: 'codeBlock';
126
+ attrs?: {
127
+ language?: string;
128
+ };
129
+ content?: WdocTextNode[];
130
+ }
131
+ /** An unordered (bullet) list. */
132
+ export interface WdocBulletListBlock {
133
+ type: 'bulletList';
134
+ content?: WdocListItemBlock[];
135
+ }
136
+ /** An ordered (numbered) list. */
137
+ export interface WdocOrderedListBlock {
138
+ type: 'orderedList';
139
+ attrs?: {
140
+ start?: number;
141
+ };
142
+ content?: WdocListItemBlock[];
143
+ }
144
+ /** A single list item (used in both bullet and ordered lists). */
145
+ export interface WdocListItemBlock {
146
+ type: 'listItem';
147
+ content?: WdocBlock[];
148
+ }
149
+ /** A task/checklist. */
150
+ export interface WdocTaskListBlock {
151
+ type: 'taskList';
152
+ content?: WdocTaskItemBlock[];
153
+ }
154
+ /** A single task item with a checked/unchecked state. */
155
+ export interface WdocTaskItemBlock {
156
+ type: 'taskItem';
157
+ attrs: {
158
+ checked: boolean;
159
+ };
160
+ content?: WdocBlock[];
161
+ }
162
+ /** A horizontal rule divider. */
163
+ export interface WdocHorizontalRuleBlock {
164
+ type: 'horizontalRule';
165
+ }
166
+ /** An image block. */
167
+ export interface WdocImageBlock {
168
+ type: 'image';
169
+ attrs: {
170
+ src: string;
171
+ alt?: string;
172
+ title?: string;
173
+ width?: number;
174
+ height?: number;
175
+ };
176
+ }
177
+ /** A video block (self-hosted or embedded). */
178
+ export interface WdocVideoBlock {
179
+ type: 'video';
180
+ attrs: {
181
+ src: string;
182
+ provider?: 'youtube' | 'vimeo' | 'self-hosted';
183
+ poster?: string;
184
+ title?: string;
185
+ width?: number;
186
+ height?: number;
187
+ };
188
+ }
189
+ /** An inline icon from the Iconify library. */
190
+ export interface WdocIconBlock {
191
+ type: 'icon';
192
+ attrs: {
193
+ /** Iconify icon identifier, e.g. `'mdi:rocket-launch'`. */
194
+ icon: string;
195
+ size?: number;
196
+ color?: string;
197
+ };
198
+ marks?: WdocMark[];
199
+ }
200
+ /** An SVG file embed. */
201
+ export interface WdocSvgEmbedBlock {
202
+ type: 'svgEmbed';
203
+ attrs: {
204
+ /** Path to the `.svg` file in the VFS. */
205
+ src: string;
206
+ editable?: boolean;
207
+ /** When true, inline the SVG content rather than referencing it. */
208
+ inline?: boolean;
209
+ width?: number;
210
+ height?: number;
211
+ };
212
+ /** Inlined SVG markup when `attrs.inline` is true. */
213
+ content?: string;
214
+ }
215
+ /** An oEmbed/iframe embed (Twitter, Figma, CodePen, etc.). */
216
+ export interface WdocEmbedBlock {
217
+ type: 'embed';
218
+ attrs: {
219
+ url: string;
220
+ provider?: 'twitter' | 'figma' | 'codepen' | 'youtube' | 'gist' | 'other';
221
+ width?: number;
222
+ height?: number;
223
+ };
224
+ }
225
+ /** A table block. */
226
+ export interface WdocTableBlock {
227
+ type: 'table';
228
+ content?: WdocTableRowBlock[];
229
+ }
230
+ /** A table row. */
231
+ export interface WdocTableRowBlock {
232
+ type: 'tableRow';
233
+ content?: (WdocTableCellBlock | WdocTableHeaderBlock)[];
234
+ }
235
+ /** A table body cell. */
236
+ export interface WdocTableCellBlock {
237
+ type: 'tableCell';
238
+ attrs?: {
239
+ colspan?: number;
240
+ rowspan?: number;
241
+ };
242
+ content?: WdocBlock[];
243
+ }
244
+ /** A table header cell. */
245
+ export interface WdocTableHeaderBlock {
246
+ type: 'tableHeader';
247
+ attrs?: {
248
+ colspan?: number;
249
+ rowspan?: number;
250
+ };
251
+ content?: WdocBlock[];
252
+ }
253
+ /** A styled callout/alert block. */
254
+ export interface WdocCalloutBlock {
255
+ type: 'callout';
256
+ attrs: {
257
+ variant: 'info' | 'warning' | 'success' | 'error' | 'tip';
258
+ /** Optional Iconify icon override. */
259
+ icon?: string;
260
+ };
261
+ content?: WdocBlock[];
262
+ }
263
+ //# sourceMappingURL=wdoc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wdoc.d.ts","sourceRoot":"","sources":["../../../src/modules/formats/wdoc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,4CAA4C;IAC5C,IAAI,EAAE,KAAK,CAAA;IACX,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAA;IACf,2DAA2D;IAC3D,IAAI,EAAE,QAAQ,CAAA;IACd,sCAAsC;IACtC,OAAO,EAAE,SAAS,EAAE,CAAA;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,qCAAqC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,wCAAwC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,sEAAsE;IACtE,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAMD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,uCAAuC;IACvC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M,CAAA;KAAE,CAAA;IAC9C,OAAO,CAAC,EAAE,SAAS,EAAE,CAAA;CACtB;AAMD,oCAAoC;AACpC,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,SAAS,CAAA;IACf,KAAK,EAAE;QACL,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,CAAA;QACzD,sCAAsC;QACtC,IAAI,CAAC,EAAE,MAAM,CAAA;KACd,CAAA;IACD,OAAO,CAAC,EAAE,SAAS,EAAE,CAAA;CACtB"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @module formats/wdoc
3
+ * @description Type definitions for the WDOC (Workshop Document) format.
4
+ *
5
+ * WDOC is a block-based JSON document format compatible with the TipTap/ProseMirror
6
+ * document schema. It extends plain Markdown with rich content blocks (video, icon,
7
+ * table, callout, embed) and is the native format for Workshop's document editor.
8
+ *
9
+ * WDOC files are stored in the VFS with the `.wdoc` extension. The format is a
10
+ * strict superset of Markdown — all Markdown content can be represented as WDOC,
11
+ * but not vice versa.
12
+ *
13
+ * @example Reading a WDOC from the VFS
14
+ * ```typescript
15
+ * const buf = await sdk.vfs.readFile('/projects/my-project/README.wdoc')
16
+ * const doc: WdocDocument = JSON.parse(buf.toString('utf-8'))
17
+ * console.log(doc.meta.title)
18
+ * ```
19
+ */
20
+ export {};
21
+ //# sourceMappingURL=wdoc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wdoc.js","sourceRoot":"","sources":["../../../src/modules/formats/wdoc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG"}