@tasksai/install 0.1.24 → 0.1.26
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/package.json +1 -1
- package/runtime/server.py +32 -5
package/package.json
CHANGED
package/runtime/server.py
CHANGED
|
@@ -125,7 +125,7 @@ if not LICENSE_KEY:
|
|
|
125
125
|
print("Find your key in your purchase confirmation email.", file=sys.stderr, flush=True)
|
|
126
126
|
sys.exit(1)
|
|
127
127
|
|
|
128
|
-
SERVER_VERSION = "2.4.
|
|
128
|
+
SERVER_VERSION = "2.4.2"
|
|
129
129
|
|
|
130
130
|
AUTH_HEADERS = {
|
|
131
131
|
"Authorization": f"Bearer {LICENSE_KEY}",
|
|
@@ -907,6 +907,8 @@ def inferred_plain_heading_level(lines, index):
|
|
|
907
907
|
text = lines[index].strip()
|
|
908
908
|
if not text or len(text) > 90 or "|" in text or ":" in text:
|
|
909
909
|
return None
|
|
910
|
+
if re.match(r"^(?:[-*+]\s+|\d+\.\s+|>|<!--)", text):
|
|
911
|
+
return None
|
|
910
912
|
if text.endswith((".", "?", "!", ";")):
|
|
911
913
|
return None
|
|
912
914
|
|
|
@@ -930,6 +932,9 @@ def inferred_plain_heading_level(lines, index):
|
|
|
930
932
|
|
|
931
933
|
def labeled_fact(line):
|
|
932
934
|
"""Return a label/value pair for a short professional fact line."""
|
|
935
|
+
bold_match = re.match(r"^\*\*([^*\n:]{1,55}):\*\*\s+(.+)$", line.strip())
|
|
936
|
+
if bold_match:
|
|
937
|
+
return bold_match.group(1).strip(), bold_match.group(2).strip()
|
|
933
938
|
match = re.match(r"^([^:\n]{1,55}):\s+(.+)$", line.strip())
|
|
934
939
|
if not match:
|
|
935
940
|
return None
|
|
@@ -952,7 +957,7 @@ def add_labeled_fact(doc, label, value):
|
|
|
952
957
|
def iter_inline_markdown(text):
|
|
953
958
|
"""Yield (text, marks) spans for common inline Markdown."""
|
|
954
959
|
token_re = re.compile(
|
|
955
|
-
r"(`[^`]+`|\*\*[^*]+\*\*|__[^_]+__|\*[^*\s][^*]*\*|_[^_\s][^_]*_|\[[^\]]+\]\([^)]+\))"
|
|
960
|
+
r"(`[^`]+`|\*\*[^*]+\*\*|__[^_]+__|\*[^*\s][^*]*\*|(?<!\w)_[^_\s][^_]*_(?!\w)|\[[^\]]+\]\([^)]+\))"
|
|
956
961
|
)
|
|
957
962
|
pos = 0
|
|
958
963
|
for match in token_re.finditer(text):
|
|
@@ -1140,10 +1145,14 @@ def add_markdown_table(doc, rows, alignments):
|
|
|
1140
1145
|
table.style = "Table Grid"
|
|
1141
1146
|
table.autofit = True
|
|
1142
1147
|
repeat_table_header(table.rows[0])
|
|
1143
|
-
for table_row in table.rows:
|
|
1144
|
-
prevent_table_row_split(table_row)
|
|
1145
|
-
|
|
1146
1148
|
for row_index, row in enumerate(normalized):
|
|
1149
|
+
row_characters = sum(len(value) for value in row)
|
|
1150
|
+
longest_cell = max((len(value) for value in row), default=0)
|
|
1151
|
+
if row_index == 0 or (row_characters <= 600 and longest_cell <= 350):
|
|
1152
|
+
# Keep ordinary rows intact so a cell does not strand a fragment
|
|
1153
|
+
# on the next page. Exceptionally large rows may still split to
|
|
1154
|
+
# avoid creating a mostly blank page.
|
|
1155
|
+
prevent_table_row_split(table.rows[row_index])
|
|
1147
1156
|
for column_index, value in enumerate(row):
|
|
1148
1157
|
cell = table.cell(row_index, column_index)
|
|
1149
1158
|
set_cell_margins(cell)
|
|
@@ -1280,6 +1289,7 @@ def write_docx(path, title, content_markdown, product_name):
|
|
|
1280
1289
|
continue
|
|
1281
1290
|
|
|
1282
1291
|
heading = re.match(r"^(#{1,4})\s+(.+)$", stripped)
|
|
1292
|
+
standalone_bold_heading = re.fullmatch(r"\*\*([^*\n]{1,120})\*\*", stripped)
|
|
1283
1293
|
inferred_heading = inferred_plain_heading_level(lines, index)
|
|
1284
1294
|
bullet = re.match(r"^(\s*)[-*+]\s+(.+)$", line)
|
|
1285
1295
|
numbered = re.match(r"^(\s*)\d+\.\s+(.+)$", line)
|
|
@@ -1294,6 +1304,19 @@ def write_docx(path, title, content_markdown, product_name):
|
|
|
1294
1304
|
else None
|
|
1295
1305
|
)
|
|
1296
1306
|
|
|
1307
|
+
if re.fullmatch(r"<!--\s*[^\n]*?\s*-->", stripped):
|
|
1308
|
+
# Public-copy delimiters and other machine-readable Markdown
|
|
1309
|
+
# comments are useful in the source but must not appear in the
|
|
1310
|
+
# downloadable customer document.
|
|
1311
|
+
flush_paragraph()
|
|
1312
|
+
index += 1
|
|
1313
|
+
continue
|
|
1314
|
+
if stripped == ">":
|
|
1315
|
+
# A blank line inside a Markdown blockquote is structural spacing,
|
|
1316
|
+
# not a literal greater-than character in the Word document.
|
|
1317
|
+
flush_paragraph()
|
|
1318
|
+
index += 1
|
|
1319
|
+
continue
|
|
1297
1320
|
if is_markdown_table_start(lines, index):
|
|
1298
1321
|
flush_paragraph()
|
|
1299
1322
|
header = markdown_table_row(lines[index])
|
|
@@ -1320,6 +1343,10 @@ def write_docx(path, title, content_markdown, product_name):
|
|
|
1320
1343
|
doc.add_heading(heading_text, level=min(len(heading.group(1)), 4))
|
|
1321
1344
|
keep_checklist_together = "checklist" in heading_text.casefold()
|
|
1322
1345
|
index += 1
|
|
1346
|
+
elif standalone_bold_heading:
|
|
1347
|
+
flush_paragraph()
|
|
1348
|
+
doc.add_heading(standalone_bold_heading.group(1).strip(), level=3)
|
|
1349
|
+
index += 1
|
|
1323
1350
|
elif inferred_heading:
|
|
1324
1351
|
flush_paragraph()
|
|
1325
1352
|
doc.add_heading(stripped, level=inferred_heading)
|