@assistant-ui/react-generative-ui 0.0.6 → 0.0.8

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 (201) hide show
  1. package/dist/JSONGenerativeUI.client.d.ts +4 -2
  2. package/dist/JSONGenerativeUI.client.d.ts.map +1 -1
  3. package/dist/JSONGenerativeUI.client.js +9 -2
  4. package/dist/JSONGenerativeUI.client.js.map +1 -1
  5. package/dist/JSONGenerativeUI.server.d.ts +0 -1
  6. package/dist/JSONGenerativeUI.server.d.ts.map +1 -1
  7. package/dist/JSONGenerativeUI.shared.d.ts +8 -1
  8. package/dist/JSONGenerativeUI.shared.d.ts.map +1 -1
  9. package/dist/JSONGenerativeUI.shared.js.map +1 -1
  10. package/dist/actionRegistry.d.ts +32 -0
  11. package/dist/actionRegistry.d.ts.map +1 -0
  12. package/dist/actionRegistry.js +41 -0
  13. package/dist/actionRegistry.js.map +1 -0
  14. package/dist/buildPresentParameters.d.ts +5 -5
  15. package/dist/buildPresentParameters.d.ts.map +1 -1
  16. package/dist/buildPresentParameters.js +20 -6
  17. package/dist/buildPresentParameters.js.map +1 -1
  18. package/dist/constants.d.ts.map +1 -1
  19. package/dist/defineGenerativeComponents.d.ts +0 -1
  20. package/dist/defineGenerativeComponents.d.ts.map +1 -1
  21. package/dist/generativeUIToJSX.d.ts +15 -10
  22. package/dist/generativeUIToJSX.d.ts.map +1 -1
  23. package/dist/generativeUIToJSX.js +47 -17
  24. package/dist/generativeUIToJSX.js.map +1 -1
  25. package/dist/index.d.ts +8 -4
  26. package/dist/index.js +5 -2
  27. package/dist/index.server.d.ts +13 -0
  28. package/dist/index.server.js +10 -0
  29. package/dist/index.shared.d.ts +11 -0
  30. package/dist/index.shared.js +9 -0
  31. package/dist/ir.d.ts +115 -0
  32. package/dist/ir.d.ts.map +1 -0
  33. package/dist/ir.js +175 -0
  34. package/dist/ir.js.map +1 -0
  35. package/dist/node_modules/.pnpm/@types_json-schema@7.0.15/node_modules/@types/json-schema/index.d.ts +3 -3
  36. package/dist/node_modules/.pnpm/@types_json-schema@7.0.15/node_modules/@types/json-schema/index.d.ts.map +1 -1
  37. package/dist/renderGenerativeUI.d.ts +5 -5
  38. package/dist/renderGenerativeUI.d.ts.map +1 -1
  39. package/dist/renderGenerativeUI.js +18 -45
  40. package/dist/renderGenerativeUI.js.map +1 -1
  41. package/dist/slack/constants.d.ts +111 -0
  42. package/dist/slack/constants.d.ts.map +1 -0
  43. package/dist/slack/constants.js +168 -0
  44. package/dist/slack/constants.js.map +1 -0
  45. package/dist/slack/decodeBlockAction.d.ts +11 -0
  46. package/dist/slack/decodeBlockAction.d.ts.map +1 -0
  47. package/dist/slack/decodeBlockAction.js +40 -0
  48. package/dist/slack/decodeBlockAction.js.map +1 -0
  49. package/dist/slack/fromSlackBlocks.d.ts +30 -0
  50. package/dist/slack/fromSlackBlocks.d.ts.map +1 -0
  51. package/dist/slack/fromSlackBlocks.js +447 -0
  52. package/dist/slack/fromSlackBlocks.js.map +1 -0
  53. package/dist/slack/toSlackBlocks.d.ts +7 -0
  54. package/dist/slack/toSlackBlocks.d.ts.map +1 -0
  55. package/dist/slack/toSlackBlocks.js +649 -0
  56. package/dist/slack/toSlackBlocks.js.map +1 -0
  57. package/dist/slack/types.d.ts +178 -0
  58. package/dist/slack/types.d.ts.map +1 -0
  59. package/dist/slack/types.js +0 -0
  60. package/dist/slack.d.ts +5 -0
  61. package/dist/slack.js +4 -0
  62. package/dist/teams/boundSpec.d.ts +20 -0
  63. package/dist/teams/boundSpec.d.ts.map +1 -0
  64. package/dist/teams/boundSpec.js +67 -0
  65. package/dist/teams/boundSpec.js.map +1 -0
  66. package/dist/teams/constants.d.ts +57 -0
  67. package/dist/teams/constants.d.ts.map +1 -0
  68. package/dist/teams/constants.js +92 -0
  69. package/dist/teams/constants.js.map +1 -0
  70. package/dist/teams/decodeSubmitData.d.ts +25 -0
  71. package/dist/teams/decodeSubmitData.d.ts.map +1 -0
  72. package/dist/teams/decodeSubmitData.js +44 -0
  73. package/dist/teams/decodeSubmitData.js.map +1 -0
  74. package/dist/teams/toAdaptiveCard.d.ts +39 -0
  75. package/dist/teams/toAdaptiveCard.d.ts.map +1 -0
  76. package/dist/teams/toAdaptiveCard.js +496 -0
  77. package/dist/teams/toAdaptiveCard.js.map +1 -0
  78. package/dist/teams/toTeamsAttachments.d.ts +13 -0
  79. package/dist/teams/toTeamsAttachments.d.ts.map +1 -0
  80. package/dist/teams/toTeamsAttachments.js +95 -0
  81. package/dist/teams/toTeamsAttachments.js.map +1 -0
  82. package/dist/teams/types.d.ts +196 -0
  83. package/dist/teams/types.d.ts.map +1 -0
  84. package/dist/teams/types.js +0 -0
  85. package/dist/teams.d.ts +5 -0
  86. package/dist/teams.js +4 -0
  87. package/dist/types.d.ts +41 -34
  88. package/dist/types.d.ts.map +1 -1
  89. package/dist/vocabulary/alert.d.ts +28 -0
  90. package/dist/vocabulary/alert.d.ts.map +1 -0
  91. package/dist/vocabulary/alert.js +58 -0
  92. package/dist/vocabulary/alert.js.map +1 -0
  93. package/dist/vocabulary/collectFormValues.d.ts +23 -0
  94. package/dist/vocabulary/collectFormValues.d.ts.map +1 -0
  95. package/dist/vocabulary/collectFormValues.js +32 -0
  96. package/dist/vocabulary/collectFormValues.js.map +1 -0
  97. package/dist/vocabulary/data.d.ts +52 -0
  98. package/dist/vocabulary/data.d.ts.map +1 -0
  99. package/dist/vocabulary/data.js +294 -0
  100. package/dist/vocabulary/data.js.map +1 -0
  101. package/dist/vocabulary/dispatch.d.ts +11 -0
  102. package/dist/vocabulary/dispatch.d.ts.map +1 -0
  103. package/dist/vocabulary/dispatch.js +21 -0
  104. package/dist/vocabulary/dispatch.js.map +1 -0
  105. package/dist/vocabulary/fact.d.ts +15 -0
  106. package/dist/vocabulary/fact.d.ts.map +1 -0
  107. package/dist/vocabulary/fact.js +24 -0
  108. package/dist/vocabulary/fact.js.map +1 -0
  109. package/dist/vocabulary/form.d.ts +14 -0
  110. package/dist/vocabulary/form.d.ts.map +1 -0
  111. package/dist/vocabulary/form.js +23 -0
  112. package/dist/vocabulary/form.js.map +1 -0
  113. package/dist/vocabulary/icon.d.ts +44 -0
  114. package/dist/vocabulary/icon.d.ts.map +1 -0
  115. package/dist/vocabulary/icon.js +272 -0
  116. package/dist/vocabulary/icon.js.map +1 -0
  117. package/dist/vocabulary/index.d.ts +15 -0
  118. package/dist/vocabulary/index.d.ts.map +1 -0
  119. package/dist/vocabulary/index.js +36 -0
  120. package/dist/vocabulary/index.js.map +1 -0
  121. package/dist/vocabulary/interactive.d.ts +93 -0
  122. package/dist/vocabulary/interactive.d.ts.map +1 -0
  123. package/dist/vocabulary/interactive.js +172 -0
  124. package/dist/vocabulary/interactive.js.map +1 -0
  125. package/dist/vocabulary/layout.d.ts +82 -0
  126. package/dist/vocabulary/layout.d.ts.map +1 -0
  127. package/dist/vocabulary/layout.js +136 -0
  128. package/dist/vocabulary/layout.js.map +1 -0
  129. package/dist/vocabulary/list.d.ts +17 -0
  130. package/dist/vocabulary/list.d.ts.map +1 -0
  131. package/dist/vocabulary/list.js +48 -0
  132. package/dist/vocabulary/list.js.map +1 -0
  133. package/dist/vocabulary/media.d.ts +28 -0
  134. package/dist/vocabulary/media.d.ts.map +1 -0
  135. package/dist/vocabulary/media.js +42 -0
  136. package/dist/vocabulary/media.js.map +1 -0
  137. package/dist/vocabulary/text.d.ts +60 -0
  138. package/dist/vocabulary/text.d.ts.map +1 -0
  139. package/dist/vocabulary/text.js +48 -0
  140. package/dist/vocabulary/text.js.map +1 -0
  141. package/package.json +21 -13
  142. package/src/JSONGenerativeUI.client.tsx +10 -2
  143. package/src/JSONGenerativeUI.shared.ts +8 -0
  144. package/src/actionRegistry.test.ts +90 -0
  145. package/src/actionRegistry.ts +88 -0
  146. package/src/buildPresentParameters.ts +38 -16
  147. package/src/generativeUIToJSX.test.ts +186 -0
  148. package/src/generativeUIToJSX.ts +112 -21
  149. package/src/index.server.ts +2 -0
  150. package/src/index.shared.ts +61 -0
  151. package/src/index.ts +2 -26
  152. package/src/ir.test.ts +203 -0
  153. package/src/ir.ts +279 -0
  154. package/src/renderGenerativeUI.test.tsx +69 -2
  155. package/src/renderGenerativeUI.tsx +49 -82
  156. package/src/slack/constants.ts +217 -0
  157. package/src/slack/decodeBlockAction.test.ts +135 -0
  158. package/src/slack/decodeBlockAction.ts +66 -0
  159. package/src/slack/fromSlackBlocks.test.ts +1145 -0
  160. package/src/slack/fromSlackBlocks.ts +709 -0
  161. package/src/slack/toSlackBlocks.test.ts +1936 -0
  162. package/src/slack/toSlackBlocks.ts +1319 -0
  163. package/src/slack/types.ts +230 -0
  164. package/src/slack.ts +37 -0
  165. package/src/teams/boundSpec.ts +102 -0
  166. package/src/teams/constants.ts +127 -0
  167. package/src/teams/decodeSubmitData.test.ts +148 -0
  168. package/src/teams/decodeSubmitData.ts +57 -0
  169. package/src/teams/toAdaptiveCard.test.ts +1410 -0
  170. package/src/teams/toAdaptiveCard.ts +762 -0
  171. package/src/teams/toTeamsAttachments.test.ts +29 -0
  172. package/src/teams/toTeamsAttachments.ts +137 -0
  173. package/src/teams/types.ts +237 -0
  174. package/src/teams.ts +34 -0
  175. package/src/types.ts +57 -42
  176. package/src/vocabulary/alert.test.tsx +136 -0
  177. package/src/vocabulary/alert.tsx +66 -0
  178. package/src/vocabulary/collectFormValues.test.ts +127 -0
  179. package/src/vocabulary/collectFormValues.ts +58 -0
  180. package/src/vocabulary/data.test.tsx +567 -0
  181. package/src/vocabulary/data.tsx +494 -0
  182. package/src/vocabulary/dispatch.ts +22 -0
  183. package/src/vocabulary/fact.test.tsx +15 -0
  184. package/src/vocabulary/fact.tsx +22 -0
  185. package/src/vocabulary/form.test.tsx +112 -0
  186. package/src/vocabulary/form.tsx +34 -0
  187. package/src/vocabulary/icon.test.tsx +64 -0
  188. package/src/vocabulary/icon.tsx +174 -0
  189. package/src/vocabulary/index.test.ts +63 -0
  190. package/src/vocabulary/index.ts +33 -0
  191. package/src/vocabulary/interactive.dispatch.test.tsx +352 -0
  192. package/src/vocabulary/interactive.test.tsx +248 -0
  193. package/src/vocabulary/interactive.tsx +269 -0
  194. package/src/vocabulary/layout.test.tsx +289 -0
  195. package/src/vocabulary/layout.tsx +229 -0
  196. package/src/vocabulary/list.test.tsx +195 -0
  197. package/src/vocabulary/list.tsx +48 -0
  198. package/src/vocabulary/media.test.tsx +85 -0
  199. package/src/vocabulary/media.tsx +56 -0
  200. package/src/vocabulary/text.test.tsx +73 -0
  201. package/src/vocabulary/text.tsx +59 -0
@@ -0,0 +1,111 @@
1
+ import { SlackAlertBlock, SlackButtonElement, SlackCardBlock, SlackCarouselBlock, SlackContextBlock, SlackDataTableBlock, SlackDataTableCell, SlackImageBlock, SlackSectionBlock, SlackTextObject } from "./types.js";
2
+ //#region src/slack/constants.d.ts
3
+ /** The maximum normalized traversal depth. */
4
+ declare const MAX_TRAVERSAL_DEPTH = 64;
5
+ /**
6
+ * The maximum number of entries kept at any single level (root, or a
7
+ * `children` array at any depth) of the raw spec, before it ever reaches
8
+ * `normalizeSpec`. Bounds a hostile array's reported `length` so the pre-pass
9
+ * can never be made to walk further than this regardless of what the array
10
+ * claims about itself.
11
+ */
12
+ declare const CHILDREN_CAP = 200;
13
+ /**
14
+ * The total number of nodes the pre-normalization bounding walk will visit
15
+ * across one call, regardless of how many times a shared reference recurs.
16
+ * Bounds the combinatorial work a DAG of shared or self-referential nodes
17
+ * would otherwise force even though each individual array stays within
18
+ * {@link CHILDREN_CAP}.
19
+ */
20
+ declare const NODE_BUDGET = 5000;
21
+ /** The block limit for a Slack message. */
22
+ declare const MESSAGE_BLOCK_CAP = 50;
23
+ /** The block limit for a Slack modal. */
24
+ declare const MODAL_BLOCK_CAP = 100;
25
+ /**
26
+ * The maximum number of top-level blocks accepted when parsing Slack Block
27
+ * Kit JSON back into generative UI, guarding against a hostile or malformed
28
+ * payload.
29
+ */
30
+ declare const INBOUND_BLOCK_CAP = 200;
31
+ /** The character limit for header text. */
32
+ declare const HEADER_TEXT_CAP = 150;
33
+ /** The character limit for section text. */
34
+ declare const SECTION_TEXT_CAP = 3000;
35
+ /** The maximum number of fields in one section. */
36
+ declare const FACT_FIELD_CAP = 10;
37
+ /** The character limit for one section field. */
38
+ declare const FACT_FIELD_TEXT_CAP = 2000;
39
+ /** The character limit for button labels and option labels. */
40
+ declare const INTERACTIVE_TEXT_CAP = 75;
41
+ /** The character limit for an action_id. */
42
+ declare const ACTION_ID_CAP = 255;
43
+ /** The character limit for a button's serialized value payload. */
44
+ declare const BUTTON_VALUE_CAP = 2000;
45
+ /** The maximum number of elements in one actions block. */
46
+ declare const ACTIONS_ELEMENT_CAP = 25;
47
+ /** The maximum number of options in a static select. */
48
+ declare const SELECT_OPTION_CAP = 100;
49
+ /** The maximum number of options in a radio-button group. */
50
+ declare const RADIO_OPTION_CAP = 10;
51
+ /** The character limit for a select or input placeholder. */
52
+ declare const PLACEHOLDER_TEXT_CAP = 150;
53
+ /** The character limit for an input's label. */
54
+ declare const INPUT_LABEL_CAP = 2000;
55
+ /** The maximum number of elements in one context block. */
56
+ declare const CONTEXT_ELEMENT_CAP = 10;
57
+ /** The character limit for one context element's text. */
58
+ declare const CONTEXT_TEXT_CAP = 3000;
59
+ /** The character limit for card titles and subtitles. */
60
+ declare const CARD_TITLE_CAP = 150;
61
+ /** The character limit for a card's body text. */
62
+ declare const CARD_BODY_CAP = 200;
63
+ /** The character limit for a card's subtext. */
64
+ declare const CARD_SUBTEXT_CAP = 200;
65
+ /** The maximum number of buttons in a card's actions. */
66
+ declare const CARD_ACTIONS_CAP = 3;
67
+ /** The minimum number of elements in a renderable carousel. */
68
+ declare const CAROUSEL_CARD_MIN = 1;
69
+ /** The maximum number of elements in a carousel. */
70
+ declare const CAROUSEL_CARD_CAP = 10;
71
+ /** The character limit for an alert's text. */
72
+ declare const ALERT_TEXT_CAP = 200;
73
+ /**
74
+ * The maximum number of data rows in a data-table block; the emitted `rows`
75
+ * array additionally carries one header row.
76
+ */
77
+ declare const DATA_TABLE_ROW_CAP = 100;
78
+ /** The maximum number of columns in a data-table block. */
79
+ declare const DATA_TABLE_COLUMN_CAP = 20;
80
+ /**
81
+ * The cumulative character limit (summed across every cell's text) shared by
82
+ * every data-table block in one payload.
83
+ */
84
+ declare const DATA_TABLE_CHAR_BUDGET = 10000;
85
+ /** The caption emitted on every native data-table block. */
86
+ declare const TABLE_CAPTION = "Table";
87
+ /** The cumulative character limit for native markdown blocks. */
88
+ declare const MARKDOWN_TEXT_BUDGET = 12000;
89
+ /** Builds the message-surface fallback for an alert. */
90
+ declare function buildAlertFallback(title: string, description: string, tone: "info" | "success" | "warning" | "danger"): readonly [SlackContextBlock, SlackSectionBlock];
91
+ /** Builds a 2026 Slack modal-only alert block, mapping `tone` to its `level`. */
92
+ declare function buildAlertBlock(text: string, tone: "info" | "success" | "warning" | "danger"): SlackAlertBlock;
93
+ type CardBlockFields = {
94
+ readonly heroImage?: SlackImageBlock;
95
+ readonly title?: SlackTextObject;
96
+ readonly subtitle?: SlackTextObject;
97
+ readonly body?: SlackTextObject;
98
+ readonly subtext?: SlackTextObject;
99
+ readonly actions?: readonly SlackButtonElement[];
100
+ };
101
+ /** Builds a 2026 Slack card block from its already-clamped fields. */
102
+ declare function buildCardBlock(fields: CardBlockFields): SlackCardBlock;
103
+ /** Builds a 2026 Slack carousel block. */
104
+ declare function buildCarouselBlock(elements: readonly SlackCardBlock[]): SlackCarouselBlock;
105
+ /** Builds a 2026 Slack data-table block; `rows[0]` must be the header row. */
106
+ declare function buildDataTableBlock(rows: readonly (readonly SlackDataTableCell[])[]): SlackDataTableBlock;
107
+ /** Builds the final note used when a surface block budget is exceeded. */
108
+ declare function buildBlockBudgetNote(omitted: number): SlackContextBlock;
109
+ //#endregion
110
+ export { ACTIONS_ELEMENT_CAP, ACTION_ID_CAP, ALERT_TEXT_CAP, BUTTON_VALUE_CAP, CARD_ACTIONS_CAP, CARD_BODY_CAP, CARD_SUBTEXT_CAP, CARD_TITLE_CAP, CAROUSEL_CARD_CAP, CAROUSEL_CARD_MIN, CHILDREN_CAP, CONTEXT_ELEMENT_CAP, CONTEXT_TEXT_CAP, DATA_TABLE_CHAR_BUDGET, DATA_TABLE_COLUMN_CAP, DATA_TABLE_ROW_CAP, FACT_FIELD_CAP, FACT_FIELD_TEXT_CAP, HEADER_TEXT_CAP, INBOUND_BLOCK_CAP, INPUT_LABEL_CAP, INTERACTIVE_TEXT_CAP, MARKDOWN_TEXT_BUDGET, MAX_TRAVERSAL_DEPTH, MESSAGE_BLOCK_CAP, MODAL_BLOCK_CAP, NODE_BUDGET, PLACEHOLDER_TEXT_CAP, RADIO_OPTION_CAP, SECTION_TEXT_CAP, SELECT_OPTION_CAP, TABLE_CAPTION, buildAlertBlock, buildAlertFallback, buildBlockBudgetNote, buildCardBlock, buildCarouselBlock, buildDataTableBlock };
111
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","names":[],"sources":["../../src/slack/constants.ts"],"mappings":";;;cAca;;;;;;;;cASA;;;;;;;;cASA;;cAGA;;cAGA;;;;;;cAOA;;cAGA;;cAGA;;cAGA;;cAGA;;cAGA;;cAGA;;cAGA;;cAGA;;cAGA;;cAGA;;cAGA;;cAGA;;cAGA;;cAGA;;cAGA;;cAGA;;cAGA;;cAGA;;cAGA;;cAGA;;cAGA;;;;;cAMA;;cAGA;;;;;cAMA;;cAGA;;cAGA;;iBAGG,mBACd,eACA,qBACA,4DACW,mBAAmB;;iBAmBhB,gBACd,cACA,kDACC;KAUE;WACM,YAAY;WACZ,QAAQ;WACR,WAAW;WACX,OAAO;WACP,UAAU;WACV,mBAAmB;;;iBAId,eAAe,QAAQ,kBAAkB;;iBAczC,mBACd,mBAAmB,mBAClB;;iBAKa,oBACd,yBAAyB,0BACxB;;iBAKa,qBAAqB,kBAAkB"}
@@ -0,0 +1,168 @@
1
+ //#region src/slack/constants.ts
2
+ /** The maximum normalized traversal depth. */
3
+ const MAX_TRAVERSAL_DEPTH = 64;
4
+ /**
5
+ * The maximum number of entries kept at any single level (root, or a
6
+ * `children` array at any depth) of the raw spec, before it ever reaches
7
+ * `normalizeSpec`. Bounds a hostile array's reported `length` so the pre-pass
8
+ * can never be made to walk further than this regardless of what the array
9
+ * claims about itself.
10
+ */
11
+ const CHILDREN_CAP = 200;
12
+ /**
13
+ * The total number of nodes the pre-normalization bounding walk will visit
14
+ * across one call, regardless of how many times a shared reference recurs.
15
+ * Bounds the combinatorial work a DAG of shared or self-referential nodes
16
+ * would otherwise force even though each individual array stays within
17
+ * {@link CHILDREN_CAP}.
18
+ */
19
+ const NODE_BUDGET = 5e3;
20
+ /** The block limit for a Slack message. */
21
+ const MESSAGE_BLOCK_CAP = 50;
22
+ /** The block limit for a Slack modal. */
23
+ const MODAL_BLOCK_CAP = 100;
24
+ /**
25
+ * The maximum number of top-level blocks accepted when parsing Slack Block
26
+ * Kit JSON back into generative UI, guarding against a hostile or malformed
27
+ * payload.
28
+ */
29
+ const INBOUND_BLOCK_CAP = 200;
30
+ /** The character limit for header text. */
31
+ const HEADER_TEXT_CAP = 150;
32
+ /** The character limit for section text. */
33
+ const SECTION_TEXT_CAP = 3e3;
34
+ /** The maximum number of fields in one section. */
35
+ const FACT_FIELD_CAP = 10;
36
+ /** The character limit for one section field. */
37
+ const FACT_FIELD_TEXT_CAP = 2e3;
38
+ /** The character limit for button labels and option labels. */
39
+ const INTERACTIVE_TEXT_CAP = 75;
40
+ /** The character limit for an action_id. */
41
+ const ACTION_ID_CAP = 255;
42
+ /** The character limit for a button's serialized value payload. */
43
+ const BUTTON_VALUE_CAP = 2e3;
44
+ /** The maximum number of elements in one actions block. */
45
+ const ACTIONS_ELEMENT_CAP = 25;
46
+ /** The maximum number of options in a static select. */
47
+ const SELECT_OPTION_CAP = 100;
48
+ /** The maximum number of options in a radio-button group. */
49
+ const RADIO_OPTION_CAP = 10;
50
+ /** The character limit for a select or input placeholder. */
51
+ const PLACEHOLDER_TEXT_CAP = 150;
52
+ /** The character limit for an input's label. */
53
+ const INPUT_LABEL_CAP = 2e3;
54
+ /** The maximum number of elements in one context block. */
55
+ const CONTEXT_ELEMENT_CAP = 10;
56
+ /** The character limit for one context element's text. */
57
+ const CONTEXT_TEXT_CAP = 3e3;
58
+ /** The character limit for card titles and subtitles. */
59
+ const CARD_TITLE_CAP = 150;
60
+ /** The character limit for a card's body text. */
61
+ const CARD_BODY_CAP = 200;
62
+ /** The character limit for a card's subtext. */
63
+ const CARD_SUBTEXT_CAP = 200;
64
+ /** The maximum number of buttons in a card's actions. */
65
+ const CARD_ACTIONS_CAP = 3;
66
+ /** The minimum number of elements in a renderable carousel. */
67
+ const CAROUSEL_CARD_MIN = 1;
68
+ /** The maximum number of elements in a carousel. */
69
+ const CAROUSEL_CARD_CAP = 10;
70
+ /** The character limit for an alert's text. */
71
+ const ALERT_TEXT_CAP = 200;
72
+ /**
73
+ * The maximum number of data rows in a data-table block; the emitted `rows`
74
+ * array additionally carries one header row.
75
+ */
76
+ const DATA_TABLE_ROW_CAP = 100;
77
+ /** The maximum number of columns in a data-table block. */
78
+ const DATA_TABLE_COLUMN_CAP = 20;
79
+ /**
80
+ * The cumulative character limit (summed across every cell's text) shared by
81
+ * every data-table block in one payload.
82
+ */
83
+ const DATA_TABLE_CHAR_BUDGET = 1e4;
84
+ /** The caption emitted on every native data-table block. */
85
+ const TABLE_CAPTION = "Table";
86
+ /** The cumulative character limit for native markdown blocks. */
87
+ const MARKDOWN_TEXT_BUDGET = 12e3;
88
+ /** Builds the message-surface fallback for an alert. */
89
+ function buildAlertFallback(title, description, tone) {
90
+ const emoji = {
91
+ info: "ℹ️",
92
+ success: "✅",
93
+ warning: "⚠️",
94
+ danger: "🛑"
95
+ }[tone];
96
+ return [{
97
+ type: "context",
98
+ elements: [{
99
+ type: "mrkdwn",
100
+ text: title ? `${emoji} *${title}*` : emoji
101
+ }]
102
+ }, {
103
+ type: "section",
104
+ text: {
105
+ type: "mrkdwn",
106
+ text: description
107
+ }
108
+ }];
109
+ }
110
+ /** Builds a 2026 Slack modal-only alert block, mapping `tone` to its `level`. */
111
+ function buildAlertBlock(text, tone) {
112
+ const level = {
113
+ info: "info",
114
+ success: "success",
115
+ warning: "warning",
116
+ danger: "error"
117
+ }[tone];
118
+ return {
119
+ type: "alert",
120
+ text: {
121
+ type: "mrkdwn",
122
+ text
123
+ },
124
+ level
125
+ };
126
+ }
127
+ /** Builds a 2026 Slack card block from its already-clamped fields. */
128
+ function buildCardBlock(fields) {
129
+ const { heroImage, title, subtitle, body, subtext, actions } = fields;
130
+ return {
131
+ type: "card",
132
+ ...heroImage !== void 0 ? { hero_image: heroImage } : {},
133
+ ...title !== void 0 ? { title } : {},
134
+ ...subtitle !== void 0 ? { subtitle } : {},
135
+ ...body !== void 0 ? { body } : {},
136
+ ...subtext !== void 0 ? { subtext } : {},
137
+ ...actions !== void 0 ? { actions } : {}
138
+ };
139
+ }
140
+ /** Builds a 2026 Slack carousel block. */
141
+ function buildCarouselBlock(elements) {
142
+ return {
143
+ type: "carousel",
144
+ elements
145
+ };
146
+ }
147
+ /** Builds a 2026 Slack data-table block; `rows[0]` must be the header row. */
148
+ function buildDataTableBlock(rows) {
149
+ return {
150
+ type: "data_table",
151
+ caption: TABLE_CAPTION,
152
+ rows
153
+ };
154
+ }
155
+ /** Builds the final note used when a surface block budget is exceeded. */
156
+ function buildBlockBudgetNote(omitted) {
157
+ return {
158
+ type: "context",
159
+ elements: [{
160
+ type: "mrkdwn",
161
+ text: `${omitted} ${omitted === 1 ? "block was" : "blocks were"} omitted.`
162
+ }]
163
+ };
164
+ }
165
+ //#endregion
166
+ export { ACTIONS_ELEMENT_CAP, ACTION_ID_CAP, ALERT_TEXT_CAP, BUTTON_VALUE_CAP, CARD_ACTIONS_CAP, CARD_BODY_CAP, CARD_SUBTEXT_CAP, CARD_TITLE_CAP, CAROUSEL_CARD_CAP, CAROUSEL_CARD_MIN, CHILDREN_CAP, CONTEXT_ELEMENT_CAP, CONTEXT_TEXT_CAP, DATA_TABLE_CHAR_BUDGET, DATA_TABLE_COLUMN_CAP, DATA_TABLE_ROW_CAP, FACT_FIELD_CAP, FACT_FIELD_TEXT_CAP, HEADER_TEXT_CAP, INBOUND_BLOCK_CAP, INPUT_LABEL_CAP, INTERACTIVE_TEXT_CAP, MARKDOWN_TEXT_BUDGET, MAX_TRAVERSAL_DEPTH, MESSAGE_BLOCK_CAP, MODAL_BLOCK_CAP, NODE_BUDGET, PLACEHOLDER_TEXT_CAP, RADIO_OPTION_CAP, SECTION_TEXT_CAP, SELECT_OPTION_CAP, TABLE_CAPTION, buildAlertBlock, buildAlertFallback, buildBlockBudgetNote, buildCardBlock, buildCarouselBlock, buildDataTableBlock };
167
+
168
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","names":[],"sources":["../../src/slack/constants.ts"],"sourcesContent":["import type {\n SlackAlertBlock,\n SlackButtonElement,\n SlackCardBlock,\n SlackCarouselBlock,\n SlackContextBlock,\n SlackDataTableBlock,\n SlackDataTableCell,\n SlackImageBlock,\n SlackSectionBlock,\n SlackTextObject,\n} from \"./types\";\n\n/** The maximum normalized traversal depth. */\nexport const MAX_TRAVERSAL_DEPTH = 64;\n\n/**\n * The maximum number of entries kept at any single level (root, or a\n * `children` array at any depth) of the raw spec, before it ever reaches\n * `normalizeSpec`. Bounds a hostile array's reported `length` so the pre-pass\n * can never be made to walk further than this regardless of what the array\n * claims about itself.\n */\nexport const CHILDREN_CAP = 200;\n\n/**\n * The total number of nodes the pre-normalization bounding walk will visit\n * across one call, regardless of how many times a shared reference recurs.\n * Bounds the combinatorial work a DAG of shared or self-referential nodes\n * would otherwise force even though each individual array stays within\n * {@link CHILDREN_CAP}.\n */\nexport const NODE_BUDGET = 5000;\n\n/** The block limit for a Slack message. */\nexport const MESSAGE_BLOCK_CAP = 50;\n\n/** The block limit for a Slack modal. */\nexport const MODAL_BLOCK_CAP = 100;\n\n/**\n * The maximum number of top-level blocks accepted when parsing Slack Block\n * Kit JSON back into generative UI, guarding against a hostile or malformed\n * payload.\n */\nexport const INBOUND_BLOCK_CAP = 200;\n\n/** The character limit for header text. */\nexport const HEADER_TEXT_CAP = 150;\n\n/** The character limit for section text. */\nexport const SECTION_TEXT_CAP = 3000;\n\n/** The maximum number of fields in one section. */\nexport const FACT_FIELD_CAP = 10;\n\n/** The character limit for one section field. */\nexport const FACT_FIELD_TEXT_CAP = 2000;\n\n/** The character limit for button labels and option labels. */\nexport const INTERACTIVE_TEXT_CAP = 75;\n\n/** The character limit for an action_id. */\nexport const ACTION_ID_CAP = 255;\n\n/** The character limit for a button's serialized value payload. */\nexport const BUTTON_VALUE_CAP = 2000;\n\n/** The maximum number of elements in one actions block. */\nexport const ACTIONS_ELEMENT_CAP = 25;\n\n/** The maximum number of options in a static select. */\nexport const SELECT_OPTION_CAP = 100;\n\n/** The maximum number of options in a radio-button group. */\nexport const RADIO_OPTION_CAP = 10;\n\n/** The character limit for a select or input placeholder. */\nexport const PLACEHOLDER_TEXT_CAP = 150;\n\n/** The character limit for an input's label. */\nexport const INPUT_LABEL_CAP = 2000;\n\n/** The maximum number of elements in one context block. */\nexport const CONTEXT_ELEMENT_CAP = 10;\n\n/** The character limit for one context element's text. */\nexport const CONTEXT_TEXT_CAP = 3000;\n\n/** The character limit for card titles and subtitles. */\nexport const CARD_TITLE_CAP = 150;\n\n/** The character limit for a card's body text. */\nexport const CARD_BODY_CAP = 200;\n\n/** The character limit for a card's subtext. */\nexport const CARD_SUBTEXT_CAP = 200;\n\n/** The maximum number of buttons in a card's actions. */\nexport const CARD_ACTIONS_CAP = 3;\n\n/** The minimum number of elements in a renderable carousel. */\nexport const CAROUSEL_CARD_MIN = 1;\n\n/** The maximum number of elements in a carousel. */\nexport const CAROUSEL_CARD_CAP = 10;\n\n/** The character limit for an alert's text. */\nexport const ALERT_TEXT_CAP = 200;\n\n/**\n * The maximum number of data rows in a data-table block; the emitted `rows`\n * array additionally carries one header row.\n */\nexport const DATA_TABLE_ROW_CAP = 100;\n\n/** The maximum number of columns in a data-table block. */\nexport const DATA_TABLE_COLUMN_CAP = 20;\n\n/**\n * The cumulative character limit (summed across every cell's text) shared by\n * every data-table block in one payload.\n */\nexport const DATA_TABLE_CHAR_BUDGET = 10000;\n\n/** The caption emitted on every native data-table block. */\nexport const TABLE_CAPTION = \"Table\";\n\n/** The cumulative character limit for native markdown blocks. */\nexport const MARKDOWN_TEXT_BUDGET = 12000;\n\n/** Builds the message-surface fallback for an alert. */\nexport function buildAlertFallback(\n title: string,\n description: string,\n tone: \"info\" | \"success\" | \"warning\" | \"danger\",\n): readonly [SlackContextBlock, SlackSectionBlock] {\n const emoji = {\n info: \"ℹ️\",\n success: \"✅\",\n warning: \"⚠️\",\n danger: \"🛑\",\n }[tone];\n return [\n {\n type: \"context\",\n elements: [\n { type: \"mrkdwn\", text: title ? `${emoji} *${title}*` : emoji },\n ],\n },\n { type: \"section\", text: { type: \"mrkdwn\", text: description } },\n ];\n}\n\n/** Builds a 2026 Slack modal-only alert block, mapping `tone` to its `level`. */\nexport function buildAlertBlock(\n text: string,\n tone: \"info\" | \"success\" | \"warning\" | \"danger\",\n): SlackAlertBlock {\n const level = {\n info: \"info\",\n success: \"success\",\n warning: \"warning\",\n danger: \"error\",\n }[tone] as const;\n return { type: \"alert\", text: { type: \"mrkdwn\", text }, level };\n}\n\ntype CardBlockFields = {\n readonly heroImage?: SlackImageBlock;\n readonly title?: SlackTextObject;\n readonly subtitle?: SlackTextObject;\n readonly body?: SlackTextObject;\n readonly subtext?: SlackTextObject;\n readonly actions?: readonly SlackButtonElement[];\n};\n\n/** Builds a 2026 Slack card block from its already-clamped fields. */\nexport function buildCardBlock(fields: CardBlockFields): SlackCardBlock {\n const { heroImage, title, subtitle, body, subtext, actions } = fields;\n return {\n type: \"card\",\n ...(heroImage !== undefined ? { hero_image: heroImage } : {}),\n ...(title !== undefined ? { title } : {}),\n ...(subtitle !== undefined ? { subtitle } : {}),\n ...(body !== undefined ? { body } : {}),\n ...(subtext !== undefined ? { subtext } : {}),\n ...(actions !== undefined ? { actions } : {}),\n };\n}\n\n/** Builds a 2026 Slack carousel block. */\nexport function buildCarouselBlock(\n elements: readonly SlackCardBlock[],\n): SlackCarouselBlock {\n return { type: \"carousel\", elements };\n}\n\n/** Builds a 2026 Slack data-table block; `rows[0]` must be the header row. */\nexport function buildDataTableBlock(\n rows: readonly (readonly SlackDataTableCell[])[],\n): SlackDataTableBlock {\n return { type: \"data_table\", caption: TABLE_CAPTION, rows };\n}\n\n/** Builds the final note used when a surface block budget is exceeded. */\nexport function buildBlockBudgetNote(omitted: number): SlackContextBlock {\n return {\n type: \"context\",\n elements: [\n {\n type: \"mrkdwn\",\n text: `${omitted} ${omitted === 1 ? \"block was\" : \"blocks were\"} omitted.`,\n },\n ],\n };\n}\n"],"mappings":";;AAcA,MAAa,sBAAsB;;;;;;;;AASnC,MAAa,eAAe;;;;;;;;AAS5B,MAAa,cAAc;;AAG3B,MAAa,oBAAoB;;AAGjC,MAAa,kBAAkB;;;;;;AAO/B,MAAa,oBAAoB;;AAGjC,MAAa,kBAAkB;;AAG/B,MAAa,mBAAmB;;AAGhC,MAAa,iBAAiB;;AAG9B,MAAa,sBAAsB;;AAGnC,MAAa,uBAAuB;;AAGpC,MAAa,gBAAgB;;AAG7B,MAAa,mBAAmB;;AAGhC,MAAa,sBAAsB;;AAGnC,MAAa,oBAAoB;;AAGjC,MAAa,mBAAmB;;AAGhC,MAAa,uBAAuB;;AAGpC,MAAa,kBAAkB;;AAG/B,MAAa,sBAAsB;;AAGnC,MAAa,mBAAmB;;AAGhC,MAAa,iBAAiB;;AAG9B,MAAa,gBAAgB;;AAG7B,MAAa,mBAAmB;;AAGhC,MAAa,mBAAmB;;AAGhC,MAAa,oBAAoB;;AAGjC,MAAa,oBAAoB;;AAGjC,MAAa,iBAAiB;;;;;AAM9B,MAAa,qBAAqB;;AAGlC,MAAa,wBAAwB;;;;;AAMrC,MAAa,yBAAyB;;AAGtC,MAAa,gBAAgB;;AAG7B,MAAa,uBAAuB;;AAGpC,SAAgB,mBACd,OACA,aACA,MACiD;CACjD,MAAM,QAAQ;EACZ,MAAM;EACN,SAAS;EACT,SAAS;EACT,QAAQ;CACV,EAAE;CACF,OAAO,CACL;EACE,MAAM;EACN,UAAU,CACR;GAAE,MAAM;GAAU,MAAM,QAAQ,GAAG,MAAM,IAAI,MAAM,KAAK;EAAM,CAChE;CACF,GACA;EAAE,MAAM;EAAW,MAAM;GAAE,MAAM;GAAU,MAAM;EAAY;CAAE,CACjE;AACF;;AAGA,SAAgB,gBACd,MACA,MACiB;CACjB,MAAM,QAAQ;EACZ,MAAM;EACN,SAAS;EACT,SAAS;EACT,QAAQ;CACV,EAAE;CACF,OAAO;EAAE,MAAM;EAAS,MAAM;GAAE,MAAM;GAAU;EAAK;EAAG;CAAM;AAChE;;AAYA,SAAgB,eAAe,QAAyC;CACtE,MAAM,EAAE,WAAW,OAAO,UAAU,MAAM,SAAS,YAAY;CAC/D,OAAO;EACL,MAAM;EACN,GAAI,cAAc,KAAA,IAAY,EAAE,YAAY,UAAU,IAAI,CAAC;EAC3D,GAAI,UAAU,KAAA,IAAY,EAAE,MAAM,IAAI,CAAC;EACvC,GAAI,aAAa,KAAA,IAAY,EAAE,SAAS,IAAI,CAAC;EAC7C,GAAI,SAAS,KAAA,IAAY,EAAE,KAAK,IAAI,CAAC;EACrC,GAAI,YAAY,KAAA,IAAY,EAAE,QAAQ,IAAI,CAAC;EAC3C,GAAI,YAAY,KAAA,IAAY,EAAE,QAAQ,IAAI,CAAC;CAC7C;AACF;;AAGA,SAAgB,mBACd,UACoB;CACpB,OAAO;EAAE,MAAM;EAAY;CAAS;AACtC;;AAGA,SAAgB,oBACd,MACqB;CACrB,OAAO;EAAE,MAAM;EAAc,SAAS;EAAe;CAAK;AAC5D;;AAGA,SAAgB,qBAAqB,SAAoC;CACvE,OAAO;EACL,MAAM;EACN,UAAU,CACR;GACE,MAAM;GACN,MAAM,GAAG,QAAQ,GAAG,YAAY,IAAI,cAAc,cAAc;EAClE,CACF;CACF;AACF"}
@@ -0,0 +1,11 @@
1
+ import { Action } from "../ir.js";
2
+ //#region src/slack/decodeBlockAction.d.ts
3
+ /**
4
+ * Decodes one structural entry from a Slack `block_actions` payload.
5
+ * `$input` is reserved for the runtime selection: a `$input` key inside the
6
+ * button's JSON `value` payload is dropped rather than spread into the result.
7
+ */
8
+ declare function decodeBlockAction(action: unknown): Action | undefined;
9
+ //#endregion
10
+ export { decodeBlockAction };
11
+ //# sourceMappingURL=decodeBlockAction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decodeBlockAction.d.ts","names":[],"sources":["../../src/slack/decodeBlockAction.ts"],"mappings":";;;;;;;iBAegB,kBAAkB,kBAAkB"}
@@ -0,0 +1,40 @@
1
+ //#region src/slack/decodeBlockAction.ts
2
+ const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
3
+ const optionValue = (value) => isRecord(value) && typeof value["value"] === "string" ? value["value"] : void 0;
4
+ /**
5
+ * Decodes one structural entry from a Slack `block_actions` payload.
6
+ * `$input` is reserved for the runtime selection: a `$input` key inside the
7
+ * button's JSON `value` payload is dropped rather than spread into the result.
8
+ */
9
+ function decodeBlockAction(action) {
10
+ try {
11
+ if (!isRecord(action) || typeof action["action_id"] !== "string") return;
12
+ const actionId = action["action_id"];
13
+ if (!actionId) return void 0;
14
+ const rawValue = action["value"];
15
+ let payload = {};
16
+ let plainValue;
17
+ if (typeof rawValue === "string") try {
18
+ const parsed = JSON.parse(rawValue);
19
+ if (isRecord(parsed)) payload = parsed;
20
+ else plainValue = rawValue;
21
+ } catch {
22
+ plainValue = rawValue;
23
+ }
24
+ const selectedOption = optionValue(action["selected_option"]);
25
+ const selectedDate = typeof action["selected_date"] === "string" ? action["selected_date"] : void 0;
26
+ const selectedOptions = Array.isArray(action["selected_options"]) ? action["selected_options"].map(optionValue).filter((value) => value !== void 0) : void 0;
27
+ const input = selectedOption ?? selectedDate ?? (selectedOptions !== void 0 ? selectedOptions : plainValue);
28
+ return {
29
+ ...Object.fromEntries(Object.entries(payload).filter(([key]) => key !== "$input")),
30
+ type: actionId,
31
+ ...input !== void 0 ? { $input: input } : {}
32
+ };
33
+ } catch {
34
+ return;
35
+ }
36
+ }
37
+ //#endregion
38
+ export { decodeBlockAction };
39
+
40
+ //# sourceMappingURL=decodeBlockAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decodeBlockAction.js","names":[],"sources":["../../src/slack/decodeBlockAction.ts"],"sourcesContent":["import type { Action } from \"../ir\";\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\nconst optionValue = (value: unknown): string | undefined =>\n isRecord(value) && typeof value[\"value\"] === \"string\"\n ? value[\"value\"]\n : undefined;\n\n/**\n * Decodes one structural entry from a Slack `block_actions` payload.\n * `$input` is reserved for the runtime selection: a `$input` key inside the\n * button's JSON `value` payload is dropped rather than spread into the result.\n */\nexport function decodeBlockAction(action: unknown): Action | undefined {\n try {\n if (!isRecord(action) || typeof action[\"action_id\"] !== \"string\") {\n return undefined;\n }\n\n const actionId = action[\"action_id\"];\n if (!actionId) return undefined;\n\n const rawValue = action[\"value\"];\n let payload: Record<string, unknown> = {};\n let plainValue: string | undefined;\n if (typeof rawValue === \"string\") {\n try {\n const parsed: unknown = JSON.parse(rawValue);\n if (isRecord(parsed)) {\n payload = parsed;\n } else {\n plainValue = rawValue;\n }\n } catch {\n plainValue = rawValue;\n }\n }\n\n const selectedOption = optionValue(action[\"selected_option\"]);\n const selectedDate =\n typeof action[\"selected_date\"] === \"string\"\n ? action[\"selected_date\"]\n : undefined;\n const selectedOptions = Array.isArray(action[\"selected_options\"])\n ? action[\"selected_options\"]\n .map(optionValue)\n .filter((value): value is string => value !== undefined)\n : undefined;\n const input =\n selectedOption ??\n selectedDate ??\n (selectedOptions !== undefined ? selectedOptions : plainValue);\n\n return {\n ...Object.fromEntries(\n Object.entries(payload).filter(([key]) => key !== \"$input\"),\n ),\n type: actionId,\n ...(input !== undefined ? { $input: input } : {}),\n };\n } catch {\n return undefined;\n }\n}\n"],"mappings":";AAEA,MAAM,YAAY,UAChB,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAErE,MAAM,eAAe,UACnB,SAAS,KAAK,KAAK,OAAO,MAAM,aAAa,WACzC,MAAM,WACN,KAAA;;;;;;AAON,SAAgB,kBAAkB,QAAqC;CACrE,IAAI;EACF,IAAI,CAAC,SAAS,MAAM,KAAK,OAAO,OAAO,iBAAiB,UACtD;EAGF,MAAM,WAAW,OAAO;EACxB,IAAI,CAAC,UAAU,OAAO,KAAA;EAEtB,MAAM,WAAW,OAAO;EACxB,IAAI,UAAmC,CAAC;EACxC,IAAI;EACJ,IAAI,OAAO,aAAa,UACtB,IAAI;GACF,MAAM,SAAkB,KAAK,MAAM,QAAQ;GAC3C,IAAI,SAAS,MAAM,GACjB,UAAU;QAEV,aAAa;EAEjB,QAAQ;GACN,aAAa;EACf;EAGF,MAAM,iBAAiB,YAAY,OAAO,kBAAkB;EAC5D,MAAM,eACJ,OAAO,OAAO,qBAAqB,WAC/B,OAAO,mBACP,KAAA;EACN,MAAM,kBAAkB,MAAM,QAAQ,OAAO,mBAAmB,IAC5D,OAAO,mBAAmB,CACvB,IAAI,WAAW,CAAC,CAChB,QAAQ,UAA2B,UAAU,KAAA,CAAS,IACzD,KAAA;EACJ,MAAM,QACJ,kBACA,iBACC,oBAAoB,KAAA,IAAY,kBAAkB;EAErD,OAAO;GACL,GAAG,OAAO,YACR,OAAO,QAAQ,OAAO,CAAC,CAAC,QAAQ,CAAC,SAAS,QAAQ,QAAQ,CAC5D;GACA,MAAM;GACN,GAAI,UAAU,KAAA,IAAY,EAAE,QAAQ,MAAM,IAAI,CAAC;EACjD;CACF,QAAQ;EACN;CACF;AACF"}
@@ -0,0 +1,30 @@
1
+ import { FromSlackBlocksResult } from "./types.js";
2
+ //#region src/slack/fromSlackBlocks.d.ts
3
+ /**
4
+ * Converts Slack Block Kit JSON back into a generative-ui IR tree, inverting
5
+ * {@link toSlackBlocks}. Accepts a blocks array or a `{ blocks }` wrapper;
6
+ * malformed input resolves to an empty node list plus a warning, and an
7
+ * unrecognized block or action element is skipped with a "dropped" warning.
8
+ * Every array read along the way (blocks, fields, options, elements, cards,
9
+ * rows, cells) is bounded to its site's cap before it is mapped over, so a
10
+ * hostile array (sparse or proxied with a fabricated `length`) is clamped
11
+ * with a "clamped" warning instead of stalling the event loop. Never throws.
12
+ *
13
+ * The Slack shape is lossier than the IR, so some information cannot be
14
+ * recovered: a context block's elements always decode as `Caption` (the
15
+ * original `Badge` vs `Caption` distinction does not survive the round trip),
16
+ * a button's `buttonStyle` is only recovered for the `primary`/`danger` Slack
17
+ * styles, a native alert block's `title` and `description` merge into a
18
+ * single `description` string, and a card's layout collapses to its `title`,
19
+ * a flat `children` list (image, then text, then caption, in that order),
20
+ * and `confirm`/`cancel` footer buttons. A section field's label and value
21
+ * are split on the first `*`+newline delimiter, so a label or value that
22
+ * itself contains that exact delimiter cannot be split back unambiguously.
23
+ * A data-table cell that Slack carries as `raw_text` always decodes as a
24
+ * string, even when its text is the stringified form of a boolean, since the
25
+ * Slack shape does not distinguish a boolean from ordinary text.
26
+ */
27
+ declare function fromSlackBlocks(blocks: unknown): FromSlackBlocksResult;
28
+ //#endregion
29
+ export { fromSlackBlocks };
30
+ //# sourceMappingURL=fromSlackBlocks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fromSlackBlocks.d.ts","names":[],"sources":["../../src/slack/fromSlackBlocks.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;iBA+pBgB,gBAAgB,kBAAkB"}