dtSpark 1.0.10__py3-none-any.whl → 1.1.0a1__py3-none-any.whl
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.
- dtSpark/_version.txt +1 -1
- dtSpark/core/application.py +226 -0
- dtSpark/mcp_integration/tool_selector.py +5 -0
- dtSpark/resources/config.yaml.template +42 -0
- dtSpark/tools/builtin.py +1438 -0
- dtSpark/web/endpoints/chat.py +147 -0
- dtSpark/web/endpoints/main_menu.py +75 -0
- dtSpark/web/templates/chat.html +300 -0
- dtSpark/web/templates/main_menu.html +71 -29
- {dtspark-1.0.10.dist-info → dtspark-1.1.0a1.dist-info}/METADATA +7 -1
- {dtspark-1.0.10.dist-info → dtspark-1.1.0a1.dist-info}/RECORD +15 -15
- {dtspark-1.0.10.dist-info → dtspark-1.1.0a1.dist-info}/WHEEL +0 -0
- {dtspark-1.0.10.dist-info → dtspark-1.1.0a1.dist-info}/entry_points.txt +0 -0
- {dtspark-1.0.10.dist-info → dtspark-1.1.0a1.dist-info}/licenses/LICENSE +0 -0
- {dtspark-1.0.10.dist-info → dtspark-1.1.0a1.dist-info}/top_level.txt +0 -0
dtSpark/_version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.
|
|
1
|
+
1.1.0a1
|
dtSpark/core/application.py
CHANGED
|
@@ -779,6 +779,27 @@ class AWSBedrockCLI(AbstractApp):
|
|
|
779
779
|
'enabled': self.settings.get('embedded_tools.filesystem.enabled', False),
|
|
780
780
|
'allowed_path': self.settings.get('embedded_tools.filesystem.allowed_path', './'),
|
|
781
781
|
'access_mode': self.settings.get('embedded_tools.filesystem.access_mode', 'read')
|
|
782
|
+
},
|
|
783
|
+
'documents': {
|
|
784
|
+
'enabled': self.settings.get('embedded_tools.documents.enabled', False),
|
|
785
|
+
'allowed_path': self.settings.get('embedded_tools.documents.allowed_path', './'),
|
|
786
|
+
'access_mode': self.settings.get('embedded_tools.documents.access_mode', 'read'),
|
|
787
|
+
'max_file_size_mb': self.settings.get('embedded_tools.documents.max_file_size_mb', 50),
|
|
788
|
+
'reading': {
|
|
789
|
+
'max_pdf_pages': self.settings.get('embedded_tools.documents.reading.max_pdf_pages', 100),
|
|
790
|
+
'max_excel_rows': self.settings.get('embedded_tools.documents.reading.max_excel_rows', 10000)
|
|
791
|
+
},
|
|
792
|
+
'creation': {
|
|
793
|
+
'templates_path': self.settings.get('embedded_tools.documents.creation.templates_path'),
|
|
794
|
+
'default_author': self.settings.get('embedded_tools.documents.creation.default_author')
|
|
795
|
+
}
|
|
796
|
+
},
|
|
797
|
+
'archives': {
|
|
798
|
+
'enabled': self.settings.get('embedded_tools.archives.enabled', False),
|
|
799
|
+
'allowed_path': self.settings.get('embedded_tools.archives.allowed_path', './'),
|
|
800
|
+
'access_mode': self.settings.get('embedded_tools.archives.access_mode', 'read'),
|
|
801
|
+
'max_file_size_mb': self.settings.get('embedded_tools.archives.max_file_size_mb', 100),
|
|
802
|
+
'max_files_to_list': self.settings.get('embedded_tools.archives.max_files_to_list', 1000)
|
|
782
803
|
}
|
|
783
804
|
}
|
|
784
805
|
}
|
|
@@ -1655,6 +1676,122 @@ class AWSBedrockCLI(AbstractApp):
|
|
|
1655
1676
|
)
|
|
1656
1677
|
filesystem_access_mode = access_mode_choices[access_mode_choice]
|
|
1657
1678
|
|
|
1679
|
+
# ═══════════════════════════════════════════════════════════════
|
|
1680
|
+
# Embedded Document Tools (MS Office & PDF)
|
|
1681
|
+
# ═══════════════════════════════════════════════════════════════
|
|
1682
|
+
cli.console.print()
|
|
1683
|
+
enable_document_tools = Confirm.ask("Enable embedded document tools (MS Office & PDF)?", default=False)
|
|
1684
|
+
|
|
1685
|
+
# Default values
|
|
1686
|
+
document_allowed_path = "./running"
|
|
1687
|
+
document_access_mode = "read"
|
|
1688
|
+
document_max_file_size = "50"
|
|
1689
|
+
document_max_pdf_pages = "100"
|
|
1690
|
+
document_max_excel_rows = "10000"
|
|
1691
|
+
document_templates_path = ""
|
|
1692
|
+
document_default_author = ""
|
|
1693
|
+
|
|
1694
|
+
if enable_document_tools:
|
|
1695
|
+
cli.console.print()
|
|
1696
|
+
cli.console.print("[dim]Document tools allow reading and creating MS Office documents (Word, Excel, PowerPoint) and PDFs.[/dim]")
|
|
1697
|
+
cli.console.print()
|
|
1698
|
+
|
|
1699
|
+
document_allowed_path = Prompt.ask(
|
|
1700
|
+
"Allowed directory path for documents",
|
|
1701
|
+
default="./running"
|
|
1702
|
+
)
|
|
1703
|
+
|
|
1704
|
+
# Access mode
|
|
1705
|
+
doc_access_mode_choices = {
|
|
1706
|
+
"1": "read",
|
|
1707
|
+
"2": "read_write"
|
|
1708
|
+
}
|
|
1709
|
+
cli.console.print()
|
|
1710
|
+
cli.console.print(" [1] Read - Read documents only")
|
|
1711
|
+
cli.console.print(" [2] Read/Write - Read and create documents")
|
|
1712
|
+
cli.console.print()
|
|
1713
|
+
doc_access_mode_choice = Prompt.ask(
|
|
1714
|
+
"Select access mode",
|
|
1715
|
+
choices=["1", "2"],
|
|
1716
|
+
default="1"
|
|
1717
|
+
)
|
|
1718
|
+
document_access_mode = doc_access_mode_choices[doc_access_mode_choice]
|
|
1719
|
+
|
|
1720
|
+
document_max_file_size = Prompt.ask(
|
|
1721
|
+
"Maximum file size in MB",
|
|
1722
|
+
default="50"
|
|
1723
|
+
)
|
|
1724
|
+
|
|
1725
|
+
document_max_pdf_pages = Prompt.ask(
|
|
1726
|
+
"Maximum PDF pages to read",
|
|
1727
|
+
default="100"
|
|
1728
|
+
)
|
|
1729
|
+
|
|
1730
|
+
document_max_excel_rows = Prompt.ask(
|
|
1731
|
+
"Maximum Excel rows to read",
|
|
1732
|
+
default="10000"
|
|
1733
|
+
)
|
|
1734
|
+
|
|
1735
|
+
if document_access_mode == "read_write":
|
|
1736
|
+
cli.console.print()
|
|
1737
|
+
cli.console.print("[dim]Templates allow creating documents with placeholder substitution.[/dim]")
|
|
1738
|
+
document_templates_path = Prompt.ask(
|
|
1739
|
+
"Templates directory path (leave empty to disable)",
|
|
1740
|
+
default=""
|
|
1741
|
+
)
|
|
1742
|
+
document_default_author = Prompt.ask(
|
|
1743
|
+
"Default author for created documents (leave empty to disable)",
|
|
1744
|
+
default=""
|
|
1745
|
+
)
|
|
1746
|
+
|
|
1747
|
+
# ═══════════════════════════════════════════════════════════════
|
|
1748
|
+
# Embedded Archive Tools
|
|
1749
|
+
# ═══════════════════════════════════════════════════════════════
|
|
1750
|
+
cli.console.print()
|
|
1751
|
+
enable_archive_tools = Confirm.ask("Enable embedded archive tools (ZIP, TAR)?", default=False)
|
|
1752
|
+
|
|
1753
|
+
# Default values
|
|
1754
|
+
archive_allowed_path = "./running"
|
|
1755
|
+
archive_access_mode = "read"
|
|
1756
|
+
archive_max_file_size = "100"
|
|
1757
|
+
archive_max_files_to_list = "1000"
|
|
1758
|
+
|
|
1759
|
+
if enable_archive_tools:
|
|
1760
|
+
cli.console.print()
|
|
1761
|
+
cli.console.print("[dim]Archive tools allow reading and extracting ZIP and TAR archives.[/dim]")
|
|
1762
|
+
cli.console.print()
|
|
1763
|
+
|
|
1764
|
+
archive_allowed_path = Prompt.ask(
|
|
1765
|
+
"Allowed directory path for archives",
|
|
1766
|
+
default="./running"
|
|
1767
|
+
)
|
|
1768
|
+
|
|
1769
|
+
# Access mode
|
|
1770
|
+
archive_access_mode_choices = {
|
|
1771
|
+
"1": "read",
|
|
1772
|
+
"2": "read_write"
|
|
1773
|
+
}
|
|
1774
|
+
cli.console.print()
|
|
1775
|
+
cli.console.print(" [1] Read - List contents and read files from archives")
|
|
1776
|
+
cli.console.print(" [2] Read/Write - Read and extract archives to disk")
|
|
1777
|
+
cli.console.print()
|
|
1778
|
+
archive_access_mode_choice = Prompt.ask(
|
|
1779
|
+
"Select access mode",
|
|
1780
|
+
choices=["1", "2"],
|
|
1781
|
+
default="1"
|
|
1782
|
+
)
|
|
1783
|
+
archive_access_mode = archive_access_mode_choices[archive_access_mode_choice]
|
|
1784
|
+
|
|
1785
|
+
archive_max_file_size = Prompt.ask(
|
|
1786
|
+
"Maximum archive file size in MB",
|
|
1787
|
+
default="100"
|
|
1788
|
+
)
|
|
1789
|
+
|
|
1790
|
+
archive_max_files_to_list = Prompt.ask(
|
|
1791
|
+
"Maximum files to list from archive",
|
|
1792
|
+
default="1000"
|
|
1793
|
+
)
|
|
1794
|
+
|
|
1658
1795
|
# ═══════════════════════════════════════════════════════════════
|
|
1659
1796
|
# Tool Permissions
|
|
1660
1797
|
# ═══════════════════════════════════════════════════════════════
|
|
@@ -2040,6 +2177,95 @@ class AWSBedrockCLI(AbstractApp):
|
|
|
2040
2177
|
config_content
|
|
2041
2178
|
)
|
|
2042
2179
|
|
|
2180
|
+
# Embedded Document Tools
|
|
2181
|
+
config_content = re.sub(
|
|
2182
|
+
r'(documents:\s*\n\s+enabled:\s+)(true|false)',
|
|
2183
|
+
f'\\g<1>{str(enable_document_tools).lower()}',
|
|
2184
|
+
config_content
|
|
2185
|
+
)
|
|
2186
|
+
if enable_document_tools:
|
|
2187
|
+
# Allowed path
|
|
2188
|
+
escaped_doc_path = document_allowed_path.replace('\\', '/')
|
|
2189
|
+
config_content = re.sub(
|
|
2190
|
+
r'(documents:\s*\n\s+enabled:\s+(?:true|false)\s*\n\s+allowed_path:\s+)[^\s#]+',
|
|
2191
|
+
f'\\g<1>{escaped_doc_path}',
|
|
2192
|
+
config_content
|
|
2193
|
+
)
|
|
2194
|
+
# Access mode
|
|
2195
|
+
config_content = re.sub(
|
|
2196
|
+
r'(documents:\s*\n\s+enabled:\s+(?:true|false)\s*\n\s+allowed_path:\s+[^\s#]+\s*\n\s+access_mode:\s+)(read|read_write)',
|
|
2197
|
+
f'\\g<1>{document_access_mode}',
|
|
2198
|
+
config_content
|
|
2199
|
+
)
|
|
2200
|
+
# Max file size
|
|
2201
|
+
config_content = re.sub(
|
|
2202
|
+
r'(documents:.*?max_file_size_mb:\s+)\d+',
|
|
2203
|
+
f'\\g<1>{document_max_file_size}',
|
|
2204
|
+
config_content,
|
|
2205
|
+
flags=re.DOTALL
|
|
2206
|
+
)
|
|
2207
|
+
# Max PDF pages
|
|
2208
|
+
config_content = re.sub(
|
|
2209
|
+
r'(max_pdf_pages:\s+)\d+',
|
|
2210
|
+
f'\\g<1>{document_max_pdf_pages}',
|
|
2211
|
+
config_content
|
|
2212
|
+
)
|
|
2213
|
+
# Max Excel rows
|
|
2214
|
+
config_content = re.sub(
|
|
2215
|
+
r'(max_excel_rows:\s+)\d+',
|
|
2216
|
+
f'\\g<1>{document_max_excel_rows}',
|
|
2217
|
+
config_content
|
|
2218
|
+
)
|
|
2219
|
+
# Templates path (if provided)
|
|
2220
|
+
if document_templates_path:
|
|
2221
|
+
escaped_templates_path = document_templates_path.replace('\\', '/')
|
|
2222
|
+
config_content = re.sub(
|
|
2223
|
+
r'(templates_path:\s+)(null|[^\s#]+)',
|
|
2224
|
+
f'\\g<1>{escaped_templates_path}',
|
|
2225
|
+
config_content
|
|
2226
|
+
)
|
|
2227
|
+
# Default author (if provided)
|
|
2228
|
+
if document_default_author:
|
|
2229
|
+
config_content = re.sub(
|
|
2230
|
+
r'(default_author:\s+)(null|[^\s#]+)',
|
|
2231
|
+
f'\\g<1>{document_default_author}',
|
|
2232
|
+
config_content
|
|
2233
|
+
)
|
|
2234
|
+
|
|
2235
|
+
# Embedded Archive Tools
|
|
2236
|
+
config_content = re.sub(
|
|
2237
|
+
r'(archives:\s*\n\s+enabled:\s+)(true|false)',
|
|
2238
|
+
f'\\g<1>{str(enable_archive_tools).lower()}',
|
|
2239
|
+
config_content
|
|
2240
|
+
)
|
|
2241
|
+
if enable_archive_tools:
|
|
2242
|
+
# Allowed path
|
|
2243
|
+
escaped_archive_path = archive_allowed_path.replace('\\', '/')
|
|
2244
|
+
config_content = re.sub(
|
|
2245
|
+
r'(archives:\s*\n\s+enabled:\s+(?:true|false)\s*\n\s+allowed_path:\s+)[^\s#]+',
|
|
2246
|
+
f'\\g<1>{escaped_archive_path}',
|
|
2247
|
+
config_content
|
|
2248
|
+
)
|
|
2249
|
+
# Access mode
|
|
2250
|
+
config_content = re.sub(
|
|
2251
|
+
r'(archives:\s*\n\s+enabled:\s+(?:true|false)\s*\n\s+allowed_path:\s+[^\s#]+\s*\n\s+access_mode:\s+)(read|read_write)',
|
|
2252
|
+
f'\\g<1>{archive_access_mode}',
|
|
2253
|
+
config_content
|
|
2254
|
+
)
|
|
2255
|
+
# Max file size
|
|
2256
|
+
config_content = re.sub(
|
|
2257
|
+
r'(archives:.*?max_file_size_mb:\s+)\d+',
|
|
2258
|
+
f'\\g<1>{archive_max_file_size}',
|
|
2259
|
+
config_content,
|
|
2260
|
+
flags=re.DOTALL
|
|
2261
|
+
)
|
|
2262
|
+
# Max files to list
|
|
2263
|
+
config_content = re.sub(
|
|
2264
|
+
r'(max_files_to_list:\s+)\d+',
|
|
2265
|
+
f'\\g<1>{archive_max_files_to_list}',
|
|
2266
|
+
config_content
|
|
2267
|
+
)
|
|
2268
|
+
|
|
2043
2269
|
# Tool Permissions
|
|
2044
2270
|
config_content = re.sub(
|
|
2045
2271
|
r'(tool_permissions:\s*\n\s+auto_approve:\s+)(true|false)',
|
|
@@ -21,6 +21,8 @@ class ToolSelector:
|
|
|
21
21
|
'aws_infrastructure': ['ec2', 's3', 'lambda', 'cloudwatch', 'iam', 'vpc', 'rds', 'dynamodb', 'diagram'],
|
|
22
22
|
'elasticsearch': ['elasticsearch', 'search', 'index', 'query', 'aggregation'],
|
|
23
23
|
'ragstore': ['ragstore', 'rag', 'embedding', 'vector', 'semantic'],
|
|
24
|
+
'documents': ['word', 'excel', 'powerpoint', 'pdf', 'document', 'docx', 'xlsx', 'pptx', 'spreadsheet'],
|
|
25
|
+
'archives': ['archive', 'zip', 'tar', 'extract', 'compress', 'tgz'],
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
# Keywords in user messages that trigger specific categories
|
|
@@ -36,6 +38,9 @@ class ToolSelector:
|
|
|
36
38
|
'vpc', 'subnet', 'instance', 'bucket', 'function', 'diagram'],
|
|
37
39
|
'elasticsearch': ['elasticsearch', 'search', 'query', 'index', 'log', 'aggregate'],
|
|
38
40
|
'ragstore': ['ragstore', 'rag', 'embedding', 'semantic', 'vector', 'similarity'],
|
|
41
|
+
'documents': ['document', 'word', 'excel', 'powerpoint', 'pdf', 'docx', 'xlsx', 'pptx',
|
|
42
|
+
'spreadsheet', 'presentation', 'template', 'office'],
|
|
43
|
+
'archives': ['archive', 'zip', 'tar', 'extract', 'unzip', 'compressed', 'tgz'],
|
|
39
44
|
}
|
|
40
45
|
|
|
41
46
|
def __init__(self, max_tools_per_request: int = 30):
|
|
@@ -603,6 +603,48 @@ embedded_tools:
|
|
|
603
603
|
# - Use read-only mode when write operations are not needed
|
|
604
604
|
# - Consider using specific subdirectories rather than root paths
|
|
605
605
|
|
|
606
|
+
# Document Tools (MS Office and PDF)
|
|
607
|
+
# Tools for reading and creating Microsoft Office documents and PDFs
|
|
608
|
+
documents:
|
|
609
|
+
enabled: false # Set to true to enable document reading/creation tools
|
|
610
|
+
allowed_path: ./ # Root path for document operations (files must be within this path)
|
|
611
|
+
access_mode: read # Access mode: "read" (read-only) or "read_write" (read and create)
|
|
612
|
+
# read: Only read operations (read_word_document, read_excel_document, etc.)
|
|
613
|
+
# read_write: Adds create operations (create_word_document, etc.)
|
|
614
|
+
max_file_size_mb: 50 # Maximum file size for document operations (in megabytes)
|
|
615
|
+
|
|
616
|
+
# Document reading options
|
|
617
|
+
reading:
|
|
618
|
+
max_pdf_pages: 100 # Maximum pages to extract from PDF documents
|
|
619
|
+
max_excel_rows: 10000 # Maximum rows to read from Excel spreadsheets
|
|
620
|
+
|
|
621
|
+
# Document creation options (only applies when access_mode is 'read_write')
|
|
622
|
+
creation:
|
|
623
|
+
templates_path: null # Optional: path to directory containing document templates
|
|
624
|
+
# Templates use {{placeholder_name}} syntax for replacements
|
|
625
|
+
default_author: null # Optional: default author name for created documents
|
|
626
|
+
|
|
627
|
+
# Supported formats:
|
|
628
|
+
# - Word: .docx (read and create)
|
|
629
|
+
# - Excel: .xlsx (read and create)
|
|
630
|
+
# - PowerPoint: .pptx (read and create)
|
|
631
|
+
# - PDF: .pdf (read only)
|
|
632
|
+
|
|
633
|
+
# Archive Tools
|
|
634
|
+
# Tools for reading and extracting compressed archive files
|
|
635
|
+
archives:
|
|
636
|
+
enabled: false # Set to true to enable archive tools
|
|
637
|
+
allowed_path: ./ # Root path for archive operations (files must be within this path)
|
|
638
|
+
access_mode: read # Access mode: "read" (list/read only) or "read_write" (includes extraction)
|
|
639
|
+
# read: Only list_archive_contents and read_archive_file operations
|
|
640
|
+
# read_write: Adds extract_archive operation
|
|
641
|
+
max_file_size_mb: 100 # Maximum archive size for operations (in megabytes)
|
|
642
|
+
max_files_to_list: 1000 # Maximum number of files to list from an archive
|
|
643
|
+
|
|
644
|
+
# Supported formats:
|
|
645
|
+
# - ZIP: .zip
|
|
646
|
+
# - TAR: .tar, .tar.gz, .tgz, .tar.bz2
|
|
647
|
+
|
|
606
648
|
# Tool Permissions
|
|
607
649
|
# Controls how tool usage permissions are handled
|
|
608
650
|
tool_permissions:
|