@sendbird/actionbook-core 0.10.8 → 0.10.10

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.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as BlockNode, a as BlockquoteNode, b as BoldMark, L as ListItemNode, c as BulletListNode, C as CodeMark, D as DocumentNode, H as HardBreakNode, I as InlineNode, d as HeadingNode, e as HorizontalRuleNode, f as ItalicMark, J as JinjaIfBranch, g as JinjaIfBlockNode, h as JinjaIfInlineNode, i as JumpPointNode, j as LinkMark, N as NoteBlockNode, O as OrderedListNode, P as ParagraphNode, R as ResourceTagType, k as ResourceTagNode, S as StrikethroughMark, T as TableRowNode, l as TableNode, m as TableCellNode, M as Mark, n as TextNode, U as UnderlineMark, A as AstNode, o as NodePath, p as LintRule, q as LintContext, r as LintResult, s as LlmLintRule, t as LlmCompletionEndpoint, u as LintSection } from './types-BQ95zx4j.js';
2
- export { v as JSONContent, w as JUMP_POINT_ID_PATTERN, x as LintSeverity, y as RESOURCE_TAG_TYPES, z as fromProseMirrorJSON } from './types-BQ95zx4j.js';
1
+ import { B as BlockNode, a as BlockquoteNode, b as BoldMark, L as ListItemNode, c as BulletListNode, C as CodeMark, D as DocumentNode, H as HardBreakNode, I as InlineNode, d as HeadingNode, e as HorizontalRuleNode, f as ItalicMark, J as JinjaIfBranch, g as JinjaIfBlockNode, h as JinjaIfInlineNode, i as JumpPointNode, j as LinkMark, N as NoteBlockNode, O as OrderedListNode, P as ParagraphNode, R as ResourceTagType, k as ResourceTagNode, S as StrikethroughMark, T as TableRowNode, l as TableNode, m as TableCellNode, M as Mark, n as TextNode, U as UnderlineMark, A as AstNode, o as NodePath, p as LintRule, q as LintContext, r as LintResult, s as LlmLintRule, t as LlmCompletionEndpoint, u as LintSection } from './types-Bu4_nY3M.js';
2
+ export { v as JSONContent, w as JUMP_POINT_ID_PATTERN, x as LintSeverity, y as RESOURCE_TAG_TYPES, z as fromProseMirrorJSON } from './types-Bu4_nY3M.js';
3
3
  import { Root } from 'mdast';
4
4
 
5
5
  declare const bold: () => BoldMark;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/ast/types.ts
2
- var RESOURCE_TAG_TYPES = ["tool", "manual", "agent_message_template", "handoff", "time_diff", "time_difference"];
2
+ var RESOURCE_TAG_TYPES = ["tool", "manual", "agent_message_template", "handoff", "end_call", "time_diff", "time_difference"];
3
3
  var JUMP_POINT_ID_PATTERN = /^[\p{L}\p{N}_-]+$/u;
4
4
 
5
5
  // src/ast/builders.ts
@@ -2099,7 +2099,7 @@ function listItemWithTaskListItem(node, parent, state, info) {
2099
2099
 
2100
2100
  // src/markdown/plugins/resourceTag.ts
2101
2101
  var RESOURCE_TAG_RE = /\{\{([^:}]+):([^:}]*):([^}]+)\}\}/g;
2102
- var VALID_TYPES = /* @__PURE__ */ new Set(["tool", "manual", "agent_message_template", "handoff", "end_call", "time_diff"]);
2102
+ var VALID_TYPES = /* @__PURE__ */ new Set(["tool", "manual", "agent_message_template", "handoff", "end_call", "time_diff", "time_difference"]);
2103
2103
  function splitTextWithResourceTags(text2) {
2104
2104
  const results = [];
2105
2105
  let lastIndex = 0;
@@ -2186,7 +2186,8 @@ function convertInline(node, marks = [], depth = 0) {
2186
2186
  case "text":
2187
2187
  return [marks.length > 0 ? { type: "text", text: node.value, marks } : { type: "text", text: node.value }];
2188
2188
  case "strong": {
2189
- const childMarks = [...marks, { type: "bold" }];
2189
+ const alreadyBold = marks.some((m) => m.type === "bold");
2190
+ const childMarks = [...marks, { type: alreadyBold ? "italic" : "bold" }];
2190
2191
  return node.children.flatMap((child) => convertInline(child, childMarks, depth + 1));
2191
2192
  }
2192
2193
  case "emphasis": {
@@ -2993,6 +2994,12 @@ function serializeToMarkdown(doc2) {
2993
2994
  text: textHandler,
2994
2995
  link: linkHandler,
2995
2996
  listItem: listItemHandler,
2997
+ emphasis: ((node, _parent, state, info) => {
2998
+ const exit2 = state.enter("emphasis");
2999
+ const value = state.containerPhrasing(node, { ...info, before: "_", after: "_" });
3000
+ exit2();
3001
+ return `__${value}__`;
3002
+ }),
2996
3003
  ...resourceTagToMarkdown().handlers,
2997
3004
  ...jumpPointToMarkdown().handlers
2998
3005
  },
@@ -3436,7 +3443,7 @@ function invertOperation(doc2, op) {
3436
3443
  }
3437
3444
 
3438
3445
  // src/jinja/scanner.ts
3439
- var JINJA_PATTERN = /\{%\s*(if|elif|else|endif)\s*([^%]*?)\s*%\}/g;
3446
+ var JINJA_PATTERN = /\{%\s*(if|elif|else|endif)\s*(.*?)\s*%\}/g;
3440
3447
  function scanJinjaBlocks(text2) {
3441
3448
  const blocks = [];
3442
3449
  JINJA_PATTERN.lastIndex = 0;
@@ -3670,7 +3677,7 @@ function tokenize(input) {
3670
3677
  tokens.push({ type: "STRING", value: str });
3671
3678
  continue;
3672
3679
  }
3673
- if (/[0-9]/.test(input[i]) || input[i] === "-" && i + 1 < input.length && /[0-9]/.test(input[i + 1]) && (tokens.length === 0 || ["AND", "OR", "NOT", "EQ", "NEQ", "LT", "GT", "LTE", "GTE", "LPAREN", "IN", "IS"].includes(tokens[tokens.length - 1].type))) {
3680
+ if (/[0-9]/.test(input[i]) || input[i] === "-" && i + 1 < input.length && /[0-9]/.test(input[i + 1]) && (tokens.length === 0 || ["AND", "OR", "NOT", "EQ", "NEQ", "LT", "GT", "LTE", "GTE", "LPAREN", "IN", "IS", "COMMA"].includes(tokens[tokens.length - 1].type))) {
3674
3681
  let num = "";
3675
3682
  if (input[i] === "-") {
3676
3683
  num = "-";
@@ -4692,7 +4699,7 @@ var END_ACTION_TEXTS = /* @__PURE__ */ new Set([
4692
4699
  function isEndActionTag(tagType, resourceId, text2) {
4693
4700
  return tagType === "handoff" || END_ACTION_RESOURCE_IDS.has(resourceId) || END_ACTION_TEXTS.has(text2.toLowerCase());
4694
4701
  }
4695
- function extractInlineItems(content, blockIndex) {
4702
+ function extractInlineItems(content, blockIndex, listItemPath = []) {
4696
4703
  const items = [];
4697
4704
  for (const node of content) {
4698
4705
  if (node.type === "jumpPoint") {
@@ -4709,22 +4716,26 @@ function extractInlineItems(content, blockIndex) {
4709
4716
  label: endAction ? `End ${node.text}` : node.text,
4710
4717
  blockIndex,
4711
4718
  children: [],
4712
- meta: { tagType: node.tagType, resourceId: node.resourceId }
4719
+ meta: {
4720
+ tagType: node.tagType,
4721
+ resourceId: node.resourceId,
4722
+ ...listItemPath.length > 0 && { listItemPath: [...listItemPath] }
4723
+ }
4713
4724
  });
4714
4725
  }
4715
4726
  }
4716
4727
  return items;
4717
4728
  }
4718
- function extractBlockItems(blocks, startIndex, depth) {
4729
+ function extractBlockItems(blocks, startIndex, depth, listItemPath = [], fixedBlockIndex) {
4719
4730
  if (depth > MAX_DEPTH6) return [];
4720
4731
  const items = [];
4721
4732
  for (let i = 0; i < blocks.length; i++) {
4722
4733
  const block = blocks[i];
4723
- const blockIndex = startIndex + i;
4734
+ const blockIndex = fixedBlockIndex ?? startIndex + i;
4724
4735
  switch (block.type) {
4725
4736
  case "heading": {
4726
4737
  const label = textContent(block) || `Heading ${block.level}`;
4727
- const inlineItems = extractInlineItems(block.content, blockIndex);
4738
+ const inlineItems = extractInlineItems(block.content, blockIndex, listItemPath);
4728
4739
  items.push({
4729
4740
  type: "heading",
4730
4741
  label,
@@ -4735,7 +4746,7 @@ function extractBlockItems(blocks, startIndex, depth) {
4735
4746
  break;
4736
4747
  }
4737
4748
  case "paragraph": {
4738
- const inlineItems = extractInlineItems(block.content, blockIndex);
4749
+ const inlineItems = extractInlineItems(block.content, blockIndex, listItemPath);
4739
4750
  items.push(...inlineItems);
4740
4751
  break;
4741
4752
  }
@@ -4771,14 +4782,15 @@ function extractBlockItems(blocks, startIndex, depth) {
4771
4782
  }
4772
4783
  case "bulletList":
4773
4784
  case "orderedList": {
4774
- for (const li of block.content) {
4775
- const childItems = extractBlockItems(li.content, blockIndex, depth + 1);
4785
+ for (let liIdx = 0; liIdx < block.content.length; liIdx++) {
4786
+ const li = block.content[liIdx];
4787
+ const childItems = extractBlockItems(li.content, blockIndex, depth + 1, [...listItemPath, liIdx], blockIndex);
4776
4788
  items.push(...childItems);
4777
4789
  }
4778
4790
  break;
4779
4791
  }
4780
4792
  case "blockquote": {
4781
- const childItems = extractBlockItems(block.content, blockIndex, depth + 1);
4793
+ const childItems = extractBlockItems(block.content, blockIndex, depth + 1, listItemPath, blockIndex);
4782
4794
  items.push(...childItems);
4783
4795
  break;
4784
4796
  }